Selaa lähdekoodia

Changed: Renamed 'marker' option to 'yellowMarker'.

Maciej Gołaszewski 7 vuotta sitten
vanhempi
commit
aa5112634e

+ 2 - 2
packages/ckeditor5-highlight/docs/features/highlight.md

@@ -112,7 +112,7 @@ The {@link module:highlight/highlight~Highlight} plugin registers:
 	The `value` corresponds to the `model` property in configuration object. For the default configuration:
 	```js
 	highlight.options = [
-		{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
+		{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow Marker', color: '#fdfd77', type: 'marker' },
 		{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
 		{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
 		{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },
@@ -122,7 +122,7 @@ The {@link module:highlight/highlight~Highlight} plugin registers:
 	```
 
 	the `highlight` command will accept the corresponding strings as values:
-	- `'marker'` – available as a `'highlight:marker'` button,
+	- `'yellowMarker'` – available as a `'highlight:yellowMarker'` button,
 	- `'greenMarker'` – available as a `'highlight:greenMarker'` button,
 	- `'pinkMarker'` – available as a `'highlight:pinkMarker'` button,
 	- `'blueMarker'` – available as a `'highlight:blueMarker'` button,

+ 1 - 1
packages/ckeditor5-highlight/src/highlightediting.js

@@ -28,7 +28,7 @@ export default class HighlightEditing extends Plugin {
 
 		editor.config.define( 'highlight', {
 			options: [
-				{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
+				{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow marker', color: '#fdfd77', type: 'marker' },
 				{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
 				{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
 				{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },

+ 2 - 2
packages/ckeditor5-highlight/src/highlightui.js

@@ -47,7 +47,7 @@ export default class HighlightUI extends Plugin {
 	 * The following localized titles corresponding with default
 	 * {@link module:highlight/highlight~HighlightConfig#options} are available:
 	 *
-	 * * `'Marker'`,
+	 * * `'Yellow marker'`,
 	 * * `'Green marker'`,
 	 * * `'Pink marker'`,
 	 * * `'Blue marker'`,
@@ -61,7 +61,7 @@ export default class HighlightUI extends Plugin {
 		const t = this.editor.t;
 
 		return {
-			'Marker': t( 'Marker' ),
+			'Yellow marker': t( 'Yellow marker' ),
 			'Green marker': t( 'Green marker' ),
 			'Pink marker': t( 'Pink marker' ),
 			'Blue marker': t( 'Blue marker' ),

+ 27 - 27
packages/ckeditor5-highlight/tests/highlightcommand.js

@@ -46,9 +46,9 @@ describe( 'HighlightCommand', () => {
 
 	describe( 'value', () => {
 		it( 'is set to highlight attribute value when selection is in text with highlight attribute', () => {
-			setData( model, '<p><$text highlight="marker">fo[o]</$text></p>' );
+			setData( model, '<p><$text highlight="yellowMarker">fo[o]</$text></p>' );
 
-			expect( command ).to.have.property( 'value', 'marker' );
+			expect( command ).to.have.property( 'value', 'yellowMarker' );
 		} );
 
 		it( 'is undefined when selection is not in text with highlight attribute', () => {
@@ -79,9 +79,9 @@ describe( 'HighlightCommand', () => {
 		describe( 'with option.value set', () => {
 			describe( 'on collapsed range', () => {
 				it( 'should change entire highlight when inside highlighted text', () => {
-					setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
+					setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
 					command.execute( { value: 'greenMarker' } );
 
@@ -91,11 +91,11 @@ describe( 'HighlightCommand', () => {
 				} );
 
 				it( 'should remove entire highlight when inside highlighted text of the same value', () => {
-					setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
+					setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
-					command.execute( { value: 'marker' } );
+					command.execute( { value: 'yellowMarker' } );
 
 					expect( getData( model ) ).to.equal( '<p>abcfoo[]barxyz</p>' );
 
@@ -103,7 +103,7 @@ describe( 'HighlightCommand', () => {
 				} );
 
 				it( 'should change selection attribute in non-empty parent', () => {
-					setData( model, '<p>a[]bc<$text highlight="marker">foobar</$text>xyz</p>' );
+					setData( model, '<p>a[]bc<$text highlight="yellowMarker">foobar</$text>xyz</p>' );
 					expect( command.value ).to.be.undefined;
 
 					command.execute( { value: 'foo' } );
@@ -124,7 +124,7 @@ describe( 'HighlightCommand', () => {
 				} );
 
 				it( 'should not store attribute change on selection if selection is collapsed in non-empty parent', () => {
-					setData( model, '<p>a[]bc<$text highlight="marker">foobar</$text>xyz</p>' );
+					setData( model, '<p>a[]bc<$text highlight="yellowMarker">foobar</$text>xyz</p>' );
 
 					command.execute( { value: 'foo' } );
 
@@ -142,7 +142,7 @@ describe( 'HighlightCommand', () => {
 				} );
 
 				it( 'should change selection attribute and store it if selection is collapsed in empty parent', () => {
-					setData( model, '<p>abc<$text highlight="marker">foobar</$text>xyz</p><p>[]</p>' );
+					setData( model, '<p>abc<$text highlight="yellowMarker">foobar</$text>xyz</p><p>[]</p>' );
 
 					expect( command.value ).to.be.undefined;
 
@@ -176,15 +176,15 @@ describe( 'HighlightCommand', () => {
 
 			describe( 'on not collapsed range', () => {
 				it( 'should set highlight attribute on selected node when passed as parameter', () => {
-					setData( model, '<p>a[bc<$text highlight="marker">fo]obar</$text>xyz</p>' );
+					setData( model, '<p>a[bc<$text highlight="yellowMarker">fo]obar</$text>xyz</p>' );
 
 					expect( command.value ).to.be.undefined;
 
-					command.execute( { value: 'marker' } );
+					command.execute( { value: 'yellowMarker' } );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
-					expect( getData( model ) ).to.equal( '<p>a[<$text highlight="marker">bcfo]obar</$text>xyz</p>' );
+					expect( getData( model ) ).to.equal( '<p>a[<$text highlight="yellowMarker">bcfo]obar</$text>xyz</p>' );
 				} );
 
 				it( 'should set highlight attribute on selected node when passed as parameter (multiple nodes)', () => {
@@ -195,26 +195,26 @@ describe( 'HighlightCommand', () => {
 						'<p>barbar]bar</p>'
 					);
 
-					command.execute( { value: 'marker' } );
+					command.execute( { value: 'yellowMarker' } );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
 					expect( getData( model ) ).to.equal(
-						'<p>abcabc[<$text highlight="marker">abc</$text></p>' +
-						'<p><$text highlight="marker">foofoofoo</$text></p>' +
-						'<p><$text highlight="marker">barbar</$text>]bar</p>'
+						'<p>abcabc[<$text highlight="yellowMarker">abc</$text></p>' +
+						'<p><$text highlight="yellowMarker">foofoofoo</$text></p>' +
+						'<p><$text highlight="yellowMarker">barbar</$text>]bar</p>'
 					);
 				} );
 
 				it( 'should set highlight attribute on selected nodes when passed as parameter only on selected characters', () => {
-					setData( model, '<p>abc[<$text highlight="marker">foo]bar</$text>xyz</p>' );
+					setData( model, '<p>abc[<$text highlight="yellowMarker">foo]bar</$text>xyz</p>' );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
 					command.execute( { value: 'foo' } );
 
 					expect( getData( model ) ).to.equal(
-						'<p>abc[<$text highlight="foo">foo</$text>]<$text highlight="marker">bar</$text>xyz</p>'
+						'<p>abc[<$text highlight="foo">foo</$text>]<$text highlight="yellowMarker">bar</$text>xyz</p>'
 					);
 
 					expect( command.value ).to.equal( 'foo' );
@@ -225,9 +225,9 @@ describe( 'HighlightCommand', () => {
 		describe( 'with undefined option.value', () => {
 			describe( 'on collapsed range', () => {
 				it( 'should remove entire highlight when inside highlighted text', () => {
-					setData( model, '<p>abc<$text highlight="marker">foo[]bar</$text>xyz</p>' );
+					setData( model, '<p>abc<$text highlight="yellowMarker">foo[]bar</$text>xyz</p>' );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
 					command.execute();
 
@@ -239,13 +239,13 @@ describe( 'HighlightCommand', () => {
 
 			describe( 'on not collapsed range', () => {
 				it( 'should remove highlight attribute on selected node when undefined passed as parameter', () => {
-					setData( model, '<p>abc[<$text highlight="marker">foo]bar</$text>xyz</p>' );
+					setData( model, '<p>abc[<$text highlight="yellowMarker">foo]bar</$text>xyz</p>' );
 
-					expect( command.value ).to.equal( 'marker' );
+					expect( command.value ).to.equal( 'yellowMarker' );
 
 					command.execute();
 
-					expect( getData( model ) ).to.equal( '<p>abc[foo]<$text highlight="marker">bar</$text>xyz</p>' );
+					expect( getData( model ) ).to.equal( '<p>abc[foo]<$text highlight="yellowMarker">bar</$text>xyz</p>' );
 
 					expect( command.value ).to.be.undefined;
 				} );

+ 8 - 8
packages/ckeditor5-highlight/tests/highlightediting.js

@@ -43,18 +43,18 @@ describe( 'HighlightEditing', () => {
 
 	describe( 'data pipeline conversions', () => {
 		it( 'should convert defined marker classes', () => {
-			const data = '<p>f<mark class="marker">o</mark>o</p>';
+			const data = '<p>f<mark class="marker-yellow">o</mark>o</p>';
 			editor.setData( data );
 
-			expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="marker">o</$text>o</paragraph>' );
+			expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
 			expect( editor.getData() ).to.equal( data );
 		} );
 
 		it( 'should convert only one defined marker classes', () => {
-			editor.setData( '<p>f<mark class="marker-green marker">o</mark>o</p>' );
+			editor.setData( '<p>f<mark class="marker-green marker-yellow">o</mark>o</p>' );
 
-			expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="marker">o</$text>o</paragraph>' );
-			expect( editor.getData() ).to.equal( '<p>f<mark class="marker">o</mark>o</p>' );
+			expect( getModelData( model ) ).to.equal( '<paragraph>[]f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
+			expect( editor.getData() ).to.equal( '<p>f<mark class="marker-yellow">o</mark>o</p>' );
 		} );
 
 		it( 'should not convert undefined marker classes', () => {
@@ -74,9 +74,9 @@ describe( 'HighlightEditing', () => {
 
 	describe( 'editing pipeline conversion', () => {
 		it( 'should convert mark element with defined class', () => {
-			setModelData( model, '<paragraph>f<$text highlight="marker">o</$text>o</paragraph>' );
+			setModelData( model, '<paragraph>f<$text highlight="yellowMarker">o</$text>o</paragraph>' );
 
-			expect( editor.getData() ).to.equal( '<p>f<mark class="marker">o</mark>o</p>' );
+			expect( editor.getData() ).to.equal( '<p>f<mark class="marker-yellow">o</mark>o</p>' );
 		} );
 	} );
 
@@ -85,7 +85,7 @@ describe( 'HighlightEditing', () => {
 			it( 'should be set', () => {
 				expect( editor.config.get( 'highlight' ) ).to.deep.equal( {
 					options: [
-						{ model: 'marker', class: 'marker', title: 'Marker', color: '#fdfd77', type: 'marker' },
+						{ model: 'yellowMarker', class: 'marker-yellow', title: 'Yellow marker', color: '#fdfd77', type: 'marker' },
 						{ model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#63f963', type: 'marker' },
 						{ model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#fc7999', type: 'marker' },
 						{ model: 'blueMarker', class: 'marker-blue', title: 'Blue marker', color: '#72cdfd', type: 'marker' },

+ 4 - 4
packages/ckeditor5-highlight/tests/highlightui.js

@@ -24,7 +24,7 @@ describe( 'HighlightUI', () => {
 	before( () => {
 		addTranslations( 'en', {
 			'Highlight': 'Highlight',
-			'Marker': 'Marker',
+			'Yellow marker': 'Yellow marker',
 			'Green marker': 'Green marker',
 			'Pink marker': 'Pink marker',
 			'Red pen': 'Red pen',
@@ -34,7 +34,7 @@ describe( 'HighlightUI', () => {
 
 		addTranslations( 'pl', {
 			'Highlight': 'Zakreślacz',
-			'Marker': 'Marker',
+			'Yellow marker': 'Żółty marker',
 			'Green marker': 'Zielony marker',
 			'Pink marker': 'Różowy marker',
 			'Blue marker': 'Niebieski marker',
@@ -147,7 +147,7 @@ describe( 'HighlightUI', () => {
 			} );
 
 			it( 'should change button on execute option', () => {
-				command.value = 'marker';
+				command.value = 'yellowMarker';
 				validateButton( 0 );
 
 				buttons[ 5 ].fire( 'execute' );
@@ -195,7 +195,7 @@ describe( 'HighlightUI', () => {
 				const listView = dropdown.toolbarView;
 
 				expect( listView.items.map( item => item.label ).filter( label => !!label ) ).to.deep.equal( [
-					'Marker',
+					'Żółty marker',
 					'Zielony marker',
 					'Różowy marker',
 					'Niebieski marker',

+ 6 - 6
packages/ckeditor5-highlight/tests/integration.js

@@ -45,10 +45,10 @@ describe( 'Highlight', () => {
 		it( 'does work inside image caption', () => {
 			setModelData( model, '<image src="foo.png"><caption>foo[bar]baz</caption></image>' );
 
-			editor.execute( 'highlight', { value: 'marker' } );
+			editor.execute( 'highlight', { value: 'yellowMarker' } );
 
 			expect( getModelData( model ) )
-				.to.equal( '<image src="foo.png"><caption>foo[<$text highlight="marker">bar</$text>]baz</caption></image>' );
+				.to.equal( '<image src="foo.png"><caption>foo[<$text highlight="yellowMarker">bar</$text>]baz</caption></image>' );
 		} );
 
 		it( 'does work on selection with image', () => {
@@ -57,12 +57,12 @@ describe( 'Highlight', () => {
 				'<paragraph>foo[foo</paragraph><image src="foo.png"><caption>abc</caption></image><paragraph>bar]bar</paragraph>'
 			);
 
-			editor.execute( 'highlight', { value: 'marker' } );
+			editor.execute( 'highlight', { value: 'yellowMarker' } );
 
 			expect( getModelData( model ) ).to.equal(
-				'<paragraph>foo[<$text highlight="marker">foo</$text></paragraph>' +
-				'<image src="foo.png"><caption><$text highlight="marker">abc</$text></caption></image>' +
-				'<paragraph><$text highlight="marker">bar</$text>]bar</paragraph>'
+				'<paragraph>foo[<$text highlight="yellowMarker">foo</$text></paragraph>' +
+				'<image src="foo.png"><caption><$text highlight="yellowMarker">abc</$text></caption></image>' +
+				'<paragraph><$text highlight="yellowMarker">bar</$text>]bar</paragraph>'
 			);
 		} );
 	} );

+ 1 - 1
packages/ckeditor5-highlight/tests/manual/highlight-buttons.js

@@ -13,7 +13,7 @@ ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [ ArticlePluginSet, Highlight ],
 		toolbar: [
-			'highlight:marker', 'highlight:greenMarker', 'highlight:pinkMarker', 'highlight:blueMarker',
+			'highlight:yellowMarker', 'highlight:greenMarker', 'highlight:pinkMarker', 'highlight:blueMarker',
 			'highlight:redPen', 'highlight:greenPen', 'removeHighlight',
 			'|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
 		]

+ 6 - 5
packages/ckeditor5-highlight/tests/manual/highlight-buttons.md

@@ -10,10 +10,11 @@ You should be able to:
 - manually invoke highlight command in console:
 
 ```
-editor.execute( 'highlight', { class: 'marker' } );
-editor.execute( 'highlight', { class: 'marker-green' } );
-editor.execute( 'highlight', { class: 'marker-pink' } );
+editor.execute( 'highlight', { value: 'yellowMarker' } );
+editor.execute( 'highlight', { value: 'greenMarker' } );
+editor.execute( 'highlight', { value: 'pinkMarker' } );
+editor.execute( 'highlight', { value: 'blueMarker' } );
 
-editor.execute( 'highlight', { class: 'pen-red' } );
-editor.execute( 'highlight', { class: 'pen-green' } );
+editor.execute( 'highlight', { value: 'redPen' } );
+editor.execute( 'highlight', { value: 'greenPen' } );
 ```

+ 6 - 5
packages/ckeditor5-highlight/tests/manual/highlight.md

@@ -9,10 +9,11 @@ You should be able to:
 - manually invoke highlight command in console:
 
 ```
-editor.execute( 'highlight', { class: 'marker' } );
-editor.execute( 'highlight', { class: 'marker-green' } );
-editor.execute( 'highlight', { class: 'marker-pink' } );
+editor.execute( 'highlight', { value: 'yellowMarker' } );
+editor.execute( 'highlight', { value: 'greenMarker' } );
+editor.execute( 'highlight', { value: 'pinkMarker' } );
+editor.execute( 'highlight', { value: 'blueMarker' } );
 
-editor.execute( 'highlight', { class: 'pen-red' } );
-editor.execute( 'highlight', { class: 'pen-green' } );
+editor.execute( 'highlight', { value: 'redPen' } );
+editor.execute( 'highlight', { value: 'greenPen' } );
 ```