add content to the collaboration extension page
This commit is contained in:
5
docs/src/demos/Extensions/Collaboration/index.spec.js
Normal file
5
docs/src/demos/Extensions/Collaboration/index.spec.js
Normal file
@@ -0,0 +1,5 @@
|
||||
context('/api/extensions/collaboration', () => {
|
||||
before(() => {
|
||||
cy.visit('/api/extensions/collaboration')
|
||||
})
|
||||
})
|
||||
56
docs/src/demos/Extensions/Collaboration/index.vue
Normal file
56
docs/src/demos/Extensions/Collaboration/index.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<editor-content :editor="editor" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Editor, EditorContent } from '@tiptap/vue-starter-kit'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
import Collaboration from '@tiptap/extension-collaboration'
|
||||
import * as Y from 'yjs'
|
||||
import { WebrtcProvider } from 'y-webrtc'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
EditorContent,
|
||||
},
|
||||
|
||||
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')
|
||||
|
||||
this.editor = new Editor({
|
||||
// TODO: This is added by every new user.
|
||||
// content: `
|
||||
// <p>Example Text</p>
|
||||
// `,
|
||||
extensions: [
|
||||
Document(),
|
||||
Paragraph(),
|
||||
Text(),
|
||||
Collaboration({
|
||||
provider: this.provider,
|
||||
type: this.type,
|
||||
}),
|
||||
],
|
||||
})
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.editor.destroy()
|
||||
this.provider.destroy()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,2 +1,29 @@
|
||||
# Collaboration
|
||||
Enables you to collaborate with others on one document.
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
# With npm
|
||||
npm install @tiptap/extension-collaboration yjs y-webrtc
|
||||
|
||||
# Or: With Yarn
|
||||
yarn add @tiptap/extension-collaboration yjs y-webrtc
|
||||
```
|
||||
|
||||
## Settings
|
||||
| Option | Type | Default | Description |
|
||||
| -------- | ---- | ------- | ----------- |
|
||||
| provider | | | |
|
||||
| type | | | |
|
||||
|
||||
## Commands
|
||||
*None*
|
||||
|
||||
## Keyboard shortcuts
|
||||
*None*
|
||||
|
||||
## Source code
|
||||
[packages/extension-collaboration/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-collaboration/)
|
||||
|
||||
## Usage
|
||||
<demo name="Extensions/Collaboration" highlight="" />
|
||||
|
||||
Reference in New Issue
Block a user