mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 14:59:27 +08:00
add offline support to the collaboration example
This commit is contained in:
parent
c44c30dc50
commit
81051835f4
@ -22,6 +22,7 @@
|
||||
"remark-container": "^0.1.2",
|
||||
"typescript": "^4.0.3",
|
||||
"vue-github-button": "^1.1.2",
|
||||
"y-indexeddb": "^9.0.5",
|
||||
"y-webrtc": "^10.1.6",
|
||||
"yjs": "^13.3.2"
|
||||
},
|
||||
|
@ -17,6 +17,7 @@ import Collaboration from '@tiptap/extension-collaboration'
|
||||
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
|
||||
import * as Y from 'yjs'
|
||||
import { WebrtcProvider } from 'y-webrtc'
|
||||
import { IndexeddbPersistence } from 'y-indexeddb'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -28,15 +29,20 @@ export default {
|
||||
ydoc: null,
|
||||
provider: null,
|
||||
type: null,
|
||||
indexdb: null,
|
||||
numberOfConnectedUsers: 0,
|
||||
editor: null,
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const name = 'example'
|
||||
|
||||
this.ydoc = new Y.Doc()
|
||||
this.provider = new WebrtcProvider('example', this.ydoc)
|
||||
this.provider = new WebrtcProvider(name, this.ydoc)
|
||||
this.type = this.ydoc.getXmlFragment('prosemirror')
|
||||
this.indexdb = new IndexeddbPersistence(name, this.ydoc)
|
||||
|
||||
this.provider.on('peers', ({ bcPeers, webrtcPeers }) => {
|
||||
this.numberOfConnectedUsers = bcPeers.length + webrtcPeers.length
|
||||
})
|
||||
|
@ -8617,7 +8617,7 @@ levn@~0.3.0:
|
||||
prelude-ls "~1.1.2"
|
||||
type-check "~0.3.2"
|
||||
|
||||
lib0@^0.2.28, lib0@^0.2.32, lib0@^0.2.33:
|
||||
lib0@^0.2.12, lib0@^0.2.28, lib0@^0.2.32, lib0@^0.2.33:
|
||||
version "0.2.33"
|
||||
resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.33.tgz#dd759c489d416344efe065c534bccf3ce4925d3e"
|
||||
integrity sha512-Pnm8FzjUr+aTYkEu2A20c1EfVHla8GbVX+GXn6poxx0gcmEuCs+XszjLmtEbI9xYOoI/83xVi7VOIoyHgOO87w==
|
||||
@ -14771,6 +14771,13 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
|
||||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
|
||||
|
||||
y-indexeddb@^9.0.5:
|
||||
version "9.0.5"
|
||||
resolved "https://registry.yarnpkg.com/y-indexeddb/-/y-indexeddb-9.0.5.tgz#a162526add738a456b7185a6a5626534609ee132"
|
||||
integrity sha512-40VxkqPoK2VxE1vMosS5MfwlHQOvaeLEN89dIkjh7URjZny6bDQOl4yKldaDv9ZosZgYEPyWuWTF3Z92RZ1y+A==
|
||||
dependencies:
|
||||
lib0 "^0.2.12"
|
||||
|
||||
y-prosemirror@^0.3.7:
|
||||
version "0.3.7"
|
||||
resolved "https://registry.yarnpkg.com/y-prosemirror/-/y-prosemirror-0.3.7.tgz#df929ceacb3e35c568db9f1a5a36b0515b3732fc"
|
||||
|
Loading…
Reference in New Issue
Block a user