Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 0112fd1

Browse files
committed
Changed: Renamed 'marker' option to 'yellowMarker'.
1 parent 3e2d2cd commit 0112fd1

10 files changed

+63
-61
lines changed

docs/features/highlight.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The {@link module:highlight/highlight~Highlight} plugin registers:
112112
The `value` corresponds to the `model` property in configuration object. For the default configuration:
113113
```js
114114
highlight.options = [
115-
{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
115+
{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow Marker', color: '#fdfd77', type: 'marker' },
116116
{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
117117
{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
118118
{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },
@@ -122,7 +122,7 @@ The {@link module:highlight/highlight~Highlight} plugin registers:
122122
```
123123

124124
the `highlight` command will accept the corresponding strings as values:
125-
- `'marker'` – available as a `'highlight:marker'` button,
125+
- `'yellowMarker'` – available as a `'highlight:yellowMarker'` button,
126126
- `'greenMarker'` – available as a `'highlight:greenMarker'` button,
127127
- `'pinkMarker'` – available as a `'highlight:pinkMarker'` button,
128128
- `'blueMarker'` – available as a `'highlight:blueMarker'` button,

src/highlightediting.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class HighlightEditing extends Plugin {
2828

2929
editor.config.define( 'highlight', {
3030
options: [
31-
{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
31+
{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow marker', color: '#fdfd77', type: 'marker' },
3232
{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
3333
{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
3434
{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },

src/highlightui.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class HighlightUI extends Plugin {
4747
* The following localized titles corresponding with default
4848
* {@link module:highlight/highlight~HighlightConfig#options} are available:
4949
*
50-
* * `'Marker'`,
50+
* * `'Yellow marker'`,
5151
* * `'Green marker'`,
5252
* * `'Pink marker'`,
5353
* * `'Blue marker'`,
@@ -61,7 +61,7 @@ export default class HighlightUI extends Plugin {
6161
const t = this.editor.t;
6262

6363
return {
64-
'Marker': t( 'Marker' ),
64+
'Yellow marker': t( 'Yellow marker' ),
6565
'Green marker': t( 'Green marker' ),
6666
'Pink marker': t( 'Pink marker' ),
6767
'Blue marker': t( 'Blue marker' ),

tests/highlightcommand.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ describe( 'HighlightCommand', () => {
4646

4747
describe( 'value', () => {
4848
it( 'is set to highlight attribute value when selection is in text with highlight attribute', () => {
49-
setData( model, '<p><$text highlight="marker">fo[o]</$text></p>' );
49+
setData( model, '<p><$text highlight="yellowMarker">fo[o]</$text></p>' );
5050

51-
expect( command ).to.have.property( 'value', 'marker' );
51+
expect( command ).to.have.property( 'value', 'yellowMarker' );
5252
} );
5353

5454
it( 'is undefined when selection is not in text with highlight attribute', () => {
@@ -79,9 +79,9 @@ describe( 'HighlightCommand', () => {
7979
describe( 'with option.value set', () => {
8080
describe( 'on collapsed range', () => {
8181
it( 'should change entire highlight when inside highlighted text', () => {
82-
setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
82+
setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
8383

84-
expect( command.value ).to.equal( 'marker' );
84+
expect( command.value ).to.equal( 'yellowMarker' );
8585

8686
command.execute( { value: 'greenMarker' } );
8787

@@ -91,19 +91,19 @@ describe( 'HighlightCommand', () => {
9191
} );
9292

9393
it( 'should remove entire highlight when inside highlighted text of the same value', () => {
94-
setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
94+
setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
9595

96-
expect( command.value ).to.equal( 'marker' );
96+
expect( command.value ).to.equal( 'yellowMarker' );
9797

98-
command.execute( { value: 'marker' } );
98+
command.execute( { value: 'yellowMarker' } );
9999

100100
expect( getData( model ) ).to.equal( '<p>abcfoo[]barxyz</p>' );
101101

102102
expect( command.value ).to.be.undefined;
103103
} );
104104

105105
it( 'should change selection attribute in non-empty parent', () => {
106-
setData( model, '<p>a[]bc<$text highlight="marker">foobar</$text>xyz</p>' );
106+
setData( model, '<p>a[]bc<$text highlight="yellowMarker">foobar</$text>xyz</p>' );
107107
expect( command.value ).to.be.undefined;
108108

109109
command.execute( { value: 'foo' } );
@@ -124,7 +124,7 @@ describe( 'HighlightCommand', () => {
124124
} );
125125

126126
it( 'should not store attribute change on selection if selection is collapsed in non-empty parent', () => {
127-
setData( model, '<p>a[]bc<$text highlight="marker">foobar</$text>xyz</p>' );
127+
setData( model, '<p>a[]bc<$text highlight="yellowMarker">foobar</$text>xyz</p>' );
128128

129129
command.execute( { value: 'foo' } );
130130

@@ -142,7 +142,7 @@ describe( 'HighlightCommand', () => {
142142
} );
143143

144144
it( 'should change selection attribute and store it if selection is collapsed in empty parent', () => {
145-
setData( model, '<p>abc<$text highlight="marker">foobar</$text>xyz</p><p>[]</p>' );
145+
setData( model, '<p>abc<$text highlight="yellowMarker">foobar</$text>xyz</p><p>[]</p>' );
146146

147147
expect( command.value ).to.be.undefined;
148148

@@ -176,15 +176,15 @@ describe( 'HighlightCommand', () => {
176176

177177
describe( 'on not collapsed range', () => {
178178
it( 'should set highlight attribute on selected node when passed as parameter', () => {
179-
setData( model, '<p>a[bc<$text highlight="marker">fo]obar</$text>xyz</p>' );
179+
setData( model, '<p>a[bc<$text highlight="yellowMarker">fo]obar</$text>xyz</p>' );
180180

181181
expect( command.value ).to.be.undefined;
182182

183-
command.execute( { value: 'marker' } );
183+
command.execute( { value: 'yellowMarker' } );
184184

185-
expect( command.value ).to.equal( 'marker' );
185+
expect( command.value ).to.equal( 'yellowMarker' );
186186

187-
expect( getData( model ) ).to.equal( '<p>a[<$text highlight="marker">bcfo]obar</$text>xyz</p>' );
187+
expect( getData( model ) ).to.equal( '<p>a[<$text highlight="yellowMarker">bcfo]obar</$text>xyz</p>' );
188188
} );
189189

190190
it( 'should set highlight attribute on selected node when passed as parameter (multiple nodes)', () => {
@@ -195,26 +195,26 @@ describe( 'HighlightCommand', () => {
195195
'<p>barbar]bar</p>'
196196
);
197197

198-
command.execute( { value: 'marker' } );
198+
command.execute( { value: 'yellowMarker' } );
199199

200-
expect( command.value ).to.equal( 'marker' );
200+
expect( command.value ).to.equal( 'yellowMarker' );
201201

202202
expect( getData( model ) ).to.equal(
203-
'<p>abcabc[<$text highlight="marker">abc</$text></p>' +
204-
'<p><$text highlight="marker">foofoofoo</$text></p>' +
205-
'<p><$text highlight="marker">barbar</$text>]bar</p>'
203+
'<p>abcabc[<$text highlight="yellowMarker">abc</$text></p>' +
204+
'<p><$text highlight="yellowMarker">foofoofoo</$text></p>' +
205+
'<p><$text highlight="yellowMarker">barbar</$text>]bar</p>'
206206
);
207207
} );
208208

209209
it( 'should set highlight attribute on selected nodes when passed as parameter only on selected characters', () => {
210-
setData( model, '<p>abc[<$text highlight="marker">foo]bar</$text>xyz</p>' );
210+
setData( model, '<p>abc[<$text highlight="yellowMarker">foo]bar</$text>xyz</p>' );
211211

212-
expect( command.value ).to.equal( 'marker' );
212+
expect( command.value ).to.equal( 'yellowMarker' );
213213

214214
command.execute( { value: 'foo' } );
215215

216216
expect( getData( model ) ).to.equal(
217-
'<p>abc[<$text highlight="foo">foo</$text>]<$text highlight="marker">bar</$text>xyz</p>'
217+
'<p>abc[<$text highlight="foo">foo</$text>]<$text highlight="yellowMarker">bar</$text>xyz</p>'
218218
);
219219

220220
expect( command.value ).to.equal( 'foo' );
@@ -225,9 +225,9 @@ describe( 'HighlightCommand', () => {
225225
describe( 'with undefined option.value', () => {
226226
describe( 'on collapsed range', () => {
227227
it( 'should remove entire highlight when inside highlighted text', () => {
228-
setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
228+
setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
229229

230-
expect( command.value ).to.equal( 'marker' );
230+
expect( command.value ).to.equal( 'yellowMarker' );
231231

232232
command.execute();
233233

@@ -239,13 +239,13 @@ describe( 'HighlightCommand', () => {
239239

240240
describe( 'on not collapsed range', () => {
241241
it( 'should remove highlight attribute on selected node when undefined passed as parameter', () => {
242-
setData( model, '<p>abc[<$text highlight="marker">foo]bar</$text>xyz</p>' );
242+
setData( model, '<p>abc[<$text highlight="yellowMarker">foo]bar</$text>xyz</p>' );
243243

244-
expect( command.value ).to.equal( 'marker' );
244+
expect( command.value ).to.equal( 'yellowMarker' );
245245

246246
command.execute();
247247

248-
expect( getData( model ) ).to.equal( '<p>abc[foo]<$text highlight="marker">bar</$text>xyz</p>' );
248+
expect( getData( model ) ).to.equal( '<p>abc[foo]<$text highlight="yellowMarker">bar</$text>xyz</p>' );
249249

250250
expect( command.value ).to.be.undefined;
251251
} );

tests/highlightediting.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ describe( 'HighlightEditing', () => {
4343

4444
describe( 'data pipeline conversions', () => {
4545
it( 'should convert defined marker classes', () => {
46-
const data = '<p>f<mark class="marker">o</mark>o</p>';
46+
const data = '<p>f<mark class="marker-yellow">o</mark>o</p>';
4747
editor.setData( data );
4848

49-
expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="marker">o</$text>o</paragraph>' );
49+
expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
5050
expect( editor.getData() ).to.equal( data );
5151
} );
5252

5353
it( 'should convert only one defined marker classes', () => {
54-
editor.setData( '<p>f<mark class="marker-green marker">o</mark>o</p>' );
54+
editor.setData( '<p>f<mark class="marker-green marker-yellow">o</mark>o</p>' );
5555

56-
expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="marker">o</$text>o</paragraph>' );
57-
expect( editor.getData() ).to.equal( '<p>f<mark class="marker">o</mark>o</p>' );
56+
expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
57+
expect( editor.getData() ).to.equal( '<p>f<mark class="marker-yellow">o</mark>o</p>' );
5858
} );
5959

6060
it( 'should not convert undefined marker classes', () => {
@@ -74,9 +74,9 @@ describe( 'HighlightEditing', () => {
7474

7575
describe( 'editing pipeline conversion', () => {
7676
it( 'should convert mark element with defined class', () => {
77-
setModelData( model, '<paragraph>f<$text highlight="marker">o</$text>o</paragraph>' );
77+
setModelData( model, '<paragraph>f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
7878

79-
expect( editor.getData() ).to.equal( '<p>f<mark class="marker">o</mark>o</p>' );
79+
expect( editor.getData() ).to.equal( '<p>f<mark class="marker-yellow">o</mark>o</p>' );
8080
} );
8181
} );
8282

@@ -85,7 +85,7 @@ describe( 'HighlightEditing', () => {
8585
it( 'should be set', () => {
8686
expect( editor.config.get( 'highlight' ) ).to.deep.equal( {
8787
options: [
88-
{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
88+
{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow marker', color: '#fdfd77', type: 'marker' },
8989
{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
9090
{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
9191
{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },

tests/highlightui.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe( 'HighlightUI', () => {
2424
before( () => {
2525
addTranslations( 'en', {
2626
'Highlight': 'Highlight',
27-
'Marker': 'Marker',
27+
'Yellow marker': 'Yellow marker',
2828
'Green marker': 'Green marker',
2929
'Pink marker': 'Pink marker',
3030
'Red pen': 'Red pen',
@@ -34,7 +34,7 @@ describe( 'HighlightUI', () => {
3434

3535
addTranslations( 'pl', {
3636
'Highlight': 'Zakreślacz',
37-
'Marker': 'Marker',
37+
'Yellow marker': 'Żółty marker',
3838
'Green marker': 'Zielony marker',
3939
'Pink marker': 'Różowy marker',
4040
'Blue marker': 'Niebieski marker',
@@ -147,7 +147,7 @@ describe( 'HighlightUI', () => {
147147
} );
148148

149149
it( 'should change button on execute option', () => {
150-
command.value = 'marker';
150+
command.value = 'yellowMarker';
151151
validateButton( 0 );
152152

153153
buttons[ 5 ].fire( 'execute' );
@@ -195,7 +195,7 @@ describe( 'HighlightUI', () => {
195195
const listView = dropdown.toolbarView;
196196

197197
expect( listView.items.map( item => item.label ).filter( label => !!label ) ).to.deep.equal( [
198-
'Marker',
198+
'Żółty marker',
199199
'Zielony marker',
200200
'Różowy marker',
201201
'Niebieski marker',

tests/integration.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ describe( 'Highlight', () => {
4545
it( 'does work inside image caption', () => {
4646
setModelData( model, '<image src="foo.png"><caption>foo[bar]baz</caption></image>' );
4747

48-
editor.execute( 'highlight', { value: 'marker' } );
48+
editor.execute( 'highlight', { value: 'yellowMarker' } );
4949

5050
expect( getModelData( model ) )
51-
.to.equal( '<image src="foo.png"><caption>foo[<$text highlight="marker">bar</$text>]baz</caption></image>' );
51+
.to.equal( '<image src="foo.png"><caption>foo[<$text highlight="yellowMarker">bar</$text>]baz</caption></image>' );
5252
} );
5353

5454
it( 'does work on selection with image', () => {
@@ -57,12 +57,12 @@ describe( 'Highlight', () => {
5757
'<paragraph>foo[foo</paragraph><image src="foo.png"><caption>abc</caption></image><paragraph>bar]bar</paragraph>'
5858
);
5959

60-
editor.execute( 'highlight', { value: 'marker' } );
60+
editor.execute( 'highlight', { value: 'yellowMarker' } );
6161

6262
expect( getModelData( model ) ).to.equal(
63-
'<paragraph>foo[<$text highlight="marker">foo</$text></paragraph>' +
64-
'<image src="foo.png"><caption><$text highlight="marker">abc</$text></caption></image>' +
65-
'<paragraph><$text highlight="marker">bar</$text>]bar</paragraph>'
63+
'<paragraph>foo[<$text highlight="yellowMarker">foo</$text></paragraph>' +
64+
'<image src="foo.png"><caption><$text highlight="yellowMarker">abc</$text></caption></image>' +
65+
'<paragraph><$text highlight="yellowMarker">bar</$text>]bar</paragraph>'
6666
);
6767
} );
6868
} );

tests/manual/highlight-buttons.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ClassicEditor
1313
.create( document.querySelector( '#editor' ), {
1414
plugins: [ ArticlePluginSet, Highlight ],
1515
toolbar: [
16-
'highlight:marker', 'highlight:greenMarker', 'highlight:pinkMarker', 'highlight:blueMarker',
16+
'highlight:yellowMarker', 'highlight:greenMarker', 'highlight:pinkMarker', 'highlight:blueMarker',
1717
'highlight:redPen', 'highlight:greenPen', 'removeHighlight',
1818
'|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
1919
]

tests/manual/highlight-buttons.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ You should be able to:
1010
- manually invoke highlight command in console:
1111

1212
```
13-
editor.execute( 'highlight', { class: 'marker' } );
14-
editor.execute( 'highlight', { class: 'marker-green' } );
15-
editor.execute( 'highlight', { class: 'marker-pink' } );
13+
editor.execute( 'highlight', { value: 'yellowMarker' } );
14+
editor.execute( 'highlight', { value: 'greenMarker' } );
15+
editor.execute( 'highlight', { value: 'pinkMarker' } );
16+
editor.execute( 'highlight', { value: 'blueMarker' } );
1617
17-
editor.execute( 'highlight', { class: 'pen-red' } );
18-
editor.execute( 'highlight', { class: 'pen-green' } );
18+
editor.execute( 'highlight', { value: 'redPen' } );
19+
editor.execute( 'highlight', { value: 'greenPen' } );
1920
```

tests/manual/highlight.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ You should be able to:
99
- manually invoke highlight command in console:
1010

1111
```
12-
editor.execute( 'highlight', { class: 'marker' } );
13-
editor.execute( 'highlight', { class: 'marker-green' } );
14-
editor.execute( 'highlight', { class: 'marker-pink' } );
12+
editor.execute( 'highlight', { value: 'yellowMarker' } );
13+
editor.execute( 'highlight', { value: 'greenMarker' } );
14+
editor.execute( 'highlight', { value: 'pinkMarker' } );
15+
editor.execute( 'highlight', { value: 'blueMarker' } );
1516
16-
editor.execute( 'highlight', { class: 'pen-red' } );
17-
editor.execute( 'highlight', { class: 'pen-green' } );
17+
editor.execute( 'highlight', { value: 'redPen' } );
18+
editor.execute( 'highlight', { value: 'greenPen' } );
1819
```

0 commit comments

Comments
 (0)