send only json steps
This commit is contained in:
@@ -18,7 +18,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import io from 'socket.io-client'
|
import io from 'socket.io-client'
|
||||||
import { Editor, EditorContent } from 'tiptap'
|
import { Editor, EditorContent } from 'tiptap'
|
||||||
import { History, Collaboration } from 'tiptap-extensions'
|
import {
|
||||||
|
HardBreak,
|
||||||
|
Heading,
|
||||||
|
Bold,
|
||||||
|
Code,
|
||||||
|
Italic,
|
||||||
|
History,
|
||||||
|
Collaboration,
|
||||||
|
} from 'tiptap-extensions'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -45,6 +53,11 @@ export default {
|
|||||||
this.editor = new Editor({
|
this.editor = new Editor({
|
||||||
content: doc,
|
content: doc,
|
||||||
extensions: [
|
extensions: [
|
||||||
|
new HardBreak(),
|
||||||
|
new Heading({ levels: [1, 2, 3] }),
|
||||||
|
new Bold(),
|
||||||
|
new Code(),
|
||||||
|
new Italic(),
|
||||||
new History(),
|
new History(),
|
||||||
new Collaboration({
|
new Collaboration({
|
||||||
// the initial version we start with
|
// the initial version we start with
|
||||||
|
|||||||
@@ -54,7 +54,11 @@ export default class Collaboration extends Extension {
|
|||||||
const sendable = sendableSteps(state)
|
const sendable = sendableSteps(state)
|
||||||
|
|
||||||
if (sendable) {
|
if (sendable) {
|
||||||
this.options.onSendable(sendable)
|
this.options.onSendable({
|
||||||
|
version: sendable.version,
|
||||||
|
steps: sendable.steps.map(step => step.toJSON()),
|
||||||
|
clientID: sendable.clientID,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}, this.options.debounce)
|
}, this.options.debounce)
|
||||||
|
|
||||||
|
|||||||
@@ -342,6 +342,13 @@ export default class Editor extends Emitter {
|
|||||||
this.view.dom.blur()
|
this.view.dom.blur()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSchemaJSON() {
|
||||||
|
return JSON.parse(JSON.stringify({
|
||||||
|
nodes: this.extensions.nodes,
|
||||||
|
marks: this.extensions.marks,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
getHTML() {
|
getHTML() {
|
||||||
const div = document.createElement('div')
|
const div = document.createElement('div')
|
||||||
const fragment = DOMSerializer
|
const fragment = DOMSerializer
|
||||||
|
|||||||
Reference in New Issue
Block a user