rename removeMarks to unsetMarks

This commit is contained in:
Philipp Kühn
2020-11-18 17:43:59 +01:00
parent 2c5885c026
commit d075d5c425
8 changed files with 11 additions and 12 deletions

View File

@@ -13,7 +13,7 @@
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }"> <button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
code code
</button> </button>
<button @click="editor.chain().focus().removeMarks().run()"> <button @click="editor.chain().focus().unsetMarks().run()">
clear marks clear marks
</button> </button>
<button @click="editor.chain().focus().clearNodes().run()"> <button @click="editor.chain().focus().clearNodes().run()">

View File

@@ -13,7 +13,7 @@
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }"> <button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
code code
</button> </button>
<button @click="editor.chain().focus().removeMarks().run()"> <button @click="editor.chain().focus().unsetMarks().run()">
clear marks clear marks
</button> </button>
<button @click="editor.chain().focus().clearNodes().run()"> <button @click="editor.chain().focus().clearNodes().run()">

View File

@@ -13,7 +13,7 @@
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }"> <button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
code code
</button> </button>
<button @click="editor.chain().focus().removeMarks().run()"> <button @click="editor.chain().focus().unsetMarks().run()">
clear marks clear marks
</button> </button>
<button @click="editor.chain().focus().clearNodes().run()"> <button @click="editor.chain().focus().clearNodes().run()">

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div v-if="editor"> <div v-if="editor">
<button @click="editor.chain().focus().removeMarks().run()"> <button @click="editor.chain().focus().unsetMarks().run()">
clear formatting clear formatting
</button> </button>
<button @click="editor.chain().focus().undo().run()"> <button @click="editor.chain().focus().undo().run()">

View File

@@ -9,7 +9,7 @@ const MenuBar = () => {
return ( return (
<> <>
<button onClick={() => editor.chain().focus().removeMarks().run()}> <button onClick={() => editor.chain().focus().unsetMarks().run()}>
Clear formatting Clear formatting
</button> </button>
<button <button

View File

@@ -106,19 +106,18 @@ Have a look at all of the core commands listed below. They should give you a goo
### Nodes & Marks ### Nodes & Marks
| Command | Description | | Command | Description |
| ----------------------- | --------------------------------------------------------- | | ----------------------- | --------------------------------------------------------- |
| .addMark() | Add a mark with new attributes. |
| .clearNodes() | Normalize nodes to a simple paragraph. | | .clearNodes() | Normalize nodes to a simple paragraph. |
| .extendMarkRange() | Extends the text selection to the current mark. | | .extendMarkRange() | Extends the text selection to the current mark. |
| .removeMark() | Remove a mark in the current selection. |
| .removeMarks() | Remove all marks in the current selection. |
| .removeMarks() | Remove all marks in the current selection. |
| .resetNodeAttributes() | Resets all node attributes to the default value. | | .resetNodeAttributes() | Resets all node attributes to the default value. |
| .selectParentNode() | Select the parent node. | | .selectParentNode() | Select the parent node. |
| .setBlockType() | Replace a given range with a node. | | .setBlockType() | Replace a given range with a node. |
| .setMark() | Add a mark with new attributes. |
| .splitBlock() | Forks a new node from an existing node. | | .splitBlock() | Forks a new node from an existing node. |
| .toggleBlockType() | Toggle a node with another node. | | .toggleBlockType() | Toggle a node with another node. |
| .toggleMark() | Toggle a mark on and off. | | .toggleMark() | Toggle a mark on and off. |
| .toggleWrap() | Wraps nodes in another node, or removes an existing wrap. | | .toggleWrap() | Wraps nodes in another node, or removes an existing wrap. |
| .unsetMark() | Remove a mark in the current selection. |
| .unsetMarks() | Remove all marks in the current selection. |
| .updateNodeAttributes() | Update attributes of a node. | | .updateNodeAttributes() | Update attributes of a node. |
### Lists ### Lists

View File

@@ -3,7 +3,7 @@ import { Command } from '../types'
/** /**
* Remove all marks in the current selection. * Remove all marks in the current selection.
*/ */
export const removeMarks = (): Command => ({ tr, state, dispatch }) => { export const unsetMarks = (): Command => ({ tr, state, dispatch }) => {
const { selection } = tr const { selection } = tr
const { from, to, empty } = selection const { from, to, empty } = selection

View File

@@ -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 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'
import * as selectAll from '../commands/selectAll' import * as selectAll from '../commands/selectAll'
@@ -27,6 +26,7 @@ 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 unsetMark from '../commands/unsetMark'
import * as unsetMarks from '../commands/unsetMarks'
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,
...removeMarks,
...resetNodeAttributes, ...resetNodeAttributes,
...scrollIntoView, ...scrollIntoView,
...selectAll, ...selectAll,
@@ -62,6 +61,7 @@ export const Commands = Extension.create({
...toggleMark, ...toggleMark,
...toggleWrap, ...toggleWrap,
...unsetMark, ...unsetMark,
...unsetMarks,
...updateNodeAttributes, ...updateNodeAttributes,
...wrapIn, ...wrapIn,
...wrapInList, ...wrapInList,