add focus extension

This commit is contained in:
Philipp Kühn
2020-08-21 17:32:47 +02:00
parent 0513fd6ce2
commit 71c3927b28
6 changed files with 112 additions and 14 deletions

View File

@@ -22,6 +22,7 @@ import Mark from './Mark'
import EventEmitter from './EventEmitter'
import ComponentRenderer from './ComponentRenderer'
// commands
import clearContent from './commands/clearContent'
import deleteSelection from './commands/deleteSelection'
import focus from './commands/focus'
@@ -37,6 +38,9 @@ import toggleMark from './commands/toggleMark'
import toggleNode from './commands/toggleNode'
import updateMark from './commands/updateMark'
// plugins
import focusPlugin from './plugins/focus'
export type Command = (next: Function, editor: Editor) => (...args: any) => any
export interface CommandSpec {
@@ -70,6 +74,8 @@ export class Editor extends EventEmitter {
injectCSS: true,
extensions: [],
}
public isFocused = false
public isEditable = true
constructor(options: Partial<EditorOptions> = {}) {
super()
@@ -175,6 +181,7 @@ export class Editor extends EventEmitter {
keymap(baseKeymap),
dropCursor(),
gapCursor(),
focusPlugin(this.proxy),
]
}