Ticket #3083: 3083.patch

File 3083.patch, 23.5 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _samples/enterkey.html

     
     1<!--
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4-->
     5<html xmlns="http://www.w3.org/1999/xhtml">
     6<head>
     7        <title>ENTER Key Configuration - CKEditor Sample</title>
     8        <script type="text/javascript" src="sample.js"></script>
     9        <script id="headscript" type="text/javascript">
     10        //<![CDATA[
     11
     12var editor;
     13
     14function changeEnter()
     15{
     16        // If we already have an editor, let's destroy it first.
     17        if ( editor )
     18                editor.destroy();
     19
     20        // Create the editor again, with the appropriate settings.
     21        editor = CKEDITOR.replace( 'editor1',
     22                {
     23                        enterMode               : Number( document.getElementById( 'xEnter' ).value ),
     24                        shiftEnterMode  : Number( document.getElementById( 'xShiftEnter' ).value )
     25                });
     26}
     27
     28window.onload = changeEnter;
     29
     30        //]]>
     31        </script>
     32</head>
     33<body>
     34        <!--
     35                The values in the select boxes represent the contants taht can be used
     36                to configure the enter key. You can use the constants directly instead
     37                of their numeric values:
     38                        - CKEDITOR.ENTER_P              = 1;
     39                        - CKEDITOR.ENTER_BR             = 2;
     40                        - CKEDITOR.ENTER_DIV    = 3;
     41        -->
     42        <div id="html">
     43                <div style="float: left; margin-right: 20px">
     44                        When ENTER is pressed:<br />
     45                        <select id="xEnter" onchange="changeEnter();">
     46                                <option value="1" selected="selected">Create new &lt;P&gt; (recommended)</option>
     47                                <option value="3">Create new &lt;DIV&gt;</option>
     48                                <option value="2">Break the line with a &lt;BR&gt;</option>
     49                        </select>
     50                </div>
     51                <div style="float: left">
     52                        When SHIFT + ENTER is pressed:<br />
     53                        <select id="xShiftEnter" onchange="changeEnter();">
     54                                <option value="1">Create new &lt;P&gt;</option>
     55                                <option value="3">Create new &lt;DIV&gt;</option>
     56                                <option value="2" selected="selected">Break the line with a &lt;BR&gt; (recommended)</option>
     57                        </select>
     58                </div>
     59                <br style="clear: both" />
     60                <form action="sample_posteddata.php" method="post">
     61                        <p>
     62                                <br />
     63                                <textarea id="editor1" name="editor1" rows="10" cols="80">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;FCKeditor&lt;/a&gt;.&lt;/p&gt;</textarea>
     64                        </p>
     65                        <p>
     66                                <input type="submit" value="Submit" />
     67                        </p>
     68                </form>
     69        </div>
     70        <div id="code">
     71                <pre></pre>
     72        </div>
     73</body>
     74</html>
  • _source/core/config.js

     
    88 * default configuration settings.
    99 */
    1010
     11CKEDITOR.ENTER_P        = 1;
     12CKEDITOR.ENTER_BR       = 2;
     13CKEDITOR.ENTER_DIV      = 3;
     14
    1115/**
    1216 * Holds the default configuration settings. Changes to this object are
    1317 * reflected in all editor instances, if not specificaly specified for those
     
    9599         */
    96100        defaultLanguage : 'en',
    97101
    98         enterMode : 'p',
    99         shiftEnterMode : 'br',
     102        enterMode : CKEDITOR.ENTER_P,
     103        shiftEnterMode : CKEDITOR.ENTER_BR,
    100104
    101105        /**
    102106         * A comma separated list of plugins that are not related to editor
     
    147151         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148152         */
    149153
    150         plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,stylescombo,table,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     154        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,smiley,showblocks,sourcearea,stylescombo,table,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    151155
    152156        /**
    153157         * The theme to be used to build the UI.
  • _source/core/dom/element.js

     
    193193                append : function( node, toStart )
    194194                {
    195195                        if ( typeof node == 'string' )
    196                                 node = new CKEDITOR.dom.element( node );
     196                                node = this.getDocument().createElement( node );
    197197
    198198                        if ( toStart )
    199199                                this.$.insertBefore( node.$, this.$.firstChild );
     
    205205
    206206                appendHtml : function( html )
    207207                {
    208                         var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );
    209                         temp.setHtml( html );
    210                         temp.moveChildren( this );
     208                        if ( !this.$.childNodes.length )
     209                                this.setHtml( html );
     210                        else
     211                        {
     212                                var temp = new CKEDITOR.dom.element( 'div', this.getDocument() );
     213                                temp.setHtml( html );
     214                                temp.moveChildren( this );
     215                        }
    211216                },
    212217
    213218                /**
     
    229234                                this.append( new CKEDITOR.dom.text( text ) );
    230235                },
    231236
     237                appendBogus : function()
     238                {
     239                        var lastChild = this.getLast() ;
     240
     241                        // Ignore empty/spaces text.
     242                        while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.rtrim( lastChild.getText() ).length == 0 )
     243                                lastChild = lastChild.getPrevious();
     244
     245                        if ( !lastChild || ( lastChild.is && ( !lastChild.is( 'br' ) || !lastChild.getAttribute( '_cke_bogus' ) ) ) )
     246                        {
     247                                this.append(
     248                                        CKEDITOR.env.opera ?
     249                                                this.getDocument().createText('') :
     250                                                this.getDocument().createElement( 'br', { attributes : { _cke_bogus : 1 } } ) );
     251                        }
     252                },
     253
    232254                /**
    233255                 * Breaks one of the ancestor element in the element position, moving
    234256                 * this element between the broken parts.
     
    658680                        return false;
    659681                },
    660682
     683                isEditable : function()
     684                {
     685                        // Get the element name.
     686                        var name = this.getName();
     687
     688                        // Get the element DTD (defaults to span for unknown elements).
     689                        var dtd = !CKEDITOR.dtd.$nonEditable[ name ]
     690                                                && ( CKEDITOR.dtd[ name ] || CKEDITOR.dtd.span );
     691
     692                        // In the DTD # == text node.
     693                        return ( dtd && dtd['#'] );
     694                },
     695
    661696                isIdentical : function( otherElement )
    662697                {
    663698                        if ( this.getName() != otherElement.getName() )
  • _source/core/dom/node.js

     
    9494
    9595                clone : function( includeChildren )
    9696                {
    97                         return new CKEDITOR.dom.node( this.$.cloneNode( includeChildren ) );
     97                        var $clone = this.$.cloneNode( includeChildren );
     98                       
     99                        if ( this.type == CKEDITOR.NODE_ELEMENT )
     100                        {
     101                                // The "id" attribute should never be cloned to avoid duplication.
     102                                $clone.removeAttribute( 'id', false ) ;
     103                                $clone.removeAttribute( '_cke_expando', false ) ;
     104                        }
     105                       
     106                        return new CKEDITOR.dom.node( $clone );
    98107                },
    99108
    100109                hasPrevious : function()
  • _source/core/dom/range.js

     
    13141314                                if ( !startBlock )
    13151315                                {
    13161316                                        startBlock = this.fixBlock( true, blockTag );
    1317                                         endBlock = new CKEDITOR.dom.elementPath( this.endContainer );
     1317                                        endBlock = new CKEDITOR.dom.elementPath( this.endContainer ).block;
    13181318                                }
    13191319
    13201320                                if ( !endBlock )
     
    13591359                                        endBlock.insertAfter( startBlock );
    13601360                                        this.moveToPosition( startBlock, CKEDITOR.POSITION_AFTER_END );
    13611361
    1362                                         // TODO: Append bogus br to startBlock for Gecko
     1362                                        // In Gecko, the last child node must be a bogus <br>.
     1363                                        // Note: bogus <br> added under <ul> or <ol> would cause
     1364                                        // lists to be incorrectly rendered.
     1365                                        if ( !CKEDITOR.env.ie && !startBlock.is( 'ul', 'ol') )
     1366                                                startBlock.appendBogus() ;
    13631367                                }
    13641368                        }
    13651369
     
    14181422                        walker.forward( CKEDITOR.dom.domWalker.blockBoundary() );
    14191423
    14201424                        return !walker.checkFailed;
     1425                },
     1426
     1427                /**
     1428                 * Moves the range boundaries to the first editing point inside an
     1429                 * element. For example, in an element tree like
     1430                 * "&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt; Text&lt;/p&gt;", the start editing point is
     1431                 * "&lt;p&gt;&lt;b&gt;&lt;i&gt;^&lt;/i&gt;&lt;/b&gt; Text&lt;/p&gt;" (inside &lt;i&gt;).
     1432                 * @param {CKEDITOR.dom.element} targetElement The element into which
     1433                 *              look for the editing spot.
     1434                 */
     1435                moveToElementEditStart : function( targetElement )
     1436                {
     1437                        var editableElement;
     1438
     1439                        while ( targetElement && targetElement.type == CKEDITOR.NODE_ELEMENT )
     1440                        {
     1441                                if ( targetElement.isEditable() )
     1442                                        editableElement = targetElement;
     1443                                else if ( editableElement )
     1444                                        break ;         // If we already found an editable element, stop the loop.
     1445
     1446                                targetElement = targetElement.getFirst();
     1447                        }
     1448
     1449                        if ( editableElement )
     1450                                this.moveToPosition( editableElement, CKEDITOR.POSITION_AFTER_START );
    14211451                }
    14221452        };
    14231453})();
  • _source/core/dtd.js

     
    7979                $listItem : {dd:1,dt:1,li:1},
    8080
    8181                /**
     82                 * Elements that accept text nodes, but are not possible to edit into
     83                 * the browser.
     84                 * @type Object
     85                 * @example
     86                 */
     87                $nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1},
     88
     89                /**
    8290                 * List of elements that can be ignored if empty, like "b" or "span".
    8391                 * @type Object
    8492                 * @example
    8593                 */
    86                 $removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,dfn:1,em:1,font:1,i:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},
     94                $removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},
    8795
    8896                /**
    8997                 * List of elements that have tabindex set to zero by default.
  • _source/core/plugins.js

     
    1818        '_source/' +    // %REMOVE_LINE%
    1919        'plugins/', 'plugin' );
    2020
     21// PACKAGER_RENAME( CKEDITOR.plugins )
     22
    2123CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
    2224        {
    2325                return function( name, callback, scope )
  • _source/plugins/enterkey/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(function()
     7{
     8        CKEDITOR.plugins.add( 'enterkey',
     9        {
     10                requires : [ 'keystrokes' ],
     11
     12                init : function( editor )
     13                {
     14                        var specialKeys = editor.specialKeys;
     15                        specialKeys[ 13 ] = enter;
     16                        specialKeys[ CKEDITOR.SHIFT + 13 ] = shiftEnter;
     17                }
     18        });
     19
     20        var forceMode,
     21                headerTagRegex = /^h[1-6]$/;
     22
     23        function shiftEnter( editor )
     24        {
     25                // On SHIFT+ENTER we want to enforce the mode to be respected, instead
     26                // of cloning the current block. (#77)
     27                forceMode = 1;
     28
     29                return enter( editor, editor.config.shiftEnterMode );
     30        }
     31
     32        function enter( editor, mode )
     33        {
     34                if ( !mode )
     35                        mode = editor.config.enterMode;
     36
     37                // Use setTimout so the keys get cancelled immediatelly.
     38                setTimeout( function()
     39                        {
     40                                if ( mode == CKEDITOR.ENTER_BR || editor.getSelection().getStartElement().hasAscendant( 'pre', true ) )
     41                                        enterBr( editor, mode );
     42                                else
     43                                        enterBlock( editor, mode );
     44
     45                                forceMode = 0;
     46                        }, 0 );
     47
     48                return true;
     49        }
     50
     51        function enterBlock( editor, mode, range )
     52        {
     53                // Get the range for the current selection.
     54                range = range || getRange( editor );
     55
     56                var doc = range.document;
     57
     58                // Determine the block element to be used.
     59                var blockTag = ( mode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
     60
     61                // Split the range.
     62                var splitInfo = range.splitBlock( blockTag );
     63
     64                if ( !splitInfo )
     65                        return;
     66
     67                // Get the current blocks.
     68                var previousBlock       = splitInfo.previousBlock,
     69                        nextBlock               = splitInfo.nextBlock;
     70
     71                var isStartOfBlock      = splitInfo.wasStartOfBlock,
     72                        isEndOfBlock    = splitInfo.wasEndOfBlock;
     73
     74                var node;
     75
     76                // If this is a block under a list item, split it as well. (#1647)
     77                if ( nextBlock )
     78                {
     79                        node = nextBlock.getParent();
     80                        if ( node.is( 'li' ) )
     81                        {
     82                                nextBlock.breakParent( node );
     83                                nextBlock.move( nextBlock.getNext(), true );
     84                        }
     85                }
     86                else if ( previousBlock && ( node = previousBlock.getParent() ) && node.is( 'li' ) )
     87                {
     88                        previousBlock.breakParent( node );
     89                        range.moveToElementEditStart( previousBlock.getNext() );
     90                        previousBlock.move( previousBlock.getPrevious() );
     91                }
     92
     93                // If we have both the previous and next blocks, it means that the
     94                // boundaries were on separated blocks, or none of them where on the
     95                // block limits (start/end).
     96                if ( !isStartOfBlock && !isEndOfBlock )
     97                {
     98                        // If the next block is an <li> with another list tree as the first
     99                        // child, we'll need to append a placeholder or the list item
     100                        // wouldn't be editable. (#1420)
     101                        if ( nextBlock.is( 'li' ) && ( node = nextBlock.getFirst() )
     102                                        && node.is && node.is( 'ul', 'ol') )
     103                                nextBlock.insertBefore( doc.createText( '\xa0' ), node );
     104
     105                        // Move the selection to the end block.
     106                        if ( nextBlock )
     107                                range.moveToElementEditStart( nextBlock );
     108                }
     109                else
     110                {
     111                        var newBlock;
     112
     113                        if ( previousBlock )
     114                        {
     115                                // Do not enter this block if it's a header tag, or we are in
     116                                // a Shift+Enter (#77). Create a new block element instead
     117                                // (later in the code).
     118                                if ( !forceMode && !headerTagRegex.test( previousBlock.getName() ) )
     119                                {
     120                                        // Otherwise, duplicate the previous block.
     121                                        newBlock = previousBlock.clone();
     122                                }
     123                        }
     124                        else if ( nextBlock )
     125                                newBlock = nextBlock.clone();
     126
     127                        if ( !newBlock )
     128                                newBlock = doc.createElement( blockTag );
     129
     130                        // Recreate the inline elements tree, which was available
     131                        // before hitting enter, so the same styles will be available in
     132                        // the new block.
     133                        var elementPath = splitInfo.elementPath;
     134                        if ( elementPath )
     135                        {
     136                                for ( var i = 0, len = elementPath.elements.length ; i < len ; i++ )
     137                                {
     138                                        var element = elementPath.elements[ i ];
     139
     140                                        if ( element.equals( elementPath.block ) || element.equals( elementPath.blockLimit ) )
     141                                                break;
     142
     143                                        if ( CKEDITOR.dtd.$removeEmpty[ element.getName() ] )
     144                                        {
     145                                                element = element.clone();
     146                                                newBlock.moveChildren( element );
     147                                                newBlock.append( element );
     148                                        }
     149                                }
     150                        }
     151
     152                        if ( !CKEDITOR.env.ie )
     153                                newBlock.appendBogus();
     154
     155                        range.insertNode( newBlock );
     156
     157                        // This is tricky, but to make the new block visible correctly
     158                        // we must select it.
     159                        if ( CKEDITOR.env.ie )
     160                        {
     161                                // Move the selection to the new block.
     162                                range.moveToElementEditStart( newBlock );
     163                                range.select();
     164                        }
     165
     166                        // Move the selection to the new block.
     167                        range.moveToElementEditStart( isStartOfBlock && !isEndOfBlock ? nextBlock : newBlock );
     168                }
     169
     170                if ( !CKEDITOR.env.ie )
     171                {
     172                        if ( nextBlock )
     173                        {
     174                                // If we have split the block, adds a temporary span at the
     175                                // range position and scroll relatively to it.
     176                                var tmpNode = doc.createElement( 'span' );
     177
     178                                // We need some content for Safari.
     179                                tmpNode.setHtml( '&nbsp;' );
     180
     181                                range.insertNode( tmpNode );
     182                                tmpNode.scrollIntoView();
     183                                range.deleteContents();
     184                        }
     185                        else
     186                        {
     187                                // We may use the above scroll logic for the new block case
     188                                // too, but it gives some weird result with Opera.
     189                                newBlock.scrollIntoView();
     190                        }
     191                }
     192
     193                range.select();
     194        }
     195
     196        function enterBr( editor, mode )
     197        {
     198                // Get the range for the current selection.
     199                var range = getRange( editor ),
     200                        doc = range.document;
     201
     202                // Determine the block element to be used.
     203                var blockTag = ( mode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
     204
     205                var isEndOfBlock = range.checkEndOfBlock();
     206
     207                var elementPath = new CKEDITOR.dom.elementPath( range.getBoundaryNodes().startNode );
     208
     209                var startBlock = elementPath.block,
     210                        startBlockTag = startBlock && elementPath.block.getName();
     211
     212                var isPre = false;
     213
     214                if ( !forceMode && startBlockTag == 'li' )
     215                        return enterBlock( editor, mode, range );
     216
     217                // If we are at the end of a header block.
     218                if ( !forceMode && isEndOfBlock && headerTagRegex.test( startBlockTag ) )
     219                {
     220                        // Insert a <br> after the current paragraph.
     221                        doc.createElement( 'br' ).insertAfter( startBlock );
     222
     223                        // A text node is required by Gecko only to make the cursor blink.
     224                        if ( CKEDITOR.env.gecko )
     225                                doc.createText( '' ).insertAfter( startBlock );
     226
     227                        // IE has different behaviors regarding position.
     228                        range.setStartAt( startBlock.getNext(), CKEDITOR.env.ie ? CKEDITOR.POSITION_BEFORE_START : CKEDITOR.POSITION_AFTER_START );
     229                }
     230                else
     231                {
     232                        var lineBreak;
     233
     234                        isPre = ( startBlockTag == 'pre' );
     235
     236                        if ( isPre )
     237                                lineBreak = doc.createText( CKEDITOR.env.ie ? '\r' : '\n' );
     238                        else
     239                                lineBreak = doc.createElement( 'br' );
     240
     241                        range.insertNode( lineBreak );
     242
     243                        // A text node is required by Gecko only to make the cursor blink.
     244                        if ( CKEDITOR.env.gecko )
     245                                doc.createText( '' ).insertAfter( lineBreak );
     246
     247                        // If we are at the end of a block, we must be sure the bogus node is available in that block.
     248                        if ( isEndOfBlock && !CKEDITOR.env.ie )
     249                                lineBreak.getParent().appendBogus();
     250
     251                        // IE has different behavior regarding position.
     252                        if ( CKEDITOR.env.ie )
     253                                range.setStartAt( lineBreak, CKEDITOR.POSITION_AFTER_END );
     254                        else
     255                                range.setStartAt( lineBreak.getNext(), CKEDITOR.POSITION_AFTER_START );
     256
     257                        // Scroll into view, for non IE.
     258                        if ( !CKEDITOR.env.ie )
     259                        {
     260                                var dummy = null;
     261
     262                                if ( CKEDITOR.env.opera )
     263                                        dummy = doc.createElement( 'span' );
     264                                else
     265                                        dummy = doc.createElement( 'br' );
     266
     267                                dummy.insertBefore( lineBreak.getNext() );
     268                                dummy.scrollIntoView();
     269                                dummy.remove();
     270                        }
     271                }
     272
     273                // This collapse guarantees the cursor will be blinking.
     274                range.collapse( true );
     275
     276                range.select( isPre );
     277        }
     278
     279        function getRange( editor )
     280        {
     281                // Get the selection ranges.
     282                var ranges = editor.getSelection().getRanges();
     283
     284                // Delete the contents of all ranges except the first one.
     285                for ( var i = ranges.length - 1 ; i > 0 ; i-- )
     286                {
     287                        ranges[ i ].deleteContents();
     288                }
     289
     290                // Return the first range.
     291                return ranges[ 0 ];
     292        }
     293})();
  • _source/plugins/keystrokes/plugin.js

     
    1515                 * @example
    1616                 */
    1717                editor.keystrokeHandler = new CKEDITOR.keystrokeHandler( editor );
     18
     19                editor.specialKeys = {};
    1820        },
    1921
    2022        init : function( editor )
     
    8486
    8587                var keyCombination = event.getKeystroke();
    8688                var command = this.keystrokes[ keyCombination ];
     89                var editor = this._.editor;
    8790
    88                 cancel = ( this._.editor.fire( 'key', { keyCode : keyCombination } ) === true );
     91                cancel = ( editor.fire( 'key', { keyCode : keyCombination } ) === true );
    8992
    9093                if ( !cancel )
    9194                {
    9295                        if ( command )
    9396                        {
    9497                                var data = { from : 'keystrokeHandler' };
    95                                 cancel = ( this._.editor.execCommand( command, data ) !== false );
     98                                cancel = ( editor.execCommand( command, data ) !== false );
    9699                        }
    97100
    98                         if ( !cancel )
    99                                 cancel = !!this.blockedKeystrokes[ keyCombination ];
     101                        if  ( !cancel )
     102                        {
     103                                var handler = editor.specialKeys[ keyCombination ],
     104                                        cancel = ( handler && handler( editor ) === true );
     105
     106                                if ( !cancel )
     107                                        cancel = !!this.blockedKeystrokes[ keyCombination ];
     108                        }
    100109                }
    101110
    102111                if ( cancel )
     
    166175        [ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ],
    167176        [ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ],
    168177        [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ],
     178
    169179        [ CKEDITOR.CTRL + 76 /*L*/, 'link' ],
     180
    170181        [ CKEDITOR.CTRL + 66 /*B*/, 'bold' ],
    171182        [ CKEDITOR.CTRL + 73 /*I*/, 'italic' ],
    172         [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ],
    173         [ CKEDITOR.CTRL + CKEDITOR.ALT + 13 /*ENTER*/, 'fitWindow' ],
    174         [ CKEDITOR.SHIFT + 32 /*SPACE*/, 'nbsp' ]
     183        [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ]
    175184];
  • _source/plugins/selection/plugin.js

     
    698698                        }
    699699                        else
    700700                        {
    701                                 isStartMakerAlone = ( !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) )
    702                                         && !startNode.hasNext();
     701// The isStartMakerAlone logic comes from V2. It guarantees that the lines
     702// will expand and that the cursor will be blinking on the right place.
     703// Actually, we are using this flag just to avoid using this hack in all
     704// situations, but just on those needed.
    703705
     706// But, in V3, somehow it is not interested on working whe hitting SHIFT+ENTER
     707// inside text. So, let's jsut leave the hack happen always.
     708
     709// I'm still leaving the code here just in case. We may find some other IE
     710// weirdness and uncommenting this stuff may be useful.
     711
     712//                              isStartMakerAlone = ( !startNode.hasPrevious() || ( startNode.getPrevious().is && startNode.getPrevious().is( 'br' ) ) )
     713//                                      && !startNode.hasNext();
     714
    704715                                // Append a temporary <span>&#65279;</span> before the selection.
    705716                                // This is needed to avoid IE destroying selections inside empty
    706717                                // inline elements, like <b></b> (#253).
     
    710721                                dummySpan.setHtml( '&#65279;' );        // Zero Width No-Break Space (U+FEFF). See #1359.
    711722                                dummySpan.insertBefore( startNode );
    712723
    713                                 if ( isStartMakerAlone )
    714                                 {
     724//                              if ( isStartMakerAlone )
     725//                              {
    715726                                        // To expand empty blocks or line spaces after <br>, we need
    716727                                        // instead to have any char, which will be later deleted using the
    717728                                        // selection.
    718                                         // \ufeff = Zero Width No-Break Space (U+FEFF). See #1359.
     729                                        // \ufeff = Zero Width No-Break Space (U+FEFF). (#1359)
    719730                                        this.document.createText( '\ufeff' ).insertBefore( startNode );
    720                                 }
     731//                              }
    721732                        }
    722733
    723734                        // Remove the markers (reset the position, because of the changes in the DOM tree).
     
    726737
    727738                        if ( collapsed )
    728739                        {
    729                                 if ( isStartMakerAlone )
    730                                 {
    731                                         // Move the selection start to include the temporary &#65279;.
    732                                         //ieRange.moveStart( 'character', -1 );
     740//                              if ( isStartMakerAlone )
     741//                              {
     742                                        // Move the selection start to include the temporary \ufeff.
     743                                        ieRange.moveStart( 'character', -1 );
    733744
    734745                                        ieRange.select();
    735746
    736747                                        // Remove our temporary stuff.
    737 //                                      this.document.$.selection.clear();
    738                                 }
    739                                 else
    740                                         ieRange.select();
     748                                        this.document.$.selection.clear();
     749//                              }
     750//                              else
     751//                                      ieRange.select();
    741752
    742753                                dummySpan.remove();
    743754                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy