Changes between Initial Version and Version 1 of Ticket #9354, comment 2


Ignore:
Timestamp:
Sep 20, 2012, 2:30:04 PM (8 years ago)
Author:
Timo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9354, comment 2

    initial v1  
    1 I am experiencing the same issue and I suspect that Firefox has enabled some sort of security setting that disallows multiple execCommands. In more recent versions this problem does not occur. I fixed this in a 3.2.1-version by changing the pastetext-plugin method insertText:
    2 
    3 
    4 {{{
    5 CKEDITOR.editor.prototype.insertText = function( text )
    6         {
    7                 this.focus();
    8                 this.fire( 'saveSnapshot' );
    9 
    10                 var mode = this.getSelection().getStartElement().hasAscendant( 'pre', true ) ? CKEDITOR.ENTER_BR : this.config.enterMode,
    11                         isEnterBrMode = mode == CKEDITOR.ENTER_BR,
    12                         doc = this.document.$,
    13                         self = this,
    14                         line;
    15 
    16                 text = CKEDITOR.tools.htmlEncode( text.replace( /\r\n|\r/g, '\n' ) );
    17 
    18         var formatted   = '';
    19 
    20                 var startIndex = 0;
    21                 text.replace( /\n+/g, function( match, lastIndex )
    22                  {
    23             line = text.substring( startIndex, lastIndex );
    24             startIndex = lastIndex + match.length;
    25             if (!line.length)
    26                 return;
    27 
    28                         var lineBreakNums = match.length,
    29                                 // Duo consequence line-break as a enter block.
    30                                 enterBlockTimes = isEnterBrMode ? 0 : Math.floor( lineBreakNums / 2 ),
    31                                 // Per link-break as a enter br.
    32                                 enterBrTimes = isEnterBrMode ? lineBreakNums : lineBreakNums % 2;
    33 
    34             for(var i = 0; i < enterBlockTimes; i++)
    35                 formatted       = formatted + '</p><p>';
    36             for(i = 0; i < enterBrTimes; i++)
    37                 formatted       = formatted + '<br />';
    38             formatted       = formatted + line;
    39              
    40                  });
    41 
    42          doInsertText(doc, formatted);
    43 
    44                 this.fire( 'saveSnapshot' );
    45         };
    46 }}}
    47 
    48 Hopefully this helps you.
     1I am experiencing the same issue and I suspect that Firefox has enabled some sort of security setting that disallows multiple execCommands. In more recent versions this problem does not occur.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy