Closed Bug 1792764 Opened 2 years ago Closed 2 years ago

`SetEditMode` should not use `editor.transactionManager.maxTransactionCount` to disable undo temporarily and clear undo stack

Categories

(SeaMonkey :: Composer, defect)

defect

Tracking

(seamonkey2.53 unaffected)

RESOLVED FIXED
Tracking Status
seamonkey2.53 --- unaffected

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

https://searchfox.org/comm-central/rev/77f980a5aeac0a1aef7285bcfea6e64241fc0263/suite/editor/base/content/editor.js#1851-1856,1890-1893

      // Reduce the undo count so we don't use too much memory
      //   during multiple uses of source window
      //   (reinserting entire doc caches all nodes)
      try {
        editor.transactionManager.maxTransactionCount = 1;
      } catch (e) {}
      // Restore unlimited undo count
      try {
        editor.transactionManager.maxTransactionCount = -1;
      } catch (e) {}

These blocks are performed before and after updating the WYSIWYG editor for newer source code. However, I don't understand it wants to keep undoable only the updating.

I'll remove nsIEditor.transactionManager in bug 1768315, therefore, SeaMonkey needs to replace them with a call of editor.enableUndo(false) and editor.enableUndo(true). Then, the calls of the XHTML path between them are not necessary.

Attached patch Patch (deleted) — Splinter Review

Bug 1792764 - Make comm-central stop using nsIEditor.transactionManager since it'll be removed

nsIEditor.transactionManager will be removed soon and its user is now only
SeaMonkey which want it to clear undo/redo transactions of editors. For doing
that, we can use nsIEditor.clearUndoRedo() now.

Note that the purpose of ExecuteJSTransactionViaTxmgr() will be invalid
after nsIEditor.transactionManager is removed. Therefore, this patch removes
it and the UI to run it too.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Attachment #9299713 - Flags: review?(nunojsg)

Comment on attachment 9299713 [details] [diff] [review]
Patch

LGTM. Thanks. There are a few minor formatting issues I have with some if the comments and I would like to keep the locale variable for the release branch but I will fix this up for check-in.

Attachment #9299713 - Flags: review?(nunojsg) → review+
Version: unspecified → Trunk

Thank you. I'll remove transactionManager of nsIEditor soon in m-c.

Hi, I'll land https://phabricator.services.mozilla.com/D160008 in a couple of days. Land the patch as soon as possible.

Flags: needinfo?(frgrahl)

Thaks for the heads up. I will put it in our build patches queue for wip stuff till I land it. No need to delay the removal.

Flags: needinfo?(frgrahl)

Thank you. I'll land it.

Pushed by frgrahl@gmx.net:
https://hg.mozilla.org/comm-central/rev/c693be030e90
Make suite stop using nsIEditor.transactionManager. r=frg

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: