#2817: Adding necessary events for commands
-----------------------+----------------------------------------------------
Reporter: garry.yao | Owner:
Type: Task | Status: new
Priority: Normal | Milestone: CKEditor 3.0
Component: General | Version: SVN
Keywords: |
-----------------------+----------------------------------------------------
Description changed by garry.yao:
Old description:
> 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 , the ones I can imagine were:
> * ''initCommand'' which fired right after user click/hit the command,
> was used to allocate necessary resources for the command, this could be
> used to hook things like save the selection.
> * ''beforeCommandExe'' which indicate the command is about to make
> changes to the document, would be fired at different time for
> synchronized(e.g. styles) and asynchronized(e.g. dialogs), highly
> valuable for things like save undo stacks.
> * "afterCommandExe" on contrast indicate the command has made actually
> changes to the documents, used for restore selections and save redo
> stacks.
> * ''abortCommandExe" would be a branch case if the command has been
> canceled and thus has no major effect, which just bring user back to the
> document.
New description:
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.[[BR]]
* '''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.[[BR]]
* '''afterCommandExe''' indicate the command has made actually changes to
the documents, which is useful for restore selections and save redo
stacks after then;
--
--
Ticket URL: <http://dev.fckeditor.net/ticket/2817#comment:2>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac