mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 23:59:25 +08:00
refactoring
This commit is contained in:
parent
db54e44438
commit
2c150f5192
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -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)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user