mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-01 01:19:03 +08:00
rename removeMark to unsetMark
This commit is contained in:
parent
c0a0c7a204
commit
2c5885c026
@ -6,7 +6,7 @@ import getMarkRange from '../utils/getMarkRange'
|
||||
/**
|
||||
* Remove all marks in the current selection.
|
||||
*/
|
||||
export const removeMark = (typeOrName: string | MarkType): Command => ({ tr, state, dispatch }) => {
|
||||
export const unsetMark = (typeOrName: string | MarkType): Command => ({ tr, state, dispatch }) => {
|
||||
const { selection } = tr
|
||||
const type = getMarkType(typeOrName, state.schema)
|
||||
let { from, to } = selection
|
@ -11,7 +11,6 @@ import * as insertHTML from '../commands/insertHTML'
|
||||
import * as insertText from '../commands/insertText'
|
||||
import * as lift from '../commands/lift'
|
||||
import * as liftListItem from '../commands/liftListItem'
|
||||
import * as removeMark from '../commands/removeMark'
|
||||
import * as removeMarks from '../commands/removeMarks'
|
||||
import * as resetNodeAttributes from '../commands/resetNodeAttributes'
|
||||
import * as scrollIntoView from '../commands/scrollIntoView'
|
||||
@ -27,6 +26,7 @@ import * as toggleBlockType from '../commands/toggleBlockType'
|
||||
import * as toggleList from '../commands/toggleList'
|
||||
import * as toggleMark from '../commands/toggleMark'
|
||||
import * as toggleWrap from '../commands/toggleWrap'
|
||||
import * as unsetMark from '../commands/unsetMark'
|
||||
import * as updateNodeAttributes from '../commands/updateNodeAttributes'
|
||||
import * as wrapIn from '../commands/wrapIn'
|
||||
import * as wrapInList from '../commands/wrapInList'
|
||||
@ -46,7 +46,6 @@ export const Commands = Extension.create({
|
||||
...insertText,
|
||||
...lift,
|
||||
...liftListItem,
|
||||
...removeMark,
|
||||
...removeMarks,
|
||||
...resetNodeAttributes,
|
||||
...scrollIntoView,
|
||||
@ -62,6 +61,7 @@ export const Commands = Extension.create({
|
||||
...toggleList,
|
||||
...toggleMark,
|
||||
...toggleWrap,
|
||||
...unsetMark,
|
||||
...updateNodeAttributes,
|
||||
...wrapIn,
|
||||
...wrapInList,
|
||||
|
@ -61,7 +61,7 @@ const Bold = Mark.create({
|
||||
* Unset a bold mark
|
||||
*/
|
||||
unsetBold: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('bold')
|
||||
return commands.unsetMark('bold')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ const Code = Mark.create({
|
||||
* Unset a code mark
|
||||
*/
|
||||
unsetCode: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('code')
|
||||
return commands.unsetMark('code')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -74,7 +74,7 @@ const Highlight = Mark.create({
|
||||
* Unset a highlight mark
|
||||
*/
|
||||
unsetHighlight: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('highlight')
|
||||
return commands.unsetMark('highlight')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -60,7 +60,7 @@ const Italic = Mark.create({
|
||||
* Unset an italic mark
|
||||
*/
|
||||
unsetItalic: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('italic')
|
||||
return commands.unsetMark('italic')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ const Link = Mark.create({
|
||||
* Unset a link mark
|
||||
*/
|
||||
unsetLink: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('link')
|
||||
return commands.unsetMark('link')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -60,7 +60,7 @@ const Strike = Mark.create({
|
||||
* Unset a strike mark
|
||||
*/
|
||||
unsetStrike: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('strike')
|
||||
return commands.unsetMark('strike')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -37,7 +37,7 @@ const TextStyle = Mark.create({
|
||||
return true
|
||||
}
|
||||
|
||||
return commands.removeMark('textStyle')
|
||||
return commands.unsetMark('textStyle')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ const Underline = Mark.create({
|
||||
* Unset an underline mark
|
||||
*/
|
||||
unsetUnderline: (): Command => ({ commands }) => {
|
||||
return commands.removeMark('underline')
|
||||
return commands.unsetMark('underline')
|
||||
},
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user