improve command handling
This commit is contained in:
@@ -3,7 +3,7 @@ import { Command } from '../Editor'
|
||||
type BlurCommand = () => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
blur: BlurCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Command } from '../Editor'
|
||||
type ClearContentCommand = (emitUpdate?: Boolean) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
clearContent: ClearContentCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,11 @@ import { deleteSelection as originalDeleteSelection } from 'prosemirror-commands
|
||||
type DeleteSelectionCommand = () => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
deleteSelection: DeleteSelectionCommand,
|
||||
}
|
||||
}
|
||||
|
||||
// declare module '../Editor' {
|
||||
// interface Commands {
|
||||
// deleteSelection: DeleteSelectionCommand,
|
||||
// }
|
||||
// }
|
||||
|
||||
export const deleteSelection: DeleteSelectionCommand = () => ({ state, dispatch }) => {
|
||||
return originalDeleteSelection(state, dispatch)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import minMax from '../utils/minMax'
|
||||
type FocusCommand = (position?: Position) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
focus: FocusCommand
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {ReplaceStep, ReplaceAroundStep} from "prosemirror-transform"
|
||||
type InsertHTMLCommand = (value: string) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
insertHTML: InsertHTMLCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Command } from '../Editor'
|
||||
type InsertTextCommand = (value: string) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
insertText: InsertTextCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import getNodeType from '../utils/getNodeType'
|
||||
type LiftListItem = (typeOrName: string | NodeType) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
liftListItem: LiftListItem,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import getMarkRange from '../utils/getMarkRange'
|
||||
type RemoveMarkCommand = (typeOrName: string | MarkType) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
toggleMark: RemoveMarkCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Command } from '../Editor'
|
||||
type RemoveMarksCommand = () => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
removeMarks: RemoveMarksCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ type ReplaceWithNodeCommand = (
|
||||
) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
replaceText: ReplaceWithNodeCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { selectAll as originalSelectAll } from 'prosemirror-commands'
|
||||
type SelectAllCommand = () => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
selectAll: SelectAllCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { selectParentNode as originalSelectParentNode } from 'prosemirror-comman
|
||||
type SelectParentNodeCommand = () => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
selectParentNode: SelectParentNodeCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ type SetContentCommand = (
|
||||
) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
setContent: SetContentCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import getNodeType from '../utils/getNodeType'
|
||||
type SinkListItem = (typeOrName: string | NodeType) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
sinkListItem: SinkListItem,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import getNodeType from '../utils/getNodeType'
|
||||
type SplitListItem = (typeOrName: string | NodeType) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
splitListItem: SplitListItem,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import getMarkType from '../utils/getMarkType'
|
||||
type ToggleMarkCommand = (typeOrName: string | MarkType) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
toggleMark: ToggleMarkCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ type ToggleNodeCommand = (
|
||||
) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
toggleNode: ToggleNodeCommand,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ type UpdateMarkCommand = (
|
||||
) => Command
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
interface Commands {
|
||||
updateMark: UpdateMarkCommand,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user