fix splitlistitem
This commit is contained in:
@@ -79,8 +79,6 @@ export class Editor extends EventEmitter {
|
||||
private extensionManager!: ExtensionManager
|
||||
private commands: { [key: string]: any } = {}
|
||||
private css!: HTMLStyleElement
|
||||
private lastCommand = Promise.resolve()
|
||||
public lastCommandValue: any = undefined
|
||||
public schema!: Schema
|
||||
public view!: EditorView
|
||||
public selection = { from: 0, to: 0 }
|
||||
@@ -295,33 +293,8 @@ export class Editor extends EventEmitter {
|
||||
throw new Error(`tiptap: '${name}' is a protected name.`)
|
||||
}
|
||||
|
||||
// this.commands[name] = this.chainCommand((...args: any) => {
|
||||
// // console.log('command', this.lastCommandValue)
|
||||
// const commandValue = callback(() => {}, this.proxy)(...args)
|
||||
|
||||
// // if (commandValue !== undefined) {
|
||||
// this.lastCommandValue = commandValue
|
||||
// // }
|
||||
|
||||
// return this.proxy
|
||||
// })
|
||||
|
||||
|
||||
// this.commands[name] = (...args: any) => {
|
||||
// const tr = this.state.tr
|
||||
// callback(...args)({ editor: this.proxy, tr })
|
||||
// this.view.dispatch(tr)
|
||||
// }
|
||||
|
||||
this.commands[name] = callback
|
||||
|
||||
// // if (commandValue !== undefined) {
|
||||
// this.lastCommandValue = commandValue
|
||||
// // }
|
||||
|
||||
// return this.proxy
|
||||
// })
|
||||
|
||||
return this.proxy
|
||||
}
|
||||
|
||||
@@ -335,27 +308,6 @@ export class Editor extends EventEmitter {
|
||||
return this.commands[name](...options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a command to make it chainable.
|
||||
*
|
||||
* @param method
|
||||
*/
|
||||
private chainCommand = (method: Function) => (...args: any) => {
|
||||
// console.log('chain', this.lastCommandValue)
|
||||
// this.lastCommand = this.lastCommand
|
||||
// .then(() => {
|
||||
|
||||
// const jo = method.apply(this, args)
|
||||
|
||||
// console.log({jo})
|
||||
// })
|
||||
// // .then(method.apply(this, args))
|
||||
// .catch(console.error)
|
||||
method.apply(this, args)
|
||||
|
||||
return this.proxy
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a ProseMirror plugin.
|
||||
*
|
||||
|
||||
@@ -94,18 +94,7 @@ export default class ExtensionManager {
|
||||
return collect(this.extensions)
|
||||
.map(extension => extension.config.keys)
|
||||
.filter(keys => keys)
|
||||
.map(keys => {
|
||||
const values = Object.entries(keys).map(([key, action]) => {
|
||||
return [key, () => {
|
||||
this.editor.lastCommandValue = undefined
|
||||
// @ts-ignore
|
||||
const bla = action().lastCommandValue
|
||||
// console.log({bla})
|
||||
return bla
|
||||
}]
|
||||
})
|
||||
return keymap(Object.fromEntries(values))
|
||||
})
|
||||
.map(keys => keymap(keys))
|
||||
.toArray()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user