Ticket #2885: 2885_4.patch

File 2885_4.patch, 22.8 KB (added by Martin Kou, 15 years ago)
  • _source/lang/en.js

     
    549549                tag_div : 'Normal (DIV)'
    550550        },
    551551
     552        div :
     553        {
     554                title                           : 'Create Div Container',
     555                toolbar                         : 'Create Div Container',
     556                cssClassInputLabel      : 'Stylesheet Classes',
     557                styleSelectLabel        : 'Style',
     558                IdInputLabel            : 'Id',
     559                languageCodeInputLabel  : ' Language Code',
     560                inlineStyleInputLabel   : 'Inline Style',
     561                advisoryTitleInputLabel : 'Advisory Title',
     562                langDirLabel            : 'Language Direction',
     563                langDirLTRLabel         : 'Left to Right (LTR)',
     564                langDirRTLLabel         : 'Right to Left (RTL)',
     565                edit                            : 'Edit Div Container',
     566                remove                          : 'Remove Div Container'
     567        },
     568
    552569        font :
    553570        {
    554571                label : 'Font',
  • _source/plugins/menu/plugin.js

     
    328328        'form,' +
    329329        'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+
    330330        'anchor,link,image,flash,' +
    331         'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea';
     331        'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';
  • _source/plugins/div/dialogs/div.js

     
     1/*
     2 * Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3 * For licensing, see LICENSE.html or http://ckeditor.com/license
     4 */
     5
     6(function()
     7{
     8       
     9        /**
     10         * Add to collection with DUP examination.
     11         * @param {Object} collection
     12         * @param {Object} element
     13         * @param {Object} database
     14         */
     15        function addSafely( collection, element, database )
     16        {
     17                // avoid duplicate
     18                if ( !element.getCustomData( 'block_processed' ) )
     19                {
     20                        CKEDITOR.dom.element.setMarker( database, element,
     21                                'block_processed', true );
     22                        collection.push( element );
     23                }
     24        }
     25       
     26        /**
     27         * Dialog reused by both 'creatediv' and 'editdiv' commands.
     28         * @param {Object} editor
     29         * @param {String} command      The command name which indicate what the current command is.
     30         */
     31        function divDialog( editor, command )
     32        {
     33                // Definition of elements at which div operation should stopped.
     34                var divLimitDefiniton = ( function(){
     35                       
     36                        // Customzie from specialize blockLimit elements
     37                        var definition = CKEDITOR.tools.extend( {}, CKEDITOR.dom.elementPath.pathBlockLimitElements );
     38
     39                        // Exclude 'div' itself.
     40                        delete definition.div;
     41
     42                        // Exclude 'td' and 'th' when 'wrapping table'
     43                        if( editor.config.div_wrapTable)
     44                        {
     45                                delete definition.td;
     46                                delete definition.th;
     47                        }
     48                        return definition;
     49                })();
     50               
     51                // DTD of 'div' element
     52                var dtd = CKEDITOR.dtd.div;
     53               
     54                /**
     55                 * Get the first div limit element on the element's path.
     56                 * @param {Object} element
     57                 */
     58                function getDivLimitElement( element )
     59                {
     60                        var pathElements = new CKEDITOR.dom.elementPath( element ).elements;
     61                        var divLimit;
     62                        for ( var i = 0; i < pathElements.length ; i++ )
     63                        {
     64                                if ( pathElements[ i ].getName() in divLimitDefiniton )
     65                                {
     66                                        divLimit = pathElements[ i ];
     67                                        break;
     68                                }
     69                        }
     70                        return divLimit;
     71                }
     72               
     73                /**
     74                 * Init all fields' setup/commit function.
     75                 * @memberof divDialog
     76                 */
     77                function setupFields()
     78                {
     79                        this.foreach( function( field )
     80                        {
     81                                // Exclude layout container elements
     82                                if( /^(?!vbox|hbox)/.test( field.type ) )
     83                                {
     84                                        if ( !field.setup )
     85                                        {
     86                                                // Read the dialog fields values from the specified
     87                                                // element attributes.
     88                                                field.setup = function( element )
     89                                                {
     90                                                        field.setValue( element.getAttribute( field.id ) || '' );
     91                                                };
     92                                        }
     93                                        if ( !field.commit )
     94                                        {
     95                                                // Set element attributes assigned by the dialog
     96                                                // fields.
     97                                                field.commit = function( element )
     98                                                {
     99                                                        var fieldValue = this.getValue();
     100                                                        // ignore default element attribute values
     101                                                        if ( 'dir' == field.id && element.getComputedStyle( 'direction' ) == fieldValue )
     102                                                                return true;
     103                                                        if ( fieldValue )
     104                                                                element.setAttribute( field.id, fieldValue );
     105                                                        else
     106                                                                element.removeAttribute( field.id );
     107                                                };
     108                                        }
     109                                }
     110                        } );
     111                }
     112               
     113                /**
     114                 * Either create or detect the desired block containers among the selected ranges.
     115                 * @param {Object} editor
     116                 * @param {Object} containerTagName The tagName of the container.
     117                 * @param {Object} isCreate Whether it's a creation process OR a detection process.
     118                 */     
     119                function applyDiv( editor, isCreate )
     120                {
     121                        // new adding containers OR detected pre-existed containers.
     122                        var containers = [];
     123                        // node markers store.
     124                        var database = {};
     125                        // All block level elements which contained by the ranges.
     126                        var containedBlocks = [], block;
     127       
     128                        // Get all ranges from the selection.
     129                        var selection = editor.document.getSelection();
     130                        var ranges = selection.getRanges();
     131                        var i, iterator;
     132       
     133                        // collect all included elements from dom-iterator
     134                        for( i = 0 ; i < ranges.length ; i++ )
     135                        {
     136                                iterator = ranges[ i ].createIterator();
     137                                while( ( block = iterator.getNextParagraph() ) )
     138                                {
     139                                        // include contents of blockLimit elements.
     140                                        if( block.getName() in divLimitDefiniton )
     141                                        {
     142                                                var j, childNodes = block.getChildren();
     143                                                for ( j = 0 ; j < childNodes.count() ; j++ )
     144                                                        addSafely( containedBlocks, childNodes.getItem( j ) , database );
     145                                        }
     146                                        else
     147                                        {
     148                                                // Bypass dtd disallowed elements.     
     149                                                while( !dtd[ block.getName() ] && block.getName() != 'body' )
     150                                                        block = block.getParent();
     151                                                addSafely( containedBlocks, block, database );
     152                                        }
     153                                }
     154                        }
     155                       
     156                        CKEDITOR.dom.element.clearAllMarkers( database );
     157                       
     158                        var blockGroups = groupByDivLimit( containedBlocks );
     159                        var ancestor, blockEl, divElement;
     160
     161                        for( i = 0 ; i < blockGroups.length ; i++ )
     162                        {
     163                                var currentBlock = blockGroups[ i ][ 0 ];
     164                               
     165                                // Calculate the common parent node of all contained elements.
     166                                ancestor = currentBlock.getParent();
     167                                for ( var j = 1 ; j < blockGroups[ i ].length; j++ )
     168                                        ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] );
     169                               
     170                                if( isCreate )
     171                                        divElement = new CKEDITOR.dom.element( 'div', editor.document );
     172                               
     173                                // Normalize the blocks in each group to a common parent.
     174                                for( var j = 0; j < blockGroups[ i ].length ; j++ )
     175                                {
     176                                        currentBlock = blockGroups[ i ][ j ];
     177       
     178                                        while( !currentBlock.getParent().equals( ancestor ) )
     179                                                currentBlock = currentBlock.getParent();
     180
     181                                        blockGroups[ i ][ j ] = currentBlock;
     182                                }
     183
     184                                // Wrapped blocks counting
     185                                var childCount = 0;
     186                                for ( var j = 0 ; j < blockGroups[ i ].length ; j++ )
     187                                {
     188                                        currentBlock = blockGroups[ i ][ j ];
     189                                        // Avoid DUP
     190                                        if ( !currentBlock.getCustomData( 'block_processed' ) )
     191                                        {
     192                                                CKEDITOR.dom.element.setMarker( database, currentBlock, 'block_processed', true );
     193
     194                                                if( isCreate )
     195                                                {
     196                                                        // Establish new container, wrapping all elements in this group.
     197                                                        if( j == 0 )
     198                                                                divElement.insertBefore( currentBlock );
     199                                                        divElement.append( currentBlock );
     200                                                }
     201                                                else
     202                                                        childCount++;
     203                                        }
     204                                }
     205
     206                                CKEDITOR.dom.element.clearAllMarkers( database );
     207       
     208                                if( isCreate )
     209                                {
     210                                        // Drop pre-existed container, since new container already
     211                                        // established.
     212                                        if ( command == 'editdiv' &&
     213                                                        ancestor.getName() == 'div'
     214                                                        && 1 == ancestor.getNonEmptyChildren().length )
     215                                                        ancestor.remove( true );
     216                                        containers.push( divElement );
     217                                }
     218                                else
     219                                {
     220                                        // discover existed container
     221                                        if ( ancestor.getName() == 'div'
     222                                                && childCount == ancestor.getNonEmptyChildren().length )
     223                                                containers.push( ancestor );
     224                                }
     225                        }
     226       
     227                        return containers;
     228                }
     229               
     230                /**
     231                 * Divide a set of nodes to different groups by their path's blocklimit element.
     232                 * Note: the specified nodes should be in source order naturally, which mean they are supposed to producea by following class:
     233                 *  * CKEDITOR.dom.range.Iterator
     234                 *  * CKEDITOR.dom.domWalker
     235                 *  @return {Array []} the grouped nodes
     236                 */
     237                function groupByDivLimit( nodes )
     238                {
     239                        var groups = [],
     240                                lastDivLimit = null,
     241                                path, block;
     242                        for ( var i = 0 ; i < nodes.length ; i++ )
     243                        {
     244                                block = nodes[i];
     245                                var limit = getDivLimitElement( block );
     246                                if ( !limit.equals( lastDivLimit ) )
     247                                {
     248                                        lastDivLimit = limit ;
     249                                        groups.push( [] ) ;
     250                                }
     251                                groups[ groups.length - 1 ].push( block ) ;
     252                        }
     253                        return groups;
     254                }
     255               
     256                function compareNodes()
     257                {
     258                        return arguments[ 0 ].equals( arguments[ 1 ] );
     259                }
     260               
     261                /**
     262                 * Hold a collection of created block container elements. 
     263                 */
     264                var containers = [];
     265                /**
     266                 * @type divDialog
     267                 */
     268                return {
     269                        title : editor.lang.div.title,
     270                        minWidth : 400,
     271                        minHeight : 320,
     272                        contents :
     273                        [
     274                        {
     275                                id :'info',
     276                                label :editor.lang.common.generalTab,
     277                                title :editor.lang.common.generalTab,
     278                                elements :
     279                                [
     280                                        {
     281                                                type :'hbox',
     282                                                widths : [ '50%', '50%' ],
     283                                                children :
     284                                                [
     285                                                        {
     286                                                                id :'elementStyle',
     287                                                                type :'select',
     288                                                                style :'width: 100%;',
     289                                                                label :editor.lang.div.styleSelectLabel,
     290                                                                'default' :editor.config.div_defaultStyle,
     291                                                                items : [],
     292                                                                setup : function( element )
     293                                                                {
     294                                                                        this.setValue( element.$.style.cssText || '' );
     295                                                                },
     296                                                                commit: function( element )
     297                                                                {
     298                                                                        if ( this.getValue() )
     299                                                                                element.$.style.cssText = this.getValue();
     300                                                                        else
     301                                                                                element.removeAttribute( 'style' );
     302                                                                }
     303                                                        },
     304                                                        {
     305                                                                id :'class',
     306                                                                type :'text',
     307                                                                label :editor.lang.common.cssClass,
     308                                                                'default' :editor.config.div_defaultCssClass
     309                                                        }
     310                                                ]
     311                                        }
     312                                ]
     313                        },
     314                        {
     315                                        id :'advanced',
     316                                        label :editor.lang.common.advancedTab,
     317                                        title :editor.lang.common.advancedTab,
     318                                        elements :
     319                                        [
     320                                        {
     321                                                type :'vbox',
     322                                                padding :1,
     323                                                children :
     324                                                [
     325                                                        {
     326                                                                type :'hbox',
     327                                                                widths : [ '50%', '50%' ],
     328                                                                children :
     329                                                                [
     330                                                                        {
     331                                                                                type :'text',
     332                                                                                id :'id',
     333                                                                                label :editor.lang.common.id,
     334                                                                                'default' :editor.config.div_defaultId
     335                                                                        },
     336                                                                        {
     337                                                                                type :'text',
     338                                                                                id :'lang',
     339                                                                                label :editor.lang.link.langCode,
     340                                                                                'default' :editor.config.div_defaultLanguageCode
     341                                                                        }
     342                                                                ]
     343                                                        },
     344                                                        {
     345                                                                type :'hbox',
     346                                                                children :
     347                                                                [
     348                                                                                {
     349                                                                                        type :'text',
     350                                                                                        id :'style',
     351                                                                                        style :'width: 100%;',
     352                                                                                        label :editor.lang.common.cssStyle,
     353                                                                                        'default' :editor.config.div_defaultInlineStyle
     354                                                                                }
     355                                                                ]
     356                                                        },
     357                                                        {
     358                                                                type :'hbox',
     359                                                                children :
     360                                                                [
     361                                                                                {
     362                                                                                        type :'text',
     363                                                                                        id :'title',
     364                                                                                        style :'width: 100%;',
     365                                                                                        label :editor.lang.common.advisoryTitle,
     366                                                                                        'default' :editor.config.div_defaultAdvisoryTitle
     367                                                                                }
     368                                                                ]
     369                                                        },
     370                                                        {
     371                                                                type :'select',
     372                                                                id :'dir',
     373                                                                style :'width: 100%;',
     374                                                                label :editor.lang.common.langDir,
     375                                                                'default' :editor.config.div_defaultLangDirLabel,
     376                                                                items :
     377                                                                [
     378                                                                        [
     379                                                                                editor.lang.common.langDirLtr,
     380                                                                                'ltr'
     381                                                                        ],
     382                                                                        [
     383                                                                                editor.lang.common.langDirRtl,
     384                                                                                'rtl'
     385                                                                        ]
     386                                                                ]
     387                                                        }
     388                                                ]
     389                                        }
     390                                        ]
     391                                }
     392                        ],
     393                        onLoad : function()
     394                        {
     395                                setupFields.call(this);
     396                        },
     397                        onShow : function()
     398                        {
     399                                containers = [];
     400                                // Whether always create new container regardless of existed
     401                                // ones.
     402                                if ( command == 'editdiv' )
     403                                {
     404                                        // Try to discover the containers that already existed in
     405                                        // ranges
     406                                        containers = applyDiv( editor );
     407                                        if( containers.length )
     408                                        {
     409                                                this._element = containers[ 0 ];
     410                                                // update dialog field values
     411                                                this.setupContent( this._element );
     412                                        }
     413                                }
     414                        },
     415                        onOk : function()
     416                        {
     417                                containers = applyDiv( editor, true );
     418                               
     419                                // Update elements attributes
     420                                for( var i = 0 ; i < containers.length ; i++ )
     421                                        this.commitContent( containers[ i ] );
     422                                this.hide();
     423                        }
     424                };
     425        }
     426       
     427        CKEDITOR.dialog.add( 'creatediv', function( editor )
     428                {
     429                        return divDialog( editor, 'creatediv' );
     430                } );
     431        CKEDITOR.dialog.add( 'editdiv', function( editor )
     432                {
     433                        return divDialog( editor, 'editdiv' );
     434                } );
     435})();
  • _source/plugins/div/plugin.js

    Property changes on: _source/plugins/div/dialogs/div.js
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview The "div" plugin. It wraps the selected block level elements with a 'div' element with specified styles and attributes.
     8 *
     9 */
     10
     11(function()
     12{
     13        CKEDITOR.plugins.add( 'div',
     14        {
     15                requires : [ 'editingblock', 'domiterator', 'elementspath' ],
     16
     17                init : function( editor )
     18                {
     19                        var lang = editor.lang.div;
     20
     21                        editor.addCommand( 'creatediv', new CKEDITOR.dialogCommand( 'creatediv' ) );
     22                        editor.addCommand( 'editdiv', new CKEDITOR.dialogCommand( 'editdiv' ) );
     23                        editor.addCommand( 'removediv',
     24                                {
     25                                        exec : function( editor )
     26                                        {
     27                                                var selection = editor.getSelection();
     28                                                if ( !selection )
     29                                                        return;
     30
     31                                                // Calculate the list of div containers to be removed.
     32                                                var ranges = selection.getRanges();
     33                                                var divContainers = [];
     34                                                var markers = {};
     35                                                for ( var i = 0 ; i < ranges.length ; i++ )
     36                                                {
     37                                                        var boundaryNodes = ranges[i].getBoundaryNodes();
     38                                                        var currentNode = boundaryNodes.startNode;
     39                                                        var endNode = boundaryNodes.endNode;
     40
     41                                                        if ( currentNode.equals( endNode ) )
     42                                                                endNode = endNode.getNextSourceNode();
     43
     44                                                        while ( currentNode && !currentNode.equals( endNode ) )
     45                                                        {
     46                                                                var path = new CKEDITOR.dom.elementPath( currentNode );
     47                                                                var div = path.blockLimit;
     48                                                                if ( div && div.getName() == 'div' && !div.getAttribute( '_cke_div_added' ) )
     49                                                                {
     50                                                                        divContainers.push( div );
     51                                                                        div.setAttribute( '_cke_div_added' );
     52                                                                }
     53                                                                currentNode = currentNode.getNextSourceNode();
     54                                                        }
     55                                                }
     56                                               
     57                                                // Remove the div containers, preserve children and selection.
     58                                                var bookmarks = selection.createBookmarks();
     59                                                for ( var i = 0 ; i < divContainers.length ; i++ )
     60                                                        divContainers[i].remove( true );
     61
     62                                                selection.selectBookmarks( bookmarks );
     63                                        }
     64                                } );
     65                               
     66                        editor.ui.addButton( 'CreateDiv',
     67                        {
     68                                label : lang.toolbar,
     69                                command :'creatediv'
     70                        } );
     71
     72                        if ( editor.addMenuItems )
     73                        {
     74                                editor.addMenuItems(
     75                                        {
     76                                                editdiv :
     77                                                {
     78                                                        label : lang.edit,
     79                                                        command : 'editdiv',
     80                                                        group : 'div',
     81                                                        order : 1
     82                                                },
     83
     84                                                removediv:
     85                                                {
     86                                                        label : lang.remove,
     87                                                        command : 'removediv',
     88                                                        group : 'div',
     89                                                        order : 5
     90                                                }
     91                                        } );
     92
     93                                if ( editor.contextMenu )
     94                                {
     95                                        editor.contextMenu.addListener( function( element, selection )
     96                                                {
     97                                                        if ( !element )
     98                                                                return null;
     99
     100                                                        var elementPath = new CKEDITOR.dom.elementPath( element );
     101                                                        var blockLimit = elementPath.blockLimit;
     102
     103                                                        if ( blockLimit && blockLimit.getName() == 'div' )
     104                                                        {
     105                                                                return {
     106                                                                        editdiv : CKEDITOR.TRISTATE_OFF,
     107                                                                        removediv : CKEDITOR.TRISTATE_OFF
     108                                                                }
     109                                                        }
     110
     111                                                        return null;
     112                                                } );
     113                                }
     114                        }
     115                       
     116                        CKEDITOR.dialog.add( 'creatediv', this.path + 'dialogs/div.js' );
     117                        CKEDITOR.dialog.add( 'editdiv', this.path + 'dialogs/div.js' );
     118                }
     119        } );
     120})();
     121
     122CKEDITOR.tools.extend( CKEDITOR.config,
     123{
     124        /**
     125         * Whether wrapping the whole table when created 'div' in table cell.
     126         */
     127        div_wrapTable : false,
     128        div_defaultCssClass :'',
     129        div_defaultStyle :'',
     130        div_defaultId :'',
     131        div_defaultLanguageCode :'',
     132        div_defaultInlineStyle :'',
     133        div_defaultAdvisoryTitle :'',
     134        div_defaultLangDir :''
     135} );
  • _source/plugins/toolbar/plugin.js

    Property changes on: _source/plugins/div/plugin.js
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
    240240        ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
    241241        '/',
    242242        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    243         ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
     243        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    244244        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    245245        ['Link','Unlink','Anchor'],     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    246246        '/',
  • _source/skins/v2/toolbar.css

     
    235235{
    236236        padding-top: 3px;
    237237}
     238
     239.cke_skin_v2 a.cke_button_creatediv .cke_icon
     240{
     241        background-position: 0 -1168px;
     242}
  • _source/skins/v2/icons.css

     
    296296{
    297297        background-position: 0 -32px;
    298298}
     299
     300.cke_skin_v2 .cke_button_editdiv .cke_icon
     301{
     302        background-position: 0 -1184px;
     303}
     304
     305.cke_skin_v2 .cke_button_removediv .cke_icon
     306{
     307        background-position: 0 -1200px;
     308}
  • _source/core/config.js

     
    150150         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    151151         */
    152152
    153         plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     153        plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,div,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    154154
    155155        /**
    156156         * The editor tabindex value.
  • _source/core/dom/elementpath.js

     
    7474                this.blockLimit = blockLimit;
    7575                this.elements = elements;
    7676        };
     77        //Make bocklimit elements definition public visitable.
     78        CKEDITOR.dom.elementPath.pathBlockLimitElements = pathBlockLimitElements;
     79       
    7780})();
    7881
    7982CKEDITOR.dom.elementPath.prototype =
  • _source/core/dom/element.js

     
    7575
    7676CKEDITOR.dom.element.setMarker = function( database, element, name, value )
    7777{
    78         var id = element.getCustomData( 'list_marker_id' ) ||
    79                         ( element.setCustomData( 'list_marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'list_marker_id' ) ),
    80                 markerNames = element.getCustomData( 'list_marker_names' ) ||
    81                         ( element.setCustomData( 'list_marker_names', {} ).getCustomData( 'list_marker_names' ) );
     78        var id = element.getCustomData( 'marker_id' ) ||
     79                        ( element.setCustomData( 'marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'marker_id' ) ),
     80                markerNames = element.getCustomData( 'marker_names' ) ||
     81                        ( element.setCustomData( 'marker_names', {} ).getCustomData( 'marker_names' ) );
    8282        database[id] = element;
    8383        markerNames[name] = 1;
    8484
     
    9393
    9494CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase )
    9595{
    96         var names = element.getCustomData( 'list_marker_names' ),
    97                 id = element.getCustomData( 'list_marker_id' );
     96        var names = element.getCustomData( 'marker_names' ),
     97                id = element.getCustomData( 'marker_id' );
    9898        for ( var i in names )
    9999                element.removeCustomData( i );
    100         element.removeCustomData( 'list_marker_names' );
     100        element.removeCustomData( 'marker_names' );
    101101        if ( removeFromDatabase )
    102102        {
    103                 element.removeCustomData( 'list_marker_id' );
     103                element.removeCustomData( 'marker_id' );
    104104                delete database[id];
    105105        }
    106106};
     
    437437                {
    438438                        return new CKEDITOR.dom.nodeList( this.$.childNodes );
    439439                },
     440               
     441                /**
     442                 * Same as CKEDITOR.dom.element::getChildren except this method ignore
     443                 * text nodes which contains only blank characters.
     444                 * @return {Array} 
     445                 */
     446                getNonEmptyChildren : function()
     447                {
     448                        var resultsChilds = [];
     449                        var children = this.getChildren();
     450                        var i, l = children.count(), child;
     451                        for( i = 0 ; i < l ; i++ )
     452                        {
     453                                child = children.getItem( i );
     454                                if( ! ( child.type === CKEDITOR.NODE_TEXT
     455                                        && /^[ \t\n\r]+$/.test( child.getText() ) ) )
     456                                        resultsChilds.push( child );
     457                        }
     458                        return resultsChilds;
     459                },
    440460
    441461                /**
    442462                 * Gets the current computed value of one of the element CSS style
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy