Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#10455 closed New Feature (invalid)

New FocusManager method Exclude( element )

Reported by: Roberto Owned by:
Priority: Normal Milestone:
Component: Core : Focus Version: 4.0 Beta
Keywords: Cc:

Description

I think that could be very useful a new method that can define a zone in my page that doesn't affect the Inline Editor Focus state. Something like "remove", with the difference that remove works only on previously added object.

Change History (4)

comment:1 Changed 6 years ago by Piotrek Koszuliński

Status: newpending
Version: 4.1.14.0 Beta

What do you mean by "does not affect the inline editor focus state"? Could you describe a TC what do you want to do?

Because, from what you describe, it seems as a perfect use case for focusManager#add. You add element, which focused does not take focus from editor. It acts like a part of editor. However, this element has to be focusable, so it can be some input, textarea, another contenteditable element, or any element with tabindex attribute.

comment:2 Changed 6 years ago by Roberto

I try to use focusmanager#add but it looks that it can't handle in the right way my situation. Maybe my fault, sure, but the FocusManager is not so documented and in your forum I can't find someone that try to accomplish my goal.

I have this sample to help you to understand:

http://media.dday.it/roby/editor4/samples/inlineall.html

I have several editable area on my page. I have an header with some forms and button. Imagine that I need to compile a form, collect the results and push the value inside the CurrentEditor session using InsertHTML() API.

I need that every element in "header" doesn't change the status of every editor session I start on the page.

Now with the function I write I can Focus the first column, compile the form without losing the focus and than insert the value.

You can try with a youtube URL on my page: select the first column, go to the text area, insert youtube url http://www.youtube.com/watch?v=AkiNGtu4lsc and push "insertMedia".

But If I select another column I have still the textarea in the focus manager of the first editor, so here begin the caos. Maybe I have to remove the header on "blur", but in my dream I think that is better to have an "Exclude()" function that on instanceCreated tells to the Editor that my "header" element is something that can't change the status of the editor.

comment:3 Changed 6 years ago by Roberto

Uhm, it looks so easy.

CKEDITOR.on( 'instanceReady', function( event ) {

event.editor.on('focus', function(evt){

console.log(CKEDITOR.currentInstance); var aggiunta = new CKEDITOR.dom.element( document.getElementById( 'header' ) ); CKEDITOR.currentInstance.focusManager.add( aggiunta, 1 )

});

});

Sorry! :) No need for new method!

comment:4 Changed 6 years ago by Piotrek Koszuliński

Resolution: invalid
Status: pendingclosed

You should add aggiunta once - not on every editor focus (unless you also remove these elements from focusManager on editor blur).

And instead of:

var aggiunta = new CKEDITOR.dom.element( document.getElementById( 'header' ) ); 

You can write:

var aggiunta = CKEDITOR.document.getById( 'header' );
Last edited 6 years ago by Piotrek Koszuliński (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy