﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2817	Adding necessary events for commands	Garry Yao		"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;"	Task	closed	Normal	CKEditor 3.0	General	SVN (FCKeditor) - Retired	fixed	Pending	
