refactoring

This commit is contained in:
Philipp Kühn 2020-10-27 12:37:00 +01:00
parent db54e44438
commit 2c150f5192
6 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import { deleteSelection as originalDeleteSelection } from 'prosemirror-commands' import { deleteSelection } from 'prosemirror-commands'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
@ -6,7 +6,7 @@ export const DeleteSelection = createExtension({
addCommands() { addCommands() {
return { return {
deleteSelection: (): Command => ({ state, dispatch }) => { deleteSelection: (): Command => ({ state, dispatch }) => {
return originalDeleteSelection(state, dispatch) return deleteSelection(state, dispatch)
}, },
} }
}, },

View File

@ -1,4 +1,4 @@
import { liftListItem as originalLiftListItem } from 'prosemirror-schema-list' import { liftListItem } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model' import { NodeType } from 'prosemirror-model'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
@ -10,7 +10,7 @@ export const LiftListItem = createExtension({
liftListItem: (typeOrName: string | NodeType): Command => ({ state, dispatch }) => { liftListItem: (typeOrName: string | NodeType): Command => ({ state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema) const type = getNodeType(typeOrName, state.schema)
return originalLiftListItem(type)(state, dispatch) return liftListItem(type)(state, dispatch)
}, },
} }
}, },

View File

@ -1,4 +1,4 @@
import { selectAll as originalSelectAll } from 'prosemirror-commands' import { selectAll } from 'prosemirror-commands'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
@ -6,7 +6,7 @@ export const SelectAll = createExtension({
addCommands() { addCommands() {
return { return {
selectAll: (): Command => ({ state, dispatch }) => { selectAll: (): Command => ({ state, dispatch }) => {
return originalSelectAll(state, dispatch) return selectAll(state, dispatch)
}, },
} }
}, },

View File

@ -1,4 +1,4 @@
import { selectParentNode as originalSelectParentNode } from 'prosemirror-commands' import { selectParentNode } from 'prosemirror-commands'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
@ -6,7 +6,7 @@ export const SelectParentNode = createExtension({
addCommands() { addCommands() {
return { return {
selectParentNode: (): Command => ({ state, dispatch }) => { selectParentNode: (): Command => ({ state, dispatch }) => {
return originalSelectParentNode(state, dispatch) return selectParentNode(state, dispatch)
}, },
} }
}, },

View File

@ -1,5 +1,5 @@
import { NodeType } from 'prosemirror-model' import { NodeType } from 'prosemirror-model'
import { setBlockType as originalSetBlockType } from 'prosemirror-commands' import { setBlockType } from 'prosemirror-commands'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
import getNodeType from '../utils/getNodeType' import getNodeType from '../utils/getNodeType'
@ -10,7 +10,7 @@ export const SetBlockType = createExtension({
setBlockType: (typeOrName: string | NodeType, attrs = {}): Command => ({ state, dispatch }) => { setBlockType: (typeOrName: string | NodeType, attrs = {}): Command => ({ state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema) const type = getNodeType(typeOrName, state.schema)
return originalSetBlockType(type, attrs)(state, dispatch) return setBlockType(type, attrs)(state, dispatch)
}, },
} }
}, },

View File

@ -1,4 +1,4 @@
import { splitListItem as originalSplitListItem } from 'prosemirror-schema-list' import { splitListItem } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model' import { NodeType } from 'prosemirror-model'
import { Command } from '../Editor' import { Command } from '../Editor'
import { createExtension } from '../Extension' import { createExtension } from '../Extension'
@ -10,7 +10,7 @@ export const SplitListItem = createExtension({
splitListItem: (typeOrName: string | NodeType): Command => ({ state, dispatch }) => { splitListItem: (typeOrName: string | NodeType): Command => ({ state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema) const type = getNodeType(typeOrName, state.schema)
return originalSplitListItem(type)(state, dispatch) return splitListItem(type)(state, dispatch)
}, },
} }
}, },