UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

14 lines (13 loc) 431 B
import { ArrApi, NodeApi } from '../../json-crdt/model/api/nodes'; export class MvalApi extends NodeApi { set(json) { const { api, node } = this; const builder = api.builder; const rgaApi = new ArrApi(node.data, api); const length = rgaApi.length(); rgaApi.del(0, length); rgaApi.ins(0, [builder.json(json)]); rgaApi.node.removeTombstones(); return this; } }