X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fwysiwygarea%2Fplugin.js;h=4c1b01f07fd9b9c0b46cc7f072b3184522c86ddb;hp=1b81be2bdade9ffe163f6094ba3284f8475e3b03;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hpb=6e682412d5cc0dfaedb376482e585bf2989c6863 diff --git a/_source/plugins/wysiwygarea/plugin.js b/_source/plugins/wysiwygarea/plugin.js index 1b81be2..4c1b01f 100644 --- a/_source/plugins/wysiwygarea/plugin.js +++ b/_source/plugins/wysiwygarea/plugin.js @@ -46,14 +46,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license selIsLocked && this.getSelection().lock(); + var that = this; // Save snaps after the whole execution completed. // This's a workaround for make DOM modification's happened after // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents' // call. - CKEDITOR.tools.setTimeout( function() + setTimeout( function() { - this.fire( 'saveSnapshot' ); - }, 0, this ); + try { that.fire( 'saveSnapshot' ); } + // IEs < 9 may requires a further delay to save snapshot, after pasting. (#9132) + catch ( e ) { setTimeout( function(){ that.fire( 'saveSnapshot' ); }, 200 ); } + }, 0 ); } }; } @@ -338,7 +341,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ); // Gecko need a key event to 'wake up' the editing - // ability when document is empty.(#3864, #5781) + // ability when document is empty.(#3864) function activateEditing( editor ) { var win = editor.window, @@ -394,8 +397,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( CKEDITOR.env.gecko ) { - activateEditing( editor ); - // Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041) var pathBlock = path.block || path.blockLimit, lastNode = pathBlock && pathBlock.getLast( isNotEmpty ); @@ -767,9 +768,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license domDocument.getDocumentElement().addClass( domDocument.$.compatMode ); // Override keystroke behaviors. - editable && domDocument.on( 'keydown', function( evt ) + editor.on( 'key', function( evt ) { - var keyCode = evt.data.getKeystroke(); + if ( editor.mode != 'wysiwyg' ) + return; + + var keyCode = evt.data.keyCode; // Backspace OR Delete. if ( keyCode in { 8 : 1, 46 : 1 } ) @@ -799,9 +803,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.fire( 'saveSnapshot' ); - evt.data.preventDefault(); + evt.cancel(); } - else + else if ( range.collapsed ) { // Handle the following special cases: (#6217) // 1. Del/Backspace key before/after table; @@ -823,7 +827,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.fire( 'saveSnapshot' ); - evt.data.preventDefault(); + evt.cancel(); } else if ( path.blockLimit.is( 'td' ) && ( parent = path.blockLimit.getAscendant( 'table' ) ) && @@ -843,7 +847,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.fire( 'saveSnapshot' ); - evt.data.preventDefault(); + evt.cancel(); } } @@ -865,7 +869,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license range = new CKEDITOR.dom.range( domDocument ); range[ keyCode == 33 ? 'moveToElementEditStart' : 'moveToElementEditEnd']( body ); range.select(); - evt.data.preventDefault(); + evt.cancel(); } } @@ -1267,9 +1271,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.addCss( 'html { height: 100% !important; }' ); editor.addCss( 'img:-moz-broken { -moz-force-broken-image-icon : 1; min-width : 24px; min-height : 24px; }' ); } - // Remove the margin to avoid mouse confusion. (#8835) - else if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 && editor.config.contentsLangDirection == 'ltr' ) - editor.addCss( 'body{margin-right:0;}' ); /* #3658: [IE6] Editor document has horizontal scrollbar on long lines To prevent this misbehavior, we show the scrollbar always */