Skip to content

Commit ceadbdd

Browse files
committed
feat(json-crdt-extensions): 🎸 improve how cursor is displayed
1 parent 75e2620 commit ceadbdd

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/json-crdt-extensions/peritext/overlay/__tests__/Overlay.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ describe('slices', () => {
186186
expect(point3.layers[1].data()).toStrictEqual({bold: true});
187187
const point4 = next(point3)!;
188188
expect(point4.layers.length).toBe(0);
189-
console.log(peritext + '');
190189
});
191190

192191
test('one char slice should correctly sort overlay points', () => {

src/json-crdt-extensions/peritext/slice/Cursor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ export class Cursor<T = string> extends Range<T> implements Slice<T> {
101101
// ---------------------------------------------------------------- Printable
102102

103103
public toString(tab: string = ''): string {
104-
const text = JSON.stringify(this.text());
104+
const text = this.text();
105105
const focusIcon = this.anchorSide === CursorAnchor.Start ? '.→|' : '|←.';
106106
const main = `${this.constructor.name} ${super.toString(tab + ' ', true)} ${focusIcon}`;
107-
return main + printTree(tab, [() => text]);
107+
return main + (text.length > 32 ? printTree(tab, [() => JSON.stringify(text)]) : '');
108108
}
109109
}

0 commit comments

Comments
 (0)