From 37fbbca196735d28d776f30235577bc23082be5e Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:05:27 +0100 Subject: [PATCH 1/4] docs: improve JSDoc of UndoManager --- .../src/view/undoable-change/UndoManager.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/core/src/view/undoable-change/UndoManager.ts b/packages/core/src/view/undoable-change/UndoManager.ts index f468d7c7d3..d566237aa8 100644 --- a/packages/core/src/view/undoable-change/UndoManager.ts +++ b/packages/core/src/view/undoable-change/UndoManager.ts @@ -22,20 +22,18 @@ import EventSource from '../event/EventSource.js'; import UndoableEdit from './UndoableEdit.js'; /** - * @class UndoManager - * * Implements a command history. When changing the graph model, an - * {@link mxUndoableChange} object is created at the start of the transaction (when + * {@link UndoableChange} object is created at the start of the transaction (when * model.beginUpdate is called). All atomic changes are then added to this * object until the last model.endUpdate call, at which point the - * {@link mxUndoableEdit} is dispatched in an event, and added to the history inside + * {@link UndoableEdit} is dispatched in an event, and added to the history inside * {@link UndoManager}. This is done by an event listener in * {@link Editor.installUndoHandler}. * - * Each atomic change of the model is represented by an object (eg. - * {@link mxRootChange}, {@link mxChildChange}, {@link mxTerminalChange} etc) which contains the + * Each atomic change of the model is represented by an object (e.g. + * {@link RootChange}, {@link ChildChange}, {@link TerminalChange}, etc.) which contains the * complete undo information. The {@link UndoManager} also listens to the - * {@link mxGraphView} and stores it's changes to the current root as insignificant + * {@link GraphView} and stores it's changes to the current root as insignificant * undoable changes, so that drilling (step into, step up) is undone. * * This means when you execute an atomic change on the model, then change the @@ -62,7 +60,7 @@ import UndoableEdit from './UndoableEdit.js'; * * The code creates a function that informs the undoManager * of an undoable edit and binds it to the undo event of - * {@link mxGraphModel} and {@link mxGraphView} using + * {@link GraphModel} and {@link GraphView} using * {@link EventSource.addListener}. * * ### Event: mxEvent.CLEAR @@ -72,17 +70,17 @@ import UndoableEdit from './UndoableEdit.js'; * ### Event: mxEvent.UNDO * * Fires afer a significant edit was undone in {@link undo}. The `edit` - * property contains the {@link mxUndoableEdit} that was undone. + * property contains the {@link UndoableEdit} that was undone. * * ### Event: mxEvent.REDO * * Fires afer a significant edit was redone in {@link redo}. The `edit` - * property contains the {@link mxUndoableEdit} that was redone. + * property contains the {@link UndoableEdit} that was redone. * * ### Event: mxEvent.ADD * * Fires after an undoable edit was added to the history. The `edit` - * property contains the {@link mxUndoableEdit} that was added. + * property contains the {@link UndoableEdit} that was added. */ class UndoManager extends EventSource { constructor(size = 100) { From e7f85062b2399835b960d3495ef589a480191b60 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:11:25 +0100 Subject: [PATCH 2/4] add more improvements --- .../src/view/undoable-change/UndoManager.ts | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/core/src/view/undoable-change/UndoManager.ts b/packages/core/src/view/undoable-change/UndoManager.ts index d566237aa8..933bf50135 100644 --- a/packages/core/src/view/undoable-change/UndoManager.ts +++ b/packages/core/src/view/undoable-change/UndoManager.ts @@ -33,7 +33,7 @@ import UndoableEdit from './UndoableEdit.js'; * Each atomic change of the model is represented by an object (e.g. * {@link RootChange}, {@link ChildChange}, {@link TerminalChange}, etc.) which contains the * complete undo information. The {@link UndoManager} also listens to the - * {@link GraphView} and stores it's changes to the current root as insignificant + * {@link GraphView} and stores its changes to the current root as insignificant * undoable changes, so that drilling (step into, step up) is undone. * * This means when you execute an atomic change on the model, then change the @@ -49,35 +49,34 @@ import UndoableEdit from './UndoableEdit.js'; * display across multiple undo/redo steps. * * ```javascript - * var undoManager = new UndoManager(); - * var listener(sender, evt) - * { + * const undoManager = new UndoManager(); + * const listener(sender, evt) { * undoManager.undoableEditHappened(evt.getProperty('edit')); * }; - * graph.getDataModel().addListener(mxEvent.UNDO, listener); - * graph.getView().addListener(mxEvent.UNDO, listener); + * graph.getDataModel().addListener(InternalEvent.UNDO, listener); + * graph.getView().addListener(InternalEvent.UNDO, listener); * ``` * * The code creates a function that informs the undoManager * of an undoable edit and binds it to the undo event of - * {@link GraphModel} and {@link GraphView} using + * {@link GraphDataModel} and {@link GraphView} using * {@link EventSource.addListener}. * - * ### Event: mxEvent.CLEAR + * ### Event: InternalEvent.CLEAR * * Fires after {@link clear} was invoked. This event has no properties. * - * ### Event: mxEvent.UNDO + * ### Event: InternalEvent.UNDO * * Fires afer a significant edit was undone in {@link undo}. The `edit` * property contains the {@link UndoableEdit} that was undone. * - * ### Event: mxEvent.REDO + * ### Event: InternalEvent.REDO * * Fires afer a significant edit was redone in {@link redo}. The `edit` * property contains the {@link UndoableEdit} that was redone. * - * ### Event: mxEvent.ADD + * ### Event: InternalEvent.ADD * * Fires after an undoable edit was added to the history. The `edit` * property contains the {@link UndoableEdit} that was added. From 7925c40aee30ef43602b5a9bbf5f5686de81884a Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:18:12 +0100 Subject: [PATCH 3/4] fix jsdoc --- packages/core/src/view/undoable-change/UndoManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/view/undoable-change/UndoManager.ts b/packages/core/src/view/undoable-change/UndoManager.ts index 933bf50135..d3d63fb240 100644 --- a/packages/core/src/view/undoable-change/UndoManager.ts +++ b/packages/core/src/view/undoable-change/UndoManager.ts @@ -23,7 +23,7 @@ import UndoableEdit from './UndoableEdit.js'; /** * Implements a command history. When changing the graph model, an - * {@link UndoableChange} object is created at the start of the transaction (when + * {@link UndoableEdit} object is created at the start of the transaction (when * model.beginUpdate is called). All atomic changes are then added to this * object until the last model.endUpdate call, at which point the * {@link UndoableEdit} is dispatched in an event, and added to the history inside From 869f0001e5bedd613c7e39f1029b74528731bc76 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Thu, 19 Feb 2026 15:14:15 +0100 Subject: [PATCH 4/4] fix jsdoc [skip ci] --- packages/core/src/view/undoable-change/UndoManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/view/undoable-change/UndoManager.ts b/packages/core/src/view/undoable-change/UndoManager.ts index d3d63fb240..c2e30bdc62 100644 --- a/packages/core/src/view/undoable-change/UndoManager.ts +++ b/packages/core/src/view/undoable-change/UndoManager.ts @@ -50,7 +50,7 @@ import UndoableEdit from './UndoableEdit.js'; * * ```javascript * const undoManager = new UndoManager(); - * const listener(sender, evt) { + * function listener(sender, evt) { * undoManager.undoableEditHappened(evt.getProperty('edit')); * }; * graph.getDataModel().addListener(InternalEvent.UNDO, listener);