Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#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 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.
  • 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 15 years ago by Garry Yao

Bugs #2763, #2816 is related to this.

comment:2 Changed 15 years ago by Garry Yao

Description: modified (diff)

comment:3 Changed 15 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.0CKEditor 3.x

comment:4 in reply to:  description Changed 15 years ago by Artur Formella

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 15 years ago by Artur Formella

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 15 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: newclosed

We should be ok at this point, avoiding bloating the code further.

comment:7 Changed 15 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.xCKEditor 3.0
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy