rename removeMark to unsetMark
This commit is contained in:
@@ -6,7 +6,7 @@ import getMarkRange from '../utils/getMarkRange'
|
|||||||
/**
|
/**
|
||||||
* Remove all marks in the current selection.
|
* 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 { selection } = tr
|
||||||
const type = getMarkType(typeOrName, state.schema)
|
const type = getMarkType(typeOrName, state.schema)
|
||||||
let { from, to } = selection
|
let { from, to } = selection
|
||||||
@@ -11,7 +11,6 @@ import * as insertHTML from '../commands/insertHTML'
|
|||||||
import * as insertText from '../commands/insertText'
|
import * as insertText from '../commands/insertText'
|
||||||
import * as lift from '../commands/lift'
|
import * as lift from '../commands/lift'
|
||||||
import * as liftListItem from '../commands/liftListItem'
|
import * as liftListItem from '../commands/liftListItem'
|
||||||
import * as removeMark from '../commands/removeMark'
|
|
||||||
import * as removeMarks from '../commands/removeMarks'
|
import * as removeMarks from '../commands/removeMarks'
|
||||||
import * as resetNodeAttributes from '../commands/resetNodeAttributes'
|
import * as resetNodeAttributes from '../commands/resetNodeAttributes'
|
||||||
import * as scrollIntoView from '../commands/scrollIntoView'
|
import * as scrollIntoView from '../commands/scrollIntoView'
|
||||||
@@ -27,6 +26,7 @@ import * as toggleBlockType from '../commands/toggleBlockType'
|
|||||||
import * as toggleList from '../commands/toggleList'
|
import * as toggleList from '../commands/toggleList'
|
||||||
import * as toggleMark from '../commands/toggleMark'
|
import * as toggleMark from '../commands/toggleMark'
|
||||||
import * as toggleWrap from '../commands/toggleWrap'
|
import * as toggleWrap from '../commands/toggleWrap'
|
||||||
|
import * as unsetMark from '../commands/unsetMark'
|
||||||
import * as updateNodeAttributes from '../commands/updateNodeAttributes'
|
import * as updateNodeAttributes from '../commands/updateNodeAttributes'
|
||||||
import * as wrapIn from '../commands/wrapIn'
|
import * as wrapIn from '../commands/wrapIn'
|
||||||
import * as wrapInList from '../commands/wrapInList'
|
import * as wrapInList from '../commands/wrapInList'
|
||||||
@@ -46,7 +46,6 @@ export const Commands = Extension.create({
|
|||||||
...insertText,
|
...insertText,
|
||||||
...lift,
|
...lift,
|
||||||
...liftListItem,
|
...liftListItem,
|
||||||
...removeMark,
|
|
||||||
...removeMarks,
|
...removeMarks,
|
||||||
...resetNodeAttributes,
|
...resetNodeAttributes,
|
||||||
...scrollIntoView,
|
...scrollIntoView,
|
||||||
@@ -62,6 +61,7 @@ export const Commands = Extension.create({
|
|||||||
...toggleList,
|
...toggleList,
|
||||||
...toggleMark,
|
...toggleMark,
|
||||||
...toggleWrap,
|
...toggleWrap,
|
||||||
|
...unsetMark,
|
||||||
...updateNodeAttributes,
|
...updateNodeAttributes,
|
||||||
...wrapIn,
|
...wrapIn,
|
||||||
...wrapInList,
|
...wrapInList,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const Bold = Mark.create({
|
|||||||
* Unset a bold mark
|
* Unset a bold mark
|
||||||
*/
|
*/
|
||||||
unsetBold: (): Command => ({ commands }) => {
|
unsetBold: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('bold')
|
return commands.unsetMark('bold')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const Code = Mark.create({
|
|||||||
* Unset a code mark
|
* Unset a code mark
|
||||||
*/
|
*/
|
||||||
unsetCode: (): Command => ({ commands }) => {
|
unsetCode: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('code')
|
return commands.unsetMark('code')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const Highlight = Mark.create({
|
|||||||
* Unset a highlight mark
|
* Unset a highlight mark
|
||||||
*/
|
*/
|
||||||
unsetHighlight: (): Command => ({ commands }) => {
|
unsetHighlight: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('highlight')
|
return commands.unsetMark('highlight')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const Italic = Mark.create({
|
|||||||
* Unset an italic mark
|
* Unset an italic mark
|
||||||
*/
|
*/
|
||||||
unsetItalic: (): Command => ({ commands }) => {
|
unsetItalic: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('italic')
|
return commands.unsetMark('italic')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const Link = Mark.create({
|
|||||||
* Unset a link mark
|
* Unset a link mark
|
||||||
*/
|
*/
|
||||||
unsetLink: (): Command => ({ commands }) => {
|
unsetLink: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('link')
|
return commands.unsetMark('link')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const Strike = Mark.create({
|
|||||||
* Unset a strike mark
|
* Unset a strike mark
|
||||||
*/
|
*/
|
||||||
unsetStrike: (): Command => ({ commands }) => {
|
unsetStrike: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('strike')
|
return commands.unsetMark('strike')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const TextStyle = Mark.create({
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return commands.removeMark('textStyle')
|
return commands.unsetMark('textStyle')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const Underline = Mark.create({
|
|||||||
* Unset an underline mark
|
* Unset an underline mark
|
||||||
*/
|
*/
|
||||||
unsetUnderline: (): Command => ({ commands }) => {
|
unsetUnderline: (): Command => ({ commands }) => {
|
||||||
return commands.removeMark('underline')
|
return commands.unsetMark('underline')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user