Skip to content

Commit

Permalink
feat(json-crdt-extensions): 🎸 print cursors in editor dump
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Nov 12, 2024
1 parent 0e7c595 commit 449c3e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/json-crdt-extensions/peritext/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,11 @@ export class Editor<T = string> implements Printable {
const pending = this.pending.value;
const pendingFormatted = {} as any;
for (const [type, data] of pending) pendingFormatted[formatType(type)] = data;
return 'Editor' + printTree(tab, [() => `pending ${stringify(pendingFormatted)}`]);
return 'Editor' + printTree(tab, [
(tab) => 'cursors' + printTree(tab,
[...this.cursors()].map((cursor) => (tab) => cursor.toString(tab)),
),
() => `pending ${stringify(pendingFormatted)}`
]);
}
}
2 changes: 1 addition & 1 deletion src/json-crdt-peritext-ui/plugins/debug/RenderPeritext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const RenderPeritext: React.FC<RenderPeritextProps> = ({enabled: enabledP
flags: {
dom: new ValueSyncStore<boolean>(true),
editor: new ValueSyncStore<boolean>(true),
peritext: new ValueSyncStore<boolean>(true),
peritext: new ValueSyncStore<boolean>(false),
model: new ValueSyncStore<boolean>(false),
},
}),
Expand Down

0 comments on commit 449c3e5

Please sign in to comment.