fix a bug

This commit is contained in:
Philipp Kühn
2020-09-09 11:23:24 +02:00
parent a812dd47be
commit 22109170b3
3 changed files with 17 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ export default class ExtensionManager {
constructor(extensions: Extensions, editor: Editor) {
this.editor = editor
this.extensions = extensions
this.extensions.forEach(extension => {
const simpleConfigs = ['name', 'defaults']
@@ -35,8 +36,20 @@ export default class ExtensionManager {
: {
editor,
options: deepmerge(extension.config.defaults, extension.usedOptions),
type: {},
name: '',
// get type() {
// console.log('called', editor.schema)
// if (!editor.schema) {
// return
// }
// if (extension.type === 'node') {
// return editor.schema.nodes[extension.config.name]
// }
// return editor.schema.marks[extension.config.name]
// },
name: extension.config.name,
}
const value = typeof rawValue === 'function'
? rawValue(props)

View File

@@ -28,7 +28,7 @@ export interface MarkExtends<Callback = MarkCallback> extends ExtensionExtends<C
}
export default class Mark<Options = {}> extends Extension<Options, MarkExtends> {
type = 'node'
type = 'mark'
public schema(value: MarkExtends['schema']) {
this.storeConfig('schema', value, 'overwrite')

View File

@@ -25,7 +25,7 @@ export default new Mark()
],
toDOM: () => ['strong', 0],
}))
.commands(({ editor, name }) => ({
.commands(({ editor, name, type }) => ({
bold: next => () => {
editor.toggleMark(name)
next()