Skip to content

Commit f873360

Browse files
committed
refactor(json-crdt-peritext-ui): 💡 update annals event interface
1 parent d6d564d commit f873360

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

src/json-crdt-peritext-ui/dom/annals/AnnalsController.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ export class AnnalsController implements UndoCollector, UiLifeCycles, Printable
6060
const patch = log.undo(doPatch);
6161
et.dispatch('annals', {
6262
action: 'undo',
63-
source: doPatch,
64-
patch,
63+
batch: [patch],
6564
});
6665
// console.log('doPatch', doPatch + '');
6766
// console.log('undoPatch', patch + '');
@@ -73,8 +72,7 @@ export class AnnalsController implements UndoCollector, UiLifeCycles, Printable
7372
const redoPatch = doPatch.rebase(log.end.clock.time);
7473
et.dispatch('annals', {
7574
action: 'redo',
76-
source: doPatch,
77-
patch: redoPatch,
75+
batch: [redoPatch],
7876
});
7977
// console.log('doPatch', doPatch + '');
8078
// console.log('redoPatch', redoPatch + '');

src/json-crdt-peritext-ui/events/defaults/PeritextEventDefaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ export class PeritextEventDefaults implements PeritextEventHandlerMap {
375375
};
376376

377377
public readonly annals = (event: CustomEvent<events.AnnalsDetail>) => {
378-
const {patch} = event.detail;
379-
this.txt.model.applyPatch(patch);
378+
const {batch} = event.detail;
379+
this.txt.model.applyBatch(batch);
380380
};
381381
}

src/json-crdt-peritext-ui/events/types.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,10 @@ export interface AnnalsDetail {
326326
action: 'undo' | 'redo';
327327

328328
/**
329-
* The original {@link Patch} from which the undo/redo action was originally
330-
* created.
329+
* The list of {@link Patch} that will be applied to the document to undo or
330+
* redo the action, unless the action is cancelled.
331331
*/
332-
source: Patch;
333-
334-
/**
335-
* The {@link Patch} that will be applied to the document to undo or redo the
336-
* action, unless the action is cancelled.
337-
*/
338-
patch: Patch;
332+
batch: [Patch];
339333
}
340334

341335
/**

0 commit comments

Comments
 (0)