Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function mtodoc () {
self.content.editor = defaultMarkdownParser.parse(area.value)
self.content.markdown = area.value
self.$emit('_content-change-markdown')
}
// emulate v-model
'setupProseMirror': function (content, editor) {
const self = this
this.view = new MenuBarEditorView(editor, {
state: EditorState.create({
doc: defaultMarkdownParser.parse(content),
plugins: exampleSetup({schema})
}),
onAction: (action) => {
self.$emit('_content-change-editor', action)
self.content.editor = this.view.editor.state.doc
self.content.markdown = defaultMarkdownSerializer.serialize(this.view.editor.state.doc)
}
})
this.view.editor.focus()
},
'bindTextarea': function (area) {
this.$on('_content-change-markdown', () => {
if (this.mode === 'all') {
const state = EditorState.create({
doc: defaultMarkdownParser.parse(this.content.markdown),
plugins: exampleSetup({schema})
})
this.view.editor.updateState(state)
}
this.$emit('content-change-markdown')
})
constructor(target, content) {
this.view = new EditorView(target, {
state: EditorState.create({
doc: defaultMarkdownParser.parse(content),
plugins: exampleSetup({schema})
})
})
}
start (value = '') {
this.value = value
this.state = EditorState.create({
doc: defaultMarkdownParser.parse(value),
plugins: exampleSetup({schema})
})
this.view = new EditorView(this.node, {
state: this.state,
dispatchTransaction: (txn) => {
let nextState = this.view.state.apply(txn)
this.view.updateState(nextState)
this.dchanged(txn)
}
})
}