退格和删除如何在CKEditor中工作?

时间:2011-04-14 06:05:56

标签: ckeditor fckeditor

退格键和删除键如何在CKEditor中工作?如果我在可编辑区域中有一个iframe,并将光标放在它旁边,则按退格/删除会删除iframe /从中删除其HTML代码。

我无法得到的是这种行为的代码在哪里?击中退格时,范围缩小到iframe并被删除。

请指出我在源代码中发生这种情况的正确方向。

1 个答案:

答案 0 :(得分:1)

有一些关于删除的内容

  

oKeystrokeHandler.SetKeystrokes

但我不知道那种行为

var FCKEnterKey = function( targetWindow, enterMode, shiftEnterMode, tabSpaces ) 
{
   this.Window         = targetWindow ;
   this.EnterMode      = enterMode || 'p' ;
   this.ShiftEnterMode   = shiftEnterMode || 'br' ;

   // Setup the Keystroke Handler.
   var oKeystrokeHandler = new FCKKeystrokeHandler( false ) ;
   oKeystrokeHandler._EnterKey = this ;
   oKeystrokeHandler.OnKeystroke = FCKEnterKey_OnKeystroke ;

   oKeystrokeHandler.SetKeystrokes( [
      [ 13      , 'Enter' ],
      [ SHIFT + 13, 'ShiftEnter' ],
      [ 8         , 'Backspace' ],
      [ CTRL + 8   , 'CtrlBackspace' ],
      [ 46      , 'Delete' ]
   ] ) ;

   this.TabText = '' ;

   // Safari by default inserts 4 spaces on TAB, while others make the editor
   // loose focus. So, we need to handle it here to not include those spaces.
   if ( tabSpaces > 0 || FCKBrowserInfo.IsSafari )
   {
      while ( tabSpaces-- )
         this.TabText += '\xa0' ;

      oKeystrokeHandler.SetKeystrokes( [ 9, 'Tab' ] );
   }

   oKeystrokeHandler.AttachToElement( targetWindow.document ) ;
}

http://code.google.com/p/easyfckeditor/source/browse/trunk/src/main/java/oh/how/easy/fck/js/fckeditor/editor/_source/classes/fckenterkey.js?r=2