Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 44x 44x 44x 44x 1562x 1562x 1562x 1562x 1562x 1660x 3x | import {NodeApi} from '../../json-crdt/model/api/nodes'; import {Peritext} from './Peritext'; import {printTree} from 'tree-dump/lib/printTree'; import type {Editor} from './editor/Editor'; import type {PeritextNode} from './PeritextNode'; import type {ExtApi, StrApi, ArrApi, ArrNode, ModelApi} from '../../json-crdt'; import type {SliceNode} from './slice/types'; export class PeritextApi extends NodeApi<PeritextNode> implements ExtApi<PeritextNode> { public readonly txt: Peritext; public readonly editor: Editor; constructor( public node: PeritextNode, public readonly api: ModelApi<any>, ) { super(node, api); this.txt = new Peritext(api.model, node.text(), node.slices()); this.editor = this.txt.editor; } public text(): StrApi { return this.api.wrap(this.node.text()); } public slices(): ArrApi<ArrNode<SliceNode>> { return this.api.wrap(this.node.slices()); } public toString(tab?: string): string { return ( 'PeritextApi' + printTree(tab, [(tab) => this.node.toString(tab), () => '', (tab) => this.txt.toString(tab)]) ); } } |