some fixes

This commit is contained in:
Philipp Kühn
2020-04-21 23:48:50 +02:00
parent 91d4aa7e39
commit 023c16a4f5
6 changed files with 7 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ declare module '../Editor' {
} }
} }
export default (next: Function, editor: Editor, emitUpdate = false): ClearContent => emitUpdate => { export default (next: Function, editor: Editor): ClearContent => (emitUpdate = false) => {
editor.setContent('', emitUpdate) editor.setContent('', emitUpdate)
next() next()
} }

View File

@@ -45,7 +45,7 @@ function resolveSelection(editor: Editor, position: Position = null): ResolvedSe
} }
} }
export default (next: Function, editor: Editor, position: Position = null): Focus => async () => { export default (next: Function, editor: Editor): Focus => async (position = null) => {
const { view, state } = editor const { view, state } = editor
if ((view.hasFocus() && position === null)) { if ((view.hasFocus() && position === null)) {

View File

@@ -10,7 +10,7 @@ declare module '../Editor' {
} }
} }
export default (next: Function, editor: Editor, value: string): InsertHTML => () => { export default (next: Function, editor: Editor): InsertHTML => value => {
const { view, state } = editor const { view, state } = editor
const { selection } = state const { selection } = state
const element = elementFromString(value) const element = elementFromString(value)

View File

@@ -8,7 +8,7 @@ declare module '../Editor' {
} }
} }
export default (next: Function, editor: Editor, value: string): InsertText => () => { export default (next: Function, editor: Editor): InsertText => value => {
const { view, state } = editor const { view, state } = editor
const transaction = state.tr.insertText(value) const transaction = state.tr.insertText(value)

View File

@@ -13,7 +13,7 @@ declare module '../Editor' {
} }
} }
export default (next: Function, editor: Editor): SetContent => (content, emitUpdate, parseOptions) => { export default (next: Function, editor: Editor): SetContent => (content, emitUpdate = false, parseOptions = {}) => {
if (content === null) { if (content === null) {
next() next()
return return

View File

@@ -21,10 +21,9 @@ export default (next: Function, editor: Editor): ToggleBlockType => (type, toggl
if (isActive) { if (isActive) {
setBlockType(toggleType)(view.state, view.dispatch) setBlockType(toggleType)(view.state, view.dispatch)
next() } else {
return setBlockType(type, attrs)(view.state, view.dispatch)
} }
setBlockType(type, attrs)(view.state, view.dispatch)
next() next()
} }