#2817 closed Task (fixed)
Adding necessary events for commands
Reported by: | Garry Yao | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.0 |
Component: | General | Version: | SVN (FCKeditor) - Retired |
Keywords: | Pending | Cc: |
Description (last modified by )
I found some commands side behaviors might need to be central controlled to reduce code DUP:
- CKEDITOR.dialog.saveSelection plus it's sibling CKEDITOR.dialog.restoreSelection which has big things to do with making the selection correct in IE, were Invoked >50 times through different commands.
- "FCKUndo.SaveUndoStep" back in v2 which support the undo/redo system is also invoked arround this number in the same case.
I wonder if we can hook these aspects of commands with some new types of events , which make many hacks/fixes transparent to the commands logic itself, so in this sense, it also benefits for user extension.
The ones which I propose for discussing:
- initCommand which fired right after user click/hit the command, was used to allocate necessary resources for the command, e.g. save the initial selection ranges and undo snapshot.
- beforeCommandExe which indicate the command is about to make changes to the content, OR modify the selection ranges(In some dialogs' loadElements case). It would be fired at different time for synchronized(e.g. styles) commands and asynchronous(e.g. dialogs) ones (before onShow?), it's useful for dialog commands which sometimes requires to enlarge the selection to the whole control OR restoring fake elements.
- afterCommandExe indicate the command has made actually changes to the documents, which is useful for restore selections and save redo stacks after then;
Change History (7)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 16 years ago by
Milestone: | CKEditor 3.0 → CKEditor 3.x |
---|
comment:4 Changed 16 years ago by
Progress:
- beforeCommandExec - done
- afterCommandExec - done
Replying to garry.yao:
- initCommand which fired right after user click/hit the command, was used to allocate necessary resources for the command, e.g. save the initial selection ranges and undo snapshot.
I'm not sure we need initCommand. All those things can be done in beforeCommandExec.
comment:5 Changed 16 years ago by
Keywords: | Pending added |
---|
Is it still an issue?
- beforeCommandExe and afterCommandExe are already done.
- initCommand is very hard to do and I can't see the usefulness in the current code.
comment:6 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
We should be ok at this point, avoiding bloating the code further.
comment:7 Changed 16 years ago by
Milestone: | CKEditor 3.x → CKEditor 3.0 |
---|
Bugs #2763, #2816 is related to this.