From aa9420688ba1cb151d8ac309e0c58e5b4b787967 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 30 Nov 2020 14:30:24 +0100 Subject: [PATCH] fix collab examples --- .../demos/Extensions/Collaboration/index.vue | 16 +++---------- .../Extensions/CollaborationCursor/index.vue | 24 +++++++------------ 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/docs/src/demos/Extensions/Collaboration/index.vue b/docs/src/demos/Extensions/Collaboration/index.vue index a420f995..caddab84 100644 --- a/docs/src/demos/Extensions/Collaboration/index.vue +++ b/docs/src/demos/Extensions/Collaboration/index.vue @@ -18,30 +18,21 @@ export default { data() { return { - documentName: 'tiptap-collaboration-extension', - ydoc: null, - provider: null, - type: null, editor: null, } }, mounted() { - this.ydoc = new Y.Doc() - this.provider = new WebrtcProvider(this.documentName, this.ydoc) - this.type = this.ydoc.getXmlFragment('prosemirror') + const ydoc = new Y.Doc() + const provider = new WebrtcProvider('tiptap-collaboration-extension', ydoc) this.editor = new Editor({ - // TODO: This is added by every new user. - // content: ` - //

Example Text

- // `, extensions: [ Document, Paragraph, Text, Collaboration.configure({ - type: this.type, + provider, }), ], }) @@ -49,7 +40,6 @@ export default { beforeDestroy() { this.editor.destroy() - this.provider.destroy() }, } diff --git a/docs/src/demos/Extensions/CollaborationCursor/index.vue b/docs/src/demos/Extensions/CollaborationCursor/index.vue index 187cbbf4..cc3f25f2 100644 --- a/docs/src/demos/Extensions/CollaborationCursor/index.vue +++ b/docs/src/demos/Extensions/CollaborationCursor/index.vue @@ -19,35 +19,28 @@ export default { data() { return { - documentName: 'tiptap-collaboration-cursor-extension', - ydoc: null, - provider: null, - type: null, editor: null, } }, mounted() { - this.ydoc = new Y.Doc() - this.provider = new WebrtcProvider(this.documentName, this.ydoc) - this.type = this.ydoc.getXmlFragment('prosemirror') + const ydoc = new Y.Doc() + const provider = new WebrtcProvider('tiptap-collaboration-cursor-extension', ydoc) this.editor = new Editor({ - // TODO: This is added by every new user. - // content: ` - //

Example Text

- // `, extensions: [ Document, Paragraph, Text, Collaboration.configure({ - type: this.type, + provider, }), CollaborationCursor.configure({ - provider: this.provider, - name: 'Cyndi Lauper', - color: '#f783ac', + provider, + user: { + name: 'Cyndi Lauper', + color: '#f783ac', + }, }), ], }) @@ -55,7 +48,6 @@ export default { beforeDestroy() { this.editor.destroy() - this.provider.destroy() }, }