Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method editor.addCommand should accept command instances #1582

Closed
mlewand opened this issue Feb 5, 2018 · 1 comment
Closed

Method editor.addCommand should accept command instances #1582

mlewand opened this issue Feb 5, 2018 · 1 comment
Labels
changelog:api A changelog entry should be put in the API section of the changelog. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Milestone

Comments

@mlewand
Copy link
Contributor

mlewand commented Feb 5, 2018

Are you reporting a feature request or a bug?

Feature request

Provide detailed reproduction steps (if any)

Currently editor.addCommand method will always convert given command to a base CKEDITOR.command class instance.

  1. Execute following code:
var styleDefinition = {
		element: 'span',
		attribtues: {
			class: 'foo'
		}
	},
	style = new CKEDITOR.style( styleDefinition ),
	cmd = new CKEDITOR.command( editor, new CKEDITOR.styleCommand( style ) );


editor.addCommand( 'cmd', cmd );

console.log( editor.getCommand( 'cmd' ) === cmd );

Expected result

Console log should report true, it should be possible to add command instances inheriting from or being a CKEDITOR.command instance.

Actual result

Console log reports false.

@mlewand mlewand added type:feature A feature request. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. changelog:api A changelog entry should be put in the API section of the changelog. labels Feb 5, 2018
@mlewand
Copy link
Contributor Author

mlewand commented Mar 9, 2018

Originally this ticket was exampled using a CKEDITOR.styleCommand instance. However there's a catch here in the fact that CKEDITOR.styleCommand inherits from CKEDITOR.commandDefinition. So CKEDITOR.styleCommand is not a command but a definition (contrary to what the name suggests).

In that case I'll modify this issue to be a generic, and so that editor.addCommand accepts command instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:api A changelog entry should be put in the API section of the changelog. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Projects
None yet
Development

No branches or pull requests

2 participants