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) { constructor(extensions: Extensions, editor: Editor) {
this.editor = editor this.editor = editor
this.extensions = extensions this.extensions = extensions
this.extensions.forEach(extension => { this.extensions.forEach(extension => {
const simpleConfigs = ['name', 'defaults'] const simpleConfigs = ['name', 'defaults']
@@ -35,8 +36,20 @@ export default class ExtensionManager {
: { : {
editor, editor,
options: deepmerge(extension.config.defaults, extension.usedOptions), options: deepmerge(extension.config.defaults, extension.usedOptions),
type: {}, // get type() {
name: '', // 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' const value = typeof rawValue === 'function'
? rawValue(props) ? 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> { export default class Mark<Options = {}> extends Extension<Options, MarkExtends> {
type = 'node' type = 'mark'
public schema(value: MarkExtends['schema']) { public schema(value: MarkExtends['schema']) {
this.storeConfig('schema', value, 'overwrite') this.storeConfig('schema', value, 'overwrite')

View File

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