Opened 9 years ago

Closed 9 years ago

#7509 closed Bug (invalid)

CKEDITOR.currentInstance is null inside a plugin

Reported by: Dan Silk Owned by:
Priority: Normal Milestone:
Component: UI : Toolbar Version: 3.5.2
Keywords: Cc: emeerson@…, rbudigelli@…

Description

I have a page with 2 instances of CKEditor and I'm using the MediaEmbed (http://www.fluidbyte.net/embed-youtube-vimeo-etc-into-ckeditor) plugin to add video to the content. I add the MediaEmbed button to the tool bar of the first instance only, but when trying to add media to the content, it gets inserted in the second instance. Debugging reveals that inside the plugin the "editor" variable which is passed to the plugin is the wrong (second) instance and the "currentInstance" property of the CKEDITOR object is null.

Change History (1)

comment:1 Changed 9 years ago by Jakub Ś

Keywords: currentInstance plugin MediaEmbed removed
Resolution: invalid
Status: newclosed

I think I may have found the root of your problem. You didn't pass editor instance to dialog function. After changing your code from:

CKEDITOR.dialog.add( 'MediaEmbedDialog', function ()

to:[BR]

CKEDITOR.dialog.add( 'MediaEmbedDialog', function ( editor )

it started working as it should. Although I had to clear my browser's cache to see changes.

If I could give you a piece of advice: I have noticed one annoying thing in your plug-in. I have pasted one youtube link and than I wanted to paste another but when I opened the dialog window there was still an old link. I had to delete it first and than I could paste another. It’s no big deal but I thought to myself – if I had to paste ten or twenty youtube links like this (every time with extra delete) I would be pretty angry at the end ;).

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