Opened 10 years ago

Closed 10 years ago

#3662 closed Bug (fixed)

There needs to be a way to reset the undo stack

Reported by: Damian Owned by: Artur Formella
Priority: Normal Milestone: CKEditor 3.0
Component: General Version:
Keywords: IBM Confirmed Review+ Doc Cc:

Description

A mechanism is required to reset the undo buffer.

When the editor is created with an initial set of data it is desirable to reset the undo buffer so that the user does not undo the initial setData() result.

Attachments (5)

3662.patch (1.6 KB) - added by Artur Formella 10 years ago.
3662_testcase.patch (8.4 KB) - added by Artur Formella 10 years ago.
3662_2.patch (2.0 KB) - added by Artur Formella 10 years ago.
3662_2_testcase.patch (4.2 KB) - added by Artur Formella 10 years ago.
3662_3.patch (1.7 KB) - added by Artur Formella 10 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 10 years ago by Artur Formella

Keywords: Confirmed added
Owner: set to Artur Formella
Status: newassigned

Changed 10 years ago by Artur Formella

Attachment: 3662.patch added

Changed 10 years ago by Artur Formella

Attachment: 3662_testcase.patch added

comment:2 Changed 10 years ago by Artur Formella

Keywords: Review? added

comment:3 Changed 10 years ago by Martin Kou

Keywords: Review- added; Review? removed

The reset mechanism works.

Since the reset mechanism will be used by external developers, it's better to give them an API call instead of requiring them to fire an editor event.

So I would recommend in addition to the reset event, add a simple function under CKEDITOR.editor which would fire that event.

Also, the "History" in the resetUndoHistory event name should be redundant - resetUndo would mean essentially the same thing.

Changed 10 years ago by Artur Formella

Attachment: 3662_2.patch added

Changed 10 years ago by Artur Formella

Attachment: 3662_2_testcase.patch added

comment:4 Changed 10 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:5 Changed 10 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

Sorry... but why having the function calling the event. At this point, we can simply have the function in editor doing the entire job.

comment:6 Changed 10 years ago by Garry Yao

Besides, certain fields are missed from resetting, and they're important to the undo system consistency:

  • hasUndo
  • hasRedo
  • typing

Changed 10 years ago by Artur Formella

Attachment: 3662_3.patch added

comment:7 Changed 10 years ago by Artur Formella

Keywords: Review? added; Review- removed

comment:8 Changed 10 years ago by Martin Kou

Keywords: Review+ added; Review? removed

The patch looks good, but there's one typo in it.

Please correct the typo in L305 "tasRedo" before committing.

comment:9 in reply to:  8 Changed 10 years ago by Artur Formella

Replying to martinkou:

Please correct the typo in L305 "tasRedo" before committing.

Done.

Fixed with [3661]

comment:10 Changed 10 years ago by Artur Formella

Keywords: Doc? added

editor.resetUndo() was introduced with this ticket.

comment:11 Changed 10 years ago by Artur Formella

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy