Opened 6 years ago

Last modified 5 years ago

#10555 confirmed Bug

It is not possible to catch key event when deleting list

Reported by: Jakub Ś Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description (last modified by Jakub Ś)

  1. Setup editor
    var editor = CKEDITOR.replace( 'editor1' );
    			editor.on( 'pluginsLoaded', function( evt )
    			{				
    				editor.on( 'contentDom', function( e )
    				{
    					var editable = editor.editable();
    					var doc = editor.document;
    					var wasKeyboardAlreadyUsed = false;
    					editable.attachListener( doc, 'keydown', function( event ) 
    					{							
    						console.log('key');
    					});						
    							
    				});
    			});		
    
  2. Open page and insert list into editor
  3. Select whole list with mouse and press delete or backspace.

Result: key event isn't caught.

Problem can be reproduced from CKEditor 4.0.

This issue was reported on our support channel.

Change History (6)

comment:1 Changed 6 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 6 years ago by Jakub Ś

Another TC:

Insert below code, put cursor behind "ipsum" and press delete.

<p>Lorem ipsum^</p>
<ul>

                <li>item 1</li>

                <li>item 2</li>

</ul>

comment:3 Changed 6 years ago by Jakub Ś

I have just checked this issue:

  1. Open sample page and clear everything with new page command
  2. Create a list - key is logged
  3. Select list with Ctrl+A or with a mouse
  4. Press delete or backspace

Results: keydown isn't caught when list is deleted but keyup is

comment:4 Changed 6 years ago by Kapil

Its a very important use case for me. Since CKEditor does not provide API to make a element non editable or mandatory (however selectable), I need to trap delete key so that user cannot delete the list item. Since the keydown event is not working, I cannot intercept delete key and restrict user from deleting the list. There is no use of intercepting keyup event as delete key is already executed. Please take this in next release

comment:5 Changed 6 years ago by Jakub Ś

Description: modified (diff)

comment:6 Changed 5 years ago by ritesh

can someone tell me how to handle this situation? Having same issue. Downloaded source code and debug the code, onkeydown ck-editor cancel this event. Is there anyway i can prevent deleting <li>?

Thanks in advance.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy