refactoring
This commit is contained in:
@@ -11,8 +11,6 @@ import { markIsActive, nodeIsActive, getMarkAttrs } from 'tiptap-utils'
|
|||||||
import {
|
import {
|
||||||
ExtensionManager,
|
ExtensionManager,
|
||||||
initNodeViews,
|
initNodeViews,
|
||||||
// menuBubble,
|
|
||||||
// floatingMenu,
|
|
||||||
builtInKeymap,
|
builtInKeymap,
|
||||||
} from '.'
|
} from '.'
|
||||||
|
|
||||||
@@ -112,38 +110,22 @@ export default class Editor {
|
|||||||
doc: this.createDocument(this.options.content),
|
doc: this.createDocument(this.options.content),
|
||||||
plugins: [
|
plugins: [
|
||||||
...this.plugins,
|
...this.plugins,
|
||||||
...this.getPlugins(),
|
inputRules({
|
||||||
|
rules: this.inputRules,
|
||||||
|
}),
|
||||||
|
...this.keymaps,
|
||||||
|
keymap(builtInKeymap),
|
||||||
|
keymap(baseKeymap),
|
||||||
|
gapCursor(),
|
||||||
|
new Plugin({
|
||||||
|
props: {
|
||||||
|
editable: () => this.options.editable,
|
||||||
|
},
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlugins() {
|
|
||||||
const plugins = [
|
|
||||||
inputRules({
|
|
||||||
rules: this.inputRules,
|
|
||||||
}),
|
|
||||||
...this.keymaps,
|
|
||||||
keymap(builtInKeymap),
|
|
||||||
keymap(baseKeymap),
|
|
||||||
gapCursor(),
|
|
||||||
new Plugin({
|
|
||||||
props: {
|
|
||||||
editable: () => this.options.editable,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
|
|
||||||
// if (this.menububbleNode) {
|
|
||||||
// plugins.push(menuBubble(this.menububbleNode))
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.floatingMenuNode) {
|
|
||||||
// plugins.push(floatingMenu(this.floatingMenuNode))
|
|
||||||
// }
|
|
||||||
|
|
||||||
return plugins
|
|
||||||
}
|
|
||||||
|
|
||||||
createDocument(content) {
|
createDocument(content) {
|
||||||
if (typeof content === 'object') {
|
if (typeof content === 'object') {
|
||||||
return this.schema.nodeFromJSON(content)
|
return this.schema.nodeFromJSON(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user