Ticket #2885: 2885_11.patch

File 2885_11.patch, 22.8 KB (added by Garry Yao, 14 years ago)
  • _source/lang/en.js

     
    566566                tag_div : 'Normal (DIV)'
    567567        },
    568568
     569        div :
     570        {
     571                title                           : 'Create Div Container',
     572                toolbar                         : 'Create Div Container',
     573                cssClassInputLabel      : 'Stylesheet Classes',
     574                styleSelectLabel        : 'Style',
     575                IdInputLabel            : 'Id',
     576                languageCodeInputLabel  : ' Language Code',
     577                inlineStyleInputLabel   : 'Inline Style',
     578                advisoryTitleInputLabel : 'Advisory Title',
     579                langDirLabel            : 'Language Direction',
     580                langDirLTRLabel         : 'Left to Right (LTR)',
     581                langDirRTLLabel         : 'Right to Left (RTL)',
     582                edit                            : 'Edit Div',
     583                remove                          : 'Remove Div'
     584        },
     585
    569586        font :
    570587        {
    571588                label : 'Font',
  • _source/plugins/toolbar/plugin.js

     
    364364        ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
    365365        '/',
    366366        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    367         ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
     367        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    368368        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    369369        ['Link','Unlink','Anchor'],
    370370        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
  • _source/core/config.js

     
    198198         * @type String
    199199         * @example
    200200         */
    201         plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     201        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',
    202202
    203203        /**
    204204         * List of additional plugins to be loaded. This is a tool setting which
  • _source/skins/office2003/icons.css

     
    307307{
    308308        background-position: 0 -1040px;
    309309}
     310
     311.cke_skin_office2003 .cke_button_creatediv .cke_icon
     312{
     313        background-position: 0 -1168px;
     314}
     315
     316.cke_skin_office2003 .cke_button_editdiv .cke_icon
     317{
     318        background-position: 0 -1184px;
     319}
     320
     321.cke_skin_office2003 .cke_button_removediv .cke_icon
     322{
     323        background-position: 0 -1200px;
     324}
  • _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};
     
    444444                {
    445445                        return new CKEDITOR.dom.nodeList( this.$.childNodes );
    446446                },
    447 
     447               
    448448                /**
    449449                 * Gets the current computed value of one of the element CSS style
    450450                 * properties.
  • _source/plugins/div/plugin.js

     
     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                                                        ranges = selection && selection.getRanges(),
     29                                                        range,
     30                                                        bookmarks = selection.createBookmarks(),
     31                                                        walker,
     32                                                        toRemove = [];
     33
     34                                                function findDiv( node )
     35                                                {
     36                                                        var path = new CKEDITOR.dom.elementPath( node ),
     37                                                                blockLimit = path.blockLimit,
     38                                                                div = blockLimit && blockLimit.getAscendant( 'div', true );
     39                                                        if ( div && !div.getAttribute( '_cke_div_added' ) )
     40                                                        {
     41                                                                toRemove.push( div );
     42                                                                div.setAttribute( '_cke_div_added' );
     43                                                        }
     44                                                }
     45
     46                                                for ( var i = 0 ; i < ranges.length ; i++ )
     47                                                {
     48                                                        range = ranges[ i ];
     49                                                        if( range.collapsed )
     50                                                                findDiv( selection.getStartElement() );
     51                                                        else
     52                                                        {
     53                                                                walker = new CKEDITOR.dom.walker( range );
     54                                                                walker.evaluator = findDiv;
     55                                                                walker.lastForward();
     56                                                        }
     57                                                }
     58
     59                                                for ( var i = 0 ; i < toRemove.length ; i++ )
     60                                                        toRemove[ 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                                                                blockLimit = elementPath.blockLimit;
     102
     103                                                        if ( blockLimit && blockLimit.getAscendant( 'div', true ) )
     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})();
  • _source/plugins/menu/plugin.js

     
    376376        'form,' +
    377377        'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+
    378378        'anchor,link,image,flash,' +
    379         'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea';
     379        'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';
  • _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                $cdata : {script:1,style:1},
  • _source/skins/v2/icons.css

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

     
    283283        background-position: 0 -1152px;
    284284}
    285285
     286.cke_skin_kama .cke_button_creatediv .cke_icon
     287{
     288        background-position: 0 -1168px;
     289}
     290
    286291.cke_skin_kama .cke_button_flash .cke_icon
    287292{
    288293        background-position: 0 -592px;
  • _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                // 1. IE doesn't support customData on text nodes;
     18                // 2. Text nodes never get chance to appear twice;
     19                if ( !element.is || !element.getCustomData( 'block_processed' ) )
     20                {
     21                        element.is && CKEDITOR.dom.element.setMarker( database, element, '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                 * Wrapping 'div' element around appropriate blocks among the selected ranges.
     130                 * @param {Object} editor
     131                 */
     132                function createDiv( editor )
     133                {
     134                        // new adding containers OR detected pre-existed containers.
     135                        var containers = [];
     136                        // node markers store.
     137                        var database = {};
     138                        // All block level elements which contained by the ranges.
     139                        var containedBlocks = [], block;
     140
     141                        // Get all ranges from the selection.
     142                        var selection = editor.document.getSelection();
     143                        var ranges = selection.getRanges();
     144                        var bookmarks = selection.createBookmarks();
     145                        var i, iterator;
     146
     147                        // Calcualte a default block tag if we need to create blocks.
     148                        var blockTag = editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p';
     149
     150                        // collect all included elements from dom-iterator
     151                        for( i = 0 ; i < ranges.length ; i++ )
     152                        {
     153                                iterator = ranges[ i ].createIterator();
     154                                while( ( block = iterator.getNextParagraph() ) )
     155                                {
     156                                        // include contents of blockLimit elements.
     157                                        if( block.getName() in divLimitDefinition )
     158                                        {
     159                                                var j, childNodes = block.getChildren();
     160                                                for ( j = 0 ; j < childNodes.count() ; j++ )
     161                                                        addSafely( containedBlocks, childNodes.getItem( j ) , database );
     162                                        }
     163                                        else
     164                                        {
     165                                                // Bypass dtd disallowed elements.
     166                                                while( !dtd[ block.getName() ] && block.getName() != 'body' )
     167                                                        block = block.getParent();
     168                                                addSafely( containedBlocks, block, database );
     169                                        }
     170                                }
     171                        }
     172
     173                        CKEDITOR.dom.element.clearAllMarkers( database );
     174
     175                        var blockGroups = groupByDivLimit( containedBlocks );
     176                        var ancestor, blockEl, divElement;
     177
     178                        for( i = 0 ; i < blockGroups.length ; i++ )
     179                        {
     180                                var currentNode = blockGroups[ i ][ 0 ];
     181
     182                                // Calculate the common parent node of all contained elements.
     183                                ancestor = currentNode.getParent();
     184                                for ( var j = 1 ; j < blockGroups[ i ].length; j++ )
     185                                        ancestor = ancestor.getCommonAncestor( blockGroups[ i ][ j ] );
     186
     187                                divElement = new CKEDITOR.dom.element( 'div', editor.document );
     188                               
     189                                // Normalize the blocks in each group to a common parent.
     190                                for( var j = 0; j < blockGroups[ i ].length ; j++ )
     191                                {
     192                                        currentNode = blockGroups[ i ][ j ];
     193
     194                                        while( !currentNode.getParent().equals( ancestor ) )
     195                                                currentNode = currentNode.getParent();
     196
     197                                        blockGroups[ i ][ j ] = currentNode;
     198                                }
     199
     200                                // Wrapped blocks counting
     201                                var fixedBlock = null;
     202                                for ( var j = 0 ; j < blockGroups[ i ].length ; j++ )
     203                                {
     204                                        currentNode = blockGroups[ i ][ j ];
     205                                        // Avoid DUP
     206                                        if ( !currentNode.is || !currentNode.getCustomData( 'block_processed' ) )
     207                                        {
     208                                                 currentNode.is && CKEDITOR.dom.element.setMarker( database, currentNode, 'block_processed', true );
     209
     210                                                // Establish new container, wrapping all elements in this group.
     211                                                if ( j == 0 )
     212                                                        divElement.insertBefore(currentNode);
     213
     214                                                // If any non-block nodes are added, shuffle them to new blocks.
     215                                                if ( currentNode.is
     216                                                         && currentNode.isBlockBoundary() )
     217                                                {
     218                                                        divElement.append( currentNode );
     219                                                        fixedBlock = null;
     220                                                }
     221                                                else
     222                                                {
     223                                                        if ( !fixedBlock )
     224                                                        {
     225                                                                fixedBlock = editor.document.createElement( blockTag );
     226                                                                divElement.append( fixedBlock );
     227                                                        }
     228                                                        currentNode.move( fixedBlock, true );
     229                                                }
     230                                        }
     231                                }
     232
     233                                CKEDITOR.dom.element.clearAllMarkers( database );
     234                                containers.push( divElement );
     235                        }
     236
     237                        selection.selectBookmarks( bookmarks );
     238                        return containers;
     239                }
     240
     241                function getDiv( editor )
     242                {
     243                        var path = new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() ),
     244                                blockLimit = path.blockLimit,
     245                                div = blockLimit && blockLimit.getAscendant( 'div', true );
     246                        return div;
     247                }
     248                /**
     249                 * Divide a set of nodes to different groups by their path's blocklimit element.
     250                 * Note: the specified nodes should be in source order naturally, which mean they are supposed to producea by following class:
     251                 *  * CKEDITOR.dom.range.Iterator
     252                 *  * CKEDITOR.dom.domWalker
     253                 *  @return {Array []} the grouped nodes
     254                 */
     255                function groupByDivLimit( nodes )
     256                {
     257                        var groups = [],
     258                                lastDivLimit = null,
     259                                path, block;
     260                        for ( var i = 0 ; i < nodes.length ; i++ )
     261                        {
     262                                block = nodes[i];
     263                                var limit = getDivLimitElement( block );
     264                                if ( !limit.equals( lastDivLimit ) )
     265                                {
     266                                        lastDivLimit = limit ;
     267                                        groups.push( [] ) ;
     268                                }
     269                                groups[ groups.length - 1 ].push( block ) ;
     270                        }
     271                        return groups;
     272                }
     273               
     274                /**
     275                 * Hold a collection of created block container elements. 
     276                 */
     277                var containers = [];
     278                /**
     279                 * @type divDialog
     280                 */
     281                return {
     282                        title : editor.lang.div.title,
     283                        minWidth : 400,
     284                        minHeight : 165,
     285                        contents :
     286                        [
     287                        {
     288                                id :'info',
     289                                label :editor.lang.common.generalTab,
     290                                title :editor.lang.common.generalTab,
     291                                elements :
     292                                [
     293                                        {
     294                                                type :'hbox',
     295                                                widths : [ '50%', '50%' ],
     296                                                children :
     297                                                [
     298                                                        {
     299                                                                id :'elementStyle',
     300                                                                type :'select',
     301                                                                style :'width: 100%;',
     302                                                                label :editor.lang.div.styleSelectLabel,
     303                                                                'default' : '',
     304                                                                items : [],
     305                                                                setup : function( element )
     306                                                                {
     307                                                                        this.setValue( element.$.style.cssText || '' );
     308                                                                },
     309                                                                commit: function( element )
     310                                                                {
     311                                                                        if ( this.getValue() )
     312                                                                                element.$.style.cssText = this.getValue();
     313                                                                        else
     314                                                                                element.removeAttribute( 'style' );
     315                                                                }
     316                                                        },
     317                                                        {
     318                                                                id :'class',
     319                                                                type :'text',
     320                                                                label :editor.lang.common.cssClass,
     321                                                                'default' : ''
     322                                                        }
     323                                                ]
     324                                        }
     325                                ]
     326                        },
     327                        {
     328                                        id :'advanced',
     329                                        label :editor.lang.common.advancedTab,
     330                                        title :editor.lang.common.advancedTab,
     331                                        elements :
     332                                        [
     333                                        {
     334                                                type :'vbox',
     335                                                padding :1,
     336                                                children :
     337                                                [
     338                                                        {
     339                                                                type :'hbox',
     340                                                                widths : [ '50%', '50%' ],
     341                                                                children :
     342                                                                [
     343                                                                        {
     344                                                                                type :'text',
     345                                                                                id :'id',
     346                                                                                label :editor.lang.common.id,
     347                                                                                'default' : ''
     348                                                                        },
     349                                                                        {
     350                                                                                type :'text',
     351                                                                                id :'lang',
     352                                                                                label :editor.lang.link.langCode,
     353                                                                                'default' : ''
     354                                                                        }
     355                                                                ]
     356                                                        },
     357                                                        {
     358                                                                type :'hbox',
     359                                                                children :
     360                                                                [
     361                                                                                {
     362                                                                                        type :'text',
     363                                                                                        id :'style',
     364                                                                                        style :'width: 100%;',
     365                                                                                        label :editor.lang.common.cssStyle,
     366                                                                                        'default' : ''
     367                                                                                }
     368                                                                ]
     369                                                        },
     370                                                        {
     371                                                                type :'hbox',
     372                                                                children :
     373                                                                [
     374                                                                                {
     375                                                                                        type :'text',
     376                                                                                        id :'title',
     377                                                                                        style :'width: 100%;',
     378                                                                                        label :editor.lang.common.advisoryTitle,
     379                                                                                        'default' : ''
     380                                                                                }
     381                                                                ]
     382                                                        },
     383                                                        {
     384                                                                type :'select',
     385                                                                id :'dir',
     386                                                                style :'width: 100%;',
     387                                                                label :editor.lang.common.langDir,
     388                                                                'default' : '',
     389                                                                items :
     390                                                                [
     391                                                                        [
     392                                                                                editor.lang.common.langDirLtr,
     393                                                                                'ltr'
     394                                                                        ],
     395                                                                        [
     396                                                                                editor.lang.common.langDirRtl,
     397                                                                                'rtl'
     398                                                                        ]
     399                                                                ]
     400                                                        }
     401                                                ]
     402                                        }
     403                                        ]
     404                                }
     405                        ],
     406                        onLoad : function()
     407                        {
     408                                setupFields.call(this);
     409                        },
     410                        onShow : function()
     411                        {
     412                                // Whether always create new container regardless of existed
     413                                // ones.
     414                                if ( command == 'editdiv' )
     415                                {
     416                                        // Try to discover the containers that already existed in
     417                                        // ranges
     418                                        var div = getDiv( editor );
     419                                        // update dialog field values
     420                                        div && this.setupContent( this._element = div );
     421                                }
     422                        },
     423                        onOk : function()
     424                        {
     425                                if( command == 'editdiv' )
     426                                        containers = [ this._element ];
     427                                else
     428                                        containers = createDiv( editor, true );
     429                               
     430                                // Update elements attributes
     431                                for( var i = 0 ; i < containers.length ; i++ )
     432                                        this.commitContent( containers[ i ] );
     433                                this.hide();
     434                        }
     435                };
     436        }
     437       
     438        CKEDITOR.dialog.add( 'creatediv', function( editor )
     439                {
     440                        return divDialog( editor, 'creatediv' );
     441                } );
     442        CKEDITOR.dialog.add( 'editdiv', function( editor )
     443                {
     444                        return divDialog( editor, 'editdiv' );
     445                } );
     446} )();
     447
     448/*
     449 * @name CKEDITOR.config.div_wrapTable
     450 * Whether to wrap the whole table instead of indivisual cells when created 'div' in table cell.
     451 * @type Boolean
     452 * @default false
     453 * @example config.div_wrapTable = true;
     454 */
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy