diff --git a/src/utils/AttributionManager.js b/src/utils/AttributionManager.js index 3373c91c..4b53bb16 100644 --- a/src/utils/AttributionManager.js +++ b/src/utils/AttributionManager.js @@ -5,8 +5,7 @@ import { createDeleteSetFromStructStore, createIdMapFromIdSet, ContentDeleted, - Doc, Item, AbstractContent, IdMap, // eslint-disable-line - findIndexCleanStart + Doc, Item, AbstractContent, IdMap // eslint-disable-line } from '../internals.js' import * as error from 'lib0/error' @@ -193,8 +192,6 @@ export class DiffAttributionManager { } } - - /** * Attribute changes from ydoc1 to ydoc2. * diff --git a/tests/y-xml.tests.js b/tests/y-xml.tests.js index 08c2326e..80bb2493 100644 --- a/tests/y-xml.tests.js +++ b/tests/y-xml.tests.js @@ -307,7 +307,6 @@ export const testElementAttributedContentViaDiffer = _tc => { const ydoc = new Y.Doc() Y.applyUpdate(ydoc, Y.encodeStateAsUpdate(ydocV1)) const yelement = ydoc.getXmlElement('p') - const elem1 = yelement.get(0) // new Y.XmlText('hello') const elem2 = yelement.get(1) // new Y.XmlElement('span') const elem3 = new Y.XmlText('world') t.group('insert / delete', () => { @@ -347,20 +346,20 @@ export const testElementAttributedContentViaDiffer = _tc => { * @param {t.TestCase} _tc */ export const testAttributionManagerSimpleExample = _tc => { -const ydoc = new Y.Doc() -// create some initial content -ydoc.getXmlFragment().insert(0, [new Y.XmlText('hello world')]) -const ydocFork = new Y.Doc() -Y.applyUpdate(ydocFork, Y.encodeStateAsUpdate(ydoc)) -// modify the fork -// append a span element -ydocFork.getXmlFragment().insert(1, [new Y.XmlElement('span')]) -const ytext = /** @type {Y.XmlText} */ (ydocFork.getXmlFragment().get(0)) -// make "hello" italic -ytext.format(0, 5, { italic: true }) -ytext.insert(11, '!') -// highlight the changes -console.log(JSON.stringify(ydocFork.getXmlFragment().getContentDeep(Y.createAttributionManagerFromDiff(ydoc, ydocFork)), null, 2)) + const ydoc = new Y.Doc() + // create some initial content + ydoc.getXmlFragment().insert(0, [new Y.XmlText('hello world')]) + const ydocFork = new Y.Doc() + Y.applyUpdate(ydocFork, Y.encodeStateAsUpdate(ydoc)) + // modify the fork + // append a span element + ydocFork.getXmlFragment().insert(1, [new Y.XmlElement('span')]) + const ytext = /** @type {Y.XmlText} */ (ydocFork.getXmlFragment().get(0)) + // make "hello" italic + ytext.format(0, 5, { italic: true }) + ytext.insert(11, '!') + // highlight the changes + console.log(JSON.stringify(ydocFork.getXmlFragment().getContentDeep(Y.createAttributionManagerFromDiff(ydoc, ydocFork)), null, 2)) /* => { "children": { @@ -412,4 +411,3 @@ console.log(JSON.stringify(ydocFork.getXmlFragment().getContentDeep(Y.createAttr } */ } -