fix menububble example
This commit is contained in:
16
packages/tiptap/src/Components/MenuBubble.js
Normal file
16
packages/tiptap/src/Components/MenuBubble.js
Normal 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,
|
||||
}))
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -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'
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user