Ticket #2885: 2885_10.patch

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

    Property changes on: _source/plugins/div/plugin.js
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
    277277        ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
    278278        '/',
    279279        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    280         ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
     280        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    281281        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    282282        ['Link','Unlink','Anchor'],     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    283283        '/',
  • _source/skins/office2003/icons.css

     
    306306{
    307307        background-position: 0 -1040px;
    308308}
     309
     310.cke_skin_office2003 .cke_button_creatediv .cke_icon
     311{
     312        background-position: 0 -1168px;
     313}
     314
     315.cke_skin_office2003 .cke_button_editdiv .cke_icon
     316{
     317        background-position: 0 -1184px;
     318}
     319
     320.cke_skin_office2003 .cke_button_removediv .cke_icon
     321{
     322        background-position: 0 -1200px;
     323}
  • _source/skins/v2/icons.css

     
    306306{
    307307        background-position: 0 -1040px;
    308308}
     309
     310.cke_skin_v2 .cke_button_creatediv .cke_icon
     311{
     312        background-position: 0 -1168px;
     313}
     314
     315.cke_skin_v2 .cke_button_editdiv .cke_icon
     316{
     317        background-position: 0 -1184px;
     318}
     319
     320.cke_skin_v2 .cke_button_removediv .cke_icon
     321{
     322        background-position: 0 -1200px;
     323}
  • _source/core/config.js

     
    150150         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    151151         */
    152152
    153         plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     153        plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,div,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    154154
    155155        /**
    156156         * List of additional plugins to be loaded. This is a tool setting which
  • _source/core/dtd.js

     
    6666                 */
    6767                $block : block,
    6868
     69                /**
     70                 * List of block limit elements.
     71                 * @type Object
     72                 * @example
     73                 */
     74                $blockLimit : { body:1,div:1,td:1,th:1,caption:1,form:1 },
     75
    6976                $body : X({script:1}, block),
    7077
    7178                /**
  • _source/core/dom/elementpath.js

     
    99        var pathBlockElements = { address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,de:1 };
    1010
    1111        // Elements that may be considered the "Block limit" in an element path.
    12         var pathBlockLimitElements = { body:1,div:1,td:1,th:1,caption:1,form:1 };
     12        var pathBlockLimitElements = CKEDITOR.dtd.$blockLimit;
    1313
    1414        // Check if an element contains any block element.
    1515        var checkHasBlock = function( element )
  • _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};
     
    445445                {
    446446                        return new CKEDITOR.dom.nodeList( this.$.childNodes );
    447447                },
    448 
     448               
    449449                /**
    450450                 * Gets the current computed value of one of the element CSS style
    451451                 * properties.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy