fix menububble example

This commit is contained in:
Philipp Kühn
2018-10-22 17:40:55 +02:00
parent 9ec3d82d12
commit 3718591d33
4 changed files with 95 additions and 63 deletions

View File

@@ -0,0 +1,16 @@
export default {
props: {
editor: {
default: null,
type: Object,
},
},
render(createElement) {
if (this.editor) {
return createElement('div', this.$scopedSlots.default({
nodes: this.editor.menuActions.nodes,
marks: this.editor.menuActions.marks,
}))
}
},
}

View File

@@ -1,6 +1,7 @@
export { default as Editor } from './Utils/Editor'
export { default as EditorContent } from './Components/EditorContent'
export { default as MenuBar } from './Components/MenuBar'
export { default as MenuBubble } from './Components/MenuBubble'
export { default as Extension } from './Utils/Extension'
export { default as Node } from './Utils/Node'

View File

@@ -21,10 +21,21 @@ import builtInNodes from '../Nodes'
export default class Editor {
constructor(options = {}) {
const defaultOptions = {
content: '',
on: {
update: () => {},
},
}
this.element = document.createElement('div')
this.bus = new Vue()
this.options = options
this.options = {
...defaultOptions,
...options,
}
this.extensions = this.createExtensions()
this.nodes = this.createNodes()
this.marks = this.createMarks()
@@ -171,12 +182,11 @@ export default class Editor {
}
emitUpdate() {
console.log(this.getHTML())
// this.$emit('update', {
// getHTML: this.getHTML,
// getJSON: this.getJSON,
// state: this.state,
// })
this.emit('update', {
getHTML: this.getHTML,
getJSON: this.getJSON,
state: this.state,
})
}
getHTML() {