Skip to content

Commit 0289edf

Browse files
somusianstormtaylor
authored andcommitted
Rename mark/unmark transforms to addMark/removeMark (ianstormtaylor#113)
* Rename mark/unmark transforms to addMark/removeMark * delete gitkeep
1 parent 3dbc29d commit 0289edf

File tree

35 files changed

+63
-63
lines changed

35 files changed

+63
-63
lines changed

docs/guides/applying-custom-formatting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class App extends React.Component {
8484
case 66: {
8585
return state
8686
.transform()
87-
.mark('bold')
87+
.addMark('bold')
8888
.apply()
8989
}
9090
// When "`" is pressed, keep our existing code block logic.
@@ -160,7 +160,7 @@ class App extends React.Component {
160160
case 66: {
161161
return state
162162
.transform()
163-
.mark('bold')
163+
.addMark('bold')
164164
.apply()
165165
}
166166
case 192: {
@@ -222,7 +222,7 @@ class App extends React.Component {
222222
const isBold = state.marks.some(mark => mark.type == 'bold')
223223
return state
224224
.transform()
225-
[isBold ? 'unmark' : 'mark']('bold')
225+
[isBold ? 'removeMark' : 'addMark']('bold')
226226
.apply()
227227
}
228228
case 192: {

docs/guides/using-plugins.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class App extends React.Component {
5252
const isBold = state.marks.some(mark => mark.type == 'bold')
5353
return state
5454
.transform()
55-
[isBold ? 'unmark' : 'mark']('bold')
55+
[isBold ? 'removeMark' : 'addMark']('bold')
5656
.apply()
5757
}
5858

@@ -90,7 +90,7 @@ function MarkHotkey(options) {
9090
// Toggle the mark `type` based on whether it is active.
9191
return state
9292
.transform()
93-
[isActive ? 'unmark' : 'mark'](type)
93+
[isActive ? 'removeMark' : 'addMark'](type)
9494
.apply()
9595
}
9696
}
@@ -248,7 +248,7 @@ function MarkHotkey(options) {
248248
const isActive = state.marks.some(mark => mark.type == type)
249249
return state
250250
.transform()
251-
[isActive ? 'unmark' : 'mark'](type)
251+
[isActive ? 'removeMark' : 'addMark'](type)
252252
.apply()
253253
}
254254
}

docs/reference/models/transform.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
1717
- [`delete`](#delete)
1818
- [`insertFragment`](#insertfragment)
1919
- [`insertText`](#inserttext)
20-
- [`mark`](#mark)
20+
- [`addMark`](#addmark)
2121
- [`setBlock`](#setblock)
2222
- [`setInline`](#setinline)
2323
- [`splitBlock`](#splitblock)
2424
- [`splitInline`](#splitinline)
25-
- [`unmark`](#unmark)
25+
- [`removeMark`](#removemark)
2626
- [`unwrapBlock`](#unwrapblock)
2727
- [`unwrapInline`](#unwrapinline)
2828
- [`wrapBlock`](#wrapblock)
@@ -46,12 +46,12 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
4646
- [`deleteForwardAtRange`](#deleteforwardatrange)
4747
- [`insertFragmentAtRange`](#insertfragmentatrange)
4848
- [`insertTextAtRange`](#inserttextatrange)
49-
- [`markAtRange`](#markatrange)
49+
- [`addMarkAtRange`](#addmarkatrange)
5050
- [`setBlockAtRange`](#setblockatrange)
5151
- [`setInlineAtRange`](#setinlineatrange)
5252
- [`splitBlockAtRange`](#splitblockatrange)
5353
- [`splitInlineAtRange`](#splitinlineatrange)
54-
- [`unmarkAtRange`](#unmarkatrange)
54+
- [`removeMarkAtRange`](#removeMarkatrange)
5555
- [`unwrapBlockAtRange`](#unwrapblockatrange)
5656
- [`unwrapInlineAtRange`](#unwrapinlineatrange)
5757
- [`wrapBlockAtRange`](#wrapblockatrange)
@@ -90,9 +90,9 @@ Insert a `fragment` at the current selection. If the selection is expanded, it w
9090

9191
Insert a string of `text` at the current selection. If the selection is expanded, it will be deleted first.
9292

93-
### `mark`
94-
`mark(mark: Mark) => Transform`
95-
`mark(type: String) => Transform`
93+
### `addMark`
94+
`addMark(mark: Mark) => Transform`
95+
`addMark(type: String) => Transform`
9696

9797
Add a [`mark`](./mark.md) to the characters in the current selection. For convenience, you can pass a `type` string to implicitly create a [`Mark`](./mark.md) of that type.
9898

@@ -118,9 +118,9 @@ Split the [`Block`](./block.md) in the current selection by `depth` levels. If t
118118

119119
Split the [`Inline`](./inline.md) node in the current selection by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `Infinity`.
120120

121-
### `unmark`
122-
`unmark(mark: Mark) => Transform`
123-
`unmark(type: String) => Transform`
121+
### `removeMark`
122+
`removeMark(mark: Mark) => Transform`
123+
`removeMark(type: String) => Transform`
124124

125125
Remove a [`mark`](./mark.md) from the characters in the current selection. For convenience, you can pass a `type` string to implicitly create a [`Mark`](./mark.md) of that type.
126126

@@ -235,9 +235,9 @@ Insert a `fragment` at a `range`. If the selection is expanded, it will be delet
235235

236236
Insert a string of `text` at a `range`. If the selection is expanded, it will be deleted first.
237237

238-
### `markAtRange`
239-
`markAtRange(range: Selection, mark: Mark) => Transform`
240-
`mark(range: Selection, type: String) => Transform`
238+
### `addMarkAtRange`
239+
`addMarkAtRange(range: Selection, mark: Mark) => Transform`
240+
`addMark(range: Selection, type: String) => Transform`
241241

242242
Add a [`mark`](./mark.md) to the characters in a `range`. For convenience, you can pass a `type` string to implicitly create a [`Mark`](./mark.md) of that type.
243243

@@ -263,9 +263,9 @@ Split the [`Block`](./block.md) in a `range` by `depth` levels. If the selection
263263

264264
Split the [`Inline`](./inline.md) node in a `range` by `depth` levels. If the selection is expanded, it will be deleted first. `depth` defaults to `Infinity`.
265265

266-
### `unmarkAtRange`
267-
`unmarkAtRange(range: Selection, mark: Mark) => Transform`
268-
`unmark(range: Selection, type: String) => Transform`
266+
### `removeMarkAtRange`
267+
`removeMarkAtRange(range: Selection, mark: Mark) => Transform`
268+
`removeMark(range: Selection, type: String) => Transform`
269269

270270
Remove a [`mark`](./mark.md) from the characters in a `range`. For convenience, you can pass a `type` string to implicitly create a [`Mark`](./mark.md) of that type.
271271

examples/hovering-menu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class HoveringMenu extends React.Component {
9595

9696
state = state
9797
.transform()
98-
[isActive ? 'unmark' : 'mark'](type)
98+
[isActive ? 'removeMark' : 'addMark'](type)
9999
.apply()
100100

101101
this.setState({ state })

examples/rich-text/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class RichText extends React.Component {
133133

134134
state = state
135135
.transform()
136-
[this.hasMark(mark) ? 'unmark' : 'mark'](mark)
136+
[this.hasMark(mark) ? 'removeMark' : 'addMark'](mark)
137137
.apply()
138138

139139
e.preventDefault()
@@ -154,7 +154,7 @@ class RichText extends React.Component {
154154

155155
state = state
156156
.transform()
157-
[isActive ? 'unmark' : 'mark'](type)
157+
[isActive ? 'removeMark' : 'addMark'](type)
158158
.apply()
159159

160160
this.setState({ state })

lib/models/state.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ class State extends new Record(DEFAULTS) {
700700
* @return {State} state
701701
*/
702702

703-
mark(mark) {
703+
addMark(mark) {
704704
let state = this
705705
let { cursorMarks, document, selection } = state
706706

@@ -712,7 +712,7 @@ class State extends new Record(DEFAULTS) {
712712
return state
713713
}
714714

715-
document = document.markAtRange(selection, mark)
715+
document = document.addMarkAtRange(selection, mark)
716716
state = state.merge({ document })
717717
return state
718718
}
@@ -826,7 +826,7 @@ class State extends new Record(DEFAULTS) {
826826
* @return {State} state
827827
*/
828828

829-
unmark(mark) {
829+
removeMark(mark) {
830830
let state = this
831831
let { cursorMarks, document, selection } = state
832832

@@ -838,7 +838,7 @@ class State extends new Record(DEFAULTS) {
838838
return state
839839
}
840840

841-
document = document.unmarkAtRange(selection, mark)
841+
document = document.removeMarkAtRange(selection, mark)
842842
state = state.merge({ document })
843843
return state
844844
}

lib/models/transform.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ const DOCUMENT_TRANSFORMS = [
3232
'deleteForwardAtRange',
3333
'insertFragmentAtRange',
3434
'insertTextAtRange',
35-
'markAtRange',
35+
'addMarkAtRange',
3636
'setBlockAtRange',
3737
'setInlineAtRange',
3838
'splitBlockAtRange',
3939
'splitInlineAtRange',
40-
'unmarkAtRange',
40+
'removeMarkAtRange',
4141
'unwrapBlockAtRange',
4242
'unwrapInlineAtRange',
4343
'wrapBlockAtRange',
@@ -85,13 +85,13 @@ const STATE_TRANSFORMS = [
8585
'deleteForward',
8686
'insertFragment',
8787
'insertText',
88-
'mark',
88+
'addMark',
8989
'moveTo',
9090
'setBlock',
9191
'setInline',
9292
'splitBlock',
9393
'splitInline',
94-
'unmark',
94+
'removeMark',
9595
'unwrapBlock',
9696
'unwrapInline',
9797
'wrapBlock',

lib/models/transforms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ const Transforms = {
310310
* @return {Node} node
311311
*/
312312

313-
markAtRange(range, mark) {
313+
addMarkAtRange(range, mark) {
314314
let node = this
315315

316316
// Allow for just passing a type for convenience.
@@ -565,7 +565,7 @@ const Transforms = {
565565
* @return {Node} node
566566
*/
567567

568-
unmarkAtRange(range, mark) {
568+
removeMarkAtRange(range, mark) {
569569
let node = this
570570

571571
// Allow for just passing a type for convenience.

test/transforms/fixtures/mark-at-range/across-blocks/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export default function (state) {
1313

1414
return state
1515
.transform()
16-
.markAtRange(range, 'bold')
16+
.addMarkAtRange(range, 'bold')
1717
.apply()
1818
}

test/transforms/fixtures/mark-at-range/across-inlines/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export default function (state) {
1313

1414
return state
1515
.transform()
16-
.markAtRange(range, 'bold')
16+
.addMarkAtRange(range, 'bold')
1717
.apply()
1818
}

0 commit comments

Comments
 (0)