[CKEditor Dev] #10382: CKEDITOR.currentInstance returns null on focus

2 views
Skip to first unread message

CKEditor

unread,
Apr 25, 2013, 11:33:00 AM4/25/13
to ckeditor...@googlegroups.com
#10382: CKEDITOR.currentInstance returns null on focus
--------------------------+-------------------
Reporter: Mandeep Jain | Type: Bug
Status: new | Priority: Normal
Component: General | Version: 4.0.2
Keywords: |
--------------------------+-------------------
I am using the inline CKEditor. I have many text boxes on the page. When I
click on the text box on which the inline CKEditor is used, I get the
current instance using CKEDITOR.currentInstance. But when I visit the text
box by pressing tab, I get the CKEDITOR.currentInstance as null. The
toolbar is displayed in both cases('click' and 'tab focus').

--
Ticket URL: <http://dev.ckeditor.com/ticket/10382>
CKEditor <http://ckeditor.com/>
The text editor for the Internet

CKEditor

unread,
May 20, 2013, 10:24:13 AM5/20/13
to ckeditor...@googlegroups.com
#10382: CKEDITOR.currentInstance returns null on focus
---------------------------+--------------------
Reporter: Mandeep Jain | Owner:
Type: Bug | Status: closed
Priority: Normal | Milestone:
Component: General | Version: 4.0.2
Resolution: invalid | Keywords:
---------------------------+--------------------
Changes (by j.swiderski):

* status: new => closed
* resolution: => invalid


Comment:

I can't confirm this.
I have tried two approaches here to attach focus event to editor in
massive inline creation sample. In both cases once events have been
registered they worked on click and on tab.

{{{
CKEDITOR.on( 'instanceReady', function( event ) {
event.editor.on('focus', function(evt){
console.log(CKEDITOR.currentInstance);
});

});
}}}

{{{
window.setTimeout(function(){
for (var propertyName in CKEDITOR.instances) {
if ( CKEDITOR.instances.hasOwnProperty(
propertyName ))
CKEDITOR.instances[propertyName].on('focus', function(evt){
console.log(CKEDITOR.currentInstance);
});
}
}, 2000);
}}}

@Mandeep Jain I'm closing this ticket as invalid but if I have missed
anything and you don't agree please let me know.

--
Ticket URL: <http://dev.ckeditor.com/ticket/10382#comment:1>

CKEditor

unread,
May 21, 2013, 3:33:19 AM5/21/13
to ckeditor...@googlegroups.com
#10382: CKEDITOR.currentInstance returns null on focus
---------------------------+--------------------
Reporter: Mandeep Jain | Owner:
Type: Bug | Status: closed
Priority: Normal | Milestone:
Component: General | Version: 4.0.2
Resolution: invalid | Keywords:
---------------------------+--------------------

Comment (by Mandeep Jain):

@j.swiderski I used the same approach, the only difference is that my
timeout is 100ms.

Initially I was doing it without setTimeout which was not working. Then I
set it to 0ms and 10ms which still gave me unpredictable results. Setting
it to 100ms is working for now.

Can we achieve this without setTimeout?

--
Ticket URL: <http://dev.ckeditor.com/ticket/10382#comment:2>

CKEditor

unread,
May 21, 2013, 3:36:50 AM5/21/13
to ckeditor...@googlegroups.com
#10382: CKEDITOR.currentInstance returns null on focus
---------------------------+--------------------
Reporter: Mandeep Jain | Owner:
Type: Bug | Status: closed
Priority: Normal | Milestone:
Component: General | Version: 4.0.2
Resolution: invalid | Keywords:
---------------------------+--------------------

Comment (by j.swiderski):

Yes it can be achieved. Please see first example.[[BR]]
On each instance ready you can attach focus event or whatever you want.

--
Ticket URL: <http://dev.ckeditor.com/ticket/10382#comment:3>

Reply all
Reply to author
Forward
0 new messages