To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Ticket #107 (accepted enhancement)

Opened 2 years ago

Last modified 7 months ago

ESC key should act as 'cancel' button when editing slots

Reported by: rickybanister Owned by: johnnyoffline
Priority: minor Milestone: 1.6
Component: apostrophePlugin Version:
Keywords: Cc: boutell, dordille, agilbert
Symfony version: 1.4

Description

While editing a slot it would be helpful if you could hit the ESC key to cancel editing.

Similarly, if you are editing a slot and not focused in the text area, ENTER should act as 'save.'

This came up because while developing a new template the save and cancel buttons were hidden behind another element, it would be a time saver to not click the buttons if you're currently typing.

Change History

Changed 22 months ago by johnnyoffline

  • status changed from new to accepted

Changed 21 months ago by boutell

  • milestone changed from 1.4 to 1.5

Changed 16 months ago by johnnyoffline

  • priority changed from major to minor
  • milestone changed from 1.5 to 1.6

This is awesome but it can wait until 1.6 or 1.5.1 etc.

Changed 7 months ago by johnnyoffline

Looked into this

very close

Easy enough to catch the escape key
keycode 27

and write a behavior to click the .a-cancel button of the .a-editing slot.

the problem is being able to catch it in the iframe of the fck editor

We need to do something to the effect of
Get an instance of the editor:

    var oEditor = FCKeditorAPI.GetInstance( instanceName ) ;

THEN, catch the keypress and check against 'escape'

example of something from fck docs
 http://docs.cksource.com/FCKeditor_2.x/Developers_Guide/FAQ/JavaScirpt/OnkeyEvent

Toggle line numbers

   1 function DenIE_OnKeyDown()
   2 {
   3     var e = FCK.EditorWindow.event ;
   4     var alreadyRun = false;
   5     // alert(e.keyCode);
   6     switch ( e.keyCode )
   7     {
   8         case 13 :    // ENTER
   9             if ( !(e.ctrlKey || e.altKey || e.shiftKey) )
  10             {
  11                 e.cancelBubble = true ;
  12                 e.returnValue = false;
  13                 if (alreadyRun == false) {
  14                     DENOnKeyDownFunction();
  15                     alreadyRun = true
  16                 }
  17                 return false;
  18             }
  19             else
  20             {
  21                 return true;
  22             }
  23                 break ;
  24     }
  25 }

late in the day my head hurts fck is hard!

just documenting my progress

Note: See TracTickets for help on using tickets.