diff --git a/examples/html-editor/index.mjs b/examples/html-editor/index.mjs index d3ef5f23..cfce7e7d 100644 --- a/examples/html-editor/index.mjs +++ b/examples/html-editor/index.mjs @@ -4,11 +4,20 @@ import Y from '../../src/Y.mjs' import DomBinding from '../../src/Bindings/DomBinding/DomBinding.mjs' import UndoManager from '../../src/Util/UndoManager.mjs' import YXmlFragment from '../../src/Types/YXml/YXmlFragment.mjs' +import YIndexdDBPersistence from '../../src/Persistences/IndexedDBPersistence.mjs' const connector = new YWebsocketsConnector() +const persistence = new YIndexdDBPersistence() const y = new Y('html-editor', null, null, { gc: true }) -connector.connectY('html-editor2', y) +persistence.connectY('html-editor', y).then(() => { + // connect after persisted content was applied to y + // If we don't wait for persistence, the other peer will send all data, waisting + // network bandwidth.. + connector.connectY('html-editor', y) +}) + window.connector = connector +window.persistence = persistence window.onload = function () { window.domBinding = new DomBinding(window.yXmlType, document.body, { scrollingElement: document.scrollingElement }) diff --git a/examples/notes/index.html b/examples/notes/index.html new file mode 100644 index 00000000..759cbdf4 --- /dev/null +++ b/examples/notes/index.html @@ -0,0 +1,8 @@ + + + + + +
+ +