Closed Bug 1792759 Opened 2 years ago Closed 2 years ago

Create new APIs for users of `nsIEditor.transactionManager`

Categories

(Core :: DOM: Editor, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(4 files)

No description provided.

nsIEditor.transactionManager is used only for some simple purposes, however,
nsIEditor exposes the rich API. That makes it harder to maintain internal
code around transactions. Instead, nsIEditor exposes only simple and
necessary APIs.

This patch creates a new API to clear undo/redo history and make the users in
mozilla-central use it instead of using nsITransactionManager.clear().

Depends on D158335

They are methods to take 2 out params, and it's not convenient for light use.
I think that there should be 3 attributes, undoRedoEnabled, canUndo and
canRedo. Then, the findbar does not need to check number of transactions
with nsITransactionManager.

Depends on D158336

nsIEditor.undo and nsIEditor.redo are called with 1 except by the search
bar, and search bar wants to undo everything to reset the value. Therefore,
search bar needs an API to undo all, and the others do not need the number of
undoing/redoing transactions. Therefore, this patch adds nsIEditor.undoAll
for search bar, and remove the arguments from nsIEditor.undo and
nsIEditor.redo.

Depends on D158337

Now, nsIEditor has all alternatives of remaining nsITransactionManager
usage in mozilla-central.

Depends on D158338

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/cd2887479b57
part 1: Add `nsIEditor.clearUndoRedo()` to get rid of `nsIEditor.transactionManager` r=m_kato,NeilDeakin,Standard8
https://hg.mozilla.org/integration/autoland/rev/a8905b5dc95a
part 2: Redesign `nsIEditor.canUndo` and `nsIEditor.canRedo` r=m_kato,NeilDeakin
https://hg.mozilla.org/integration/autoland/rev/52f672a5a34b
part 3: Add `nsIEditor.undoAll` r=m_kato,Standard8
https://hg.mozilla.org/integration/autoland/rev/b8567457ece9
part 4: Make all tests in mozilla-central stop using `nsIEditor.transactionManager` r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: