Opened 10 years ago

Closed 7 years ago

#5143 closed Bug (invalid)

CKEDITOR.currentInstance.openDialog('your-custom-dialogue'); Does not work in Opera

Reported by: Tony Owned by:
Priority: Normal Milestone:
Component: General Version: SVN (CKEditor) - OLD
Keywords: Cc: Hallvord R. M. Steen (Opera Software)

Description

Opera 10, using CKEDITOR.currentInstance.openDialog('your-custom-dialogue'); in plugin.js as : an editor.addCommand doesn't work in Opera but does in Firefox. May crap out other browsers too?

I had to do an : alert( CKEDITOR.currentInstance.name ); just to get the current instance name instead. In opera that fails on the first click of the plugin's toobar icon but works on the second, same as above.

The code was :

CKEDITOR.plugins.add( 'custom',
{

	requires: ['iframedialog'],
	lang : [ 'en' ],

	init : function( editor )
	{

		var pluginName = 'custom';

		/* Register the dialog. */
		CKEDITOR.dialog.addIframe('your-custom-dialogue', 'your custom dialogue',this.path + 'dialogs/dialog.php',500,300,function(){ /* oniframeload */ })
		/* Register the command. */
		var command =  editor.addCommand('custom', {exec:customWindow});

		command;
		command.modes = { wysiwyg:1, source:1 };
		command.canUndo = false;

		/* Set the language and the command */
		editor.ui.addButton( 'custom',
			{
				label : editor.lang.langCustom.label,
				command : pluginName
			});

	},

})

function customWindow() {
    /* run when custom button is clicked */
    CKEDITOR.currentInstance.openDialog('your-custom-dialogue')

}

message: Cannot convert undefined or null to Object.

Using :

function customWindow() {
    /* run when custom button is clicked */
    CKEDITOR.instances.content.openDialog('your-custom-dialogue')

}

instead works as expected.

Change History (3)

comment:1 Changed 9 years ago by Hallvord R. M. Steen (Opera Software)

Cc: Garry Yao Hallvord R. M. Steen (Opera Software) added

I'm not quite sure how to test this. Is this a known problem? Are there other plugins with custom dialogs that we could test?

comment:2 Changed 9 years ago by Hallvord R. M. Steen (Opera Software)

Cc: garryyao added

(and I'm not sure if I should CC you as garry.yao or garryyao, Garry - sorry about any extra spam..)

comment:3 Changed 7 years ago by Jakub Ś

Cc: Garry Yao garryyao removed
Resolution: invalid
Status: newclosed

As described here - http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.html#.currentInstance - currentInstance works only if editor has focus.

For calling dialogs you should be using CKEDITOR.instances.instanceName.

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