Opened 16 years ago
Closed 16 years ago
#2912 closed Bug (fixed)
V3: Encapsulate the command state change logic inside the CKEDITOR.command class
Reported by: | Frederico Caldeira Knabben | Owned by: | Frederico Caldeira Knabben |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
Component: | General | Version: | |
Keywords: | Confirmed Review+ | Cc: |
Description
There is a common repetition in the current code:
var command = editor.getCommand( name ); command.state = newState; command.fire( 'state' );
This logic could be encapsulated inside the CKEDITOR.command class, so we can achieve the same thing with:
editor.getCommand( name ).setState( newState );
Attachments (1)
Change History (6)
Changed 16 years ago by
Attachment: | 2912.patch added |
---|
comment:1 Changed 16 years ago by
Keywords: | Review? added |
---|---|
Status: | new → assigned |
comment:2 Changed 16 years ago by
Apply the patch in conjunction with #2913, I found some edge cases on the initial state setting:
- command source initial state setting is override by CKEDITOR.config.startupMode.
- stateless commands e.g. smiley should not respond to inital state definition of CKEDITOR.TRISTATE_OFF.
comment:3 Changed 16 years ago by
Besides, in case we choose not to get initial focus on editor instances, stateful commands e.g. Unlink and Indent require manually config their state to CKEDITOR.TRISTATE_OFF via CKEDITOR.commandDefinition::state, which is now missing in _source\core\commanddefinition.js, not sure if this's out of the scope of this patch.
comment:4 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
The purpose of this ticket is to simplify code, which it does.
Let's open another bug ticket for other issues.
comment:5 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed with [3057]. Click here for more info about our SVN system.
This patch makes it also possible to set the initial state of the command into the command definition.