8
0
Просмотр исходного кода

Merge pull request #2 from ckeditor/t/1

Feature: Initial implementation of highlight editing. Closes #1.
Szymon Kupś 8 лет назад
Родитель
Сommit
170d3dfde3

+ 10 - 0
packages/ckeditor5-highlight/package.json

@@ -7,8 +7,18 @@
     "ckeditor5-feature"
   ],
   "dependencies": {
+    "@ckeditor/ckeditor5-core": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-engine": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-ui": "^1.0.0-alpha.1"
   },
   "devDependencies": {
+    "@ckeditor/ckeditor5-block-quote": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-enter": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-heading": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-image": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-list": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-paragraph": "^1.0.0-alpha.1",
+    "@ckeditor/ckeditor5-typing": "^1.0.0-alpha.1",
     "eslint": "^4.8.0",
     "eslint-config-ckeditor5": "^1.0.6",
     "husky": "^0.14.3",

+ 36 - 0
packages/ckeditor5-highlight/src/highlight.js

@@ -0,0 +1,36 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module highlight/highlight
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+
+import HighlightEditing from './highlightediting';
+import HighlightUI from './highlightui';
+
+/**
+ * The highlight plugin.
+ *
+ * It requires {@link module:highlight/highlightediting~HighlightEditing} and {@link module:highlight/highlightui~HighlightUI} plugins.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class Highlight extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get requires() {
+		return [ HighlightEditing, HighlightUI ];
+	}
+
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'Highlight';
+	}
+}

+ 68 - 0
packages/ckeditor5-highlight/src/highlightcommand.js

@@ -0,0 +1,68 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module highlight/highlightcommand
+ */
+
+import Command from '@ckeditor/ckeditor5-core/src/command';
+
+/**
+ * The highlight command. It is used by the {@link module:highlight/highlightediting~HighlightEditing highlight feature}
+ * to apply text highlighting.
+ *
+ * @extends module:core/command~Command
+ */
+export default class HighlightCommand extends Command {
+	/**
+	 * @inheritDoc
+	 */
+	refresh() {
+		const doc = this.editor.document;
+
+		this.value = doc.selection.getAttribute( 'highlight' );
+		this.isEnabled = doc.schema.checkAttributeInSelection( doc.selection, 'highlight' );
+	}
+
+	/**
+	 * Executes the command.
+	 *
+	 * @protected
+	 * @param {Object} [options] Options for the executed command.
+	 * @param {String} options.class Name of highlighter class.
+	 * @param {module:engine/model/batch~Batch} [options.batch] A batch to collect all the change steps.
+	 * A new batch will be created if this option is not set.
+	 */
+	execute( options = {} ) {
+		const doc = this.editor.document;
+		const selection = doc.selection;
+
+		// Do not apply highlight no collapsed selection.
+		if ( selection.isCollapsed ) {
+			return;
+		}
+
+		doc.enqueueChanges( () => {
+			const ranges = doc.schema.getValidRanges( selection.getRanges(), 'highlight' );
+			const batch = options.batch || doc.batch();
+
+			for ( const range of ranges ) {
+				if ( options.class ) {
+					batch.setAttribute( range, 'highlight', options.class );
+				} else {
+					batch.removeAttribute( range, 'highlight' );
+				}
+			}
+		} );
+	}
+}
+
+/**
+ * Holds current highlight class. If there is no highlight in selection then value will be undefined.
+ *
+ * @observable
+ * @readonly
+ * @member {undefined|String} module:highlight/highlightcommand~HighlightCommand#value
+ */

+ 123 - 0
packages/ckeditor5-highlight/src/highlightediting.js

@@ -0,0 +1,123 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module highlight/highlightediting
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+
+import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter';
+import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter';
+
+import AttributeElement from '@ckeditor/ckeditor5-engine/src/view/attributeelement';
+
+import HighlightCommand from './highlightcommand';
+
+/**
+ * The highlight editing feature. It introduces `highlight` command which allow to highlight selected text with defined 'marker' or 'pen'.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class HighlightEditing extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	constructor( editor ) {
+		super( editor );
+
+		editor.config.define( 'highlight', [
+			{ class: 'marker', title: 'Marker', color: '#ffff66', type: 'marker' },
+			{ class: 'marker-green', title: 'Green Marker', color: '#66ff00', type: 'marker' },
+			{ class: 'marker-pink', title: 'Pink Marker', color: '#ff6fff', type: 'marker' },
+			{ class: 'pen-red', title: 'Red Pen', color: '#ff0000', type: 'pen' },
+			{ class: 'pen-blue', title: 'Blue Pen', color: '#0000ff', type: 'pen' }
+		] );
+	}
+
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const data = editor.data;
+		const editing = editor.editing;
+
+		// Allow highlight attribute on all elements
+		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$block' } );
+		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
+		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$clipboardHolder' } );
+
+		// Convert highlight attribute to a mark element with associated class.
+		buildModelConverter()
+			.for( data.modelToView, editing.modelToView )
+			.fromAttribute( 'highlight' )
+			.toElement( data => new AttributeElement( 'mark', { class: data } ) );
+
+		const configuredClasses = editor.config.get( 'highlight' ).map( config => config.class );
+
+		// Convert `mark` attribute with class name to model's highlight attribute.
+		buildViewConverter()
+			.for( data.viewToModel )
+			.fromElement( 'mark' )
+			.toAttribute( viewElement => {
+				for ( const className of viewElement.getClassNames() ) {
+					if ( configuredClasses.indexOf( className ) > -1 ) {
+						return { key: 'highlight', value: className };
+					}
+				}
+			} );
+
+		editor.commands.add( 'highlight', new HighlightCommand( editor ) );
+	}
+}
+
+/**
+ * Highlight option descriptor.
+ *
+ * @typedef {Object} module:highlight/highlightediting~HeadingOption
+ * @property {String} class The class which is used to differentiate highlighters.
+ * @property {String} title The user-readable title of the option.
+ * @property {String} color Color used for highlighter. Should be coherent with CSS class definition.
+ * @property {'marker'|'pen'} type The type of highlighter:
+ * - "marker" - will use #color as background,
+ * - "pen" - will use #color as font color.
+ */
+
+/**
+ * The configuration of the {@link module:highlight/highlightediting~HighlightEditing Highlight feature}.
+ *
+ * Read more in {@link module:highlight/highlightediting~HighlightEditingConfig}.
+ *
+ * @member {module:highlight/highlightediting~HighlightEditingConfig} module:core/editor/editorconfig~EditorConfig#highlight
+ */
+
+/**
+ * The configuration of the {@link module:highlight/highlightediting~HighlightEditing Highlight feature}.
+ *
+ *        ClassicEditor
+ *            .create( editorElement, {
+ * 				highlight:  ... // Highlight feature config.
+ *			} )
+ *            .then( ... )
+ *            .catch( ... );
+ *
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
+ *
+ * @interface HighlightEditingConfig
+ */
+
+/**
+ * Available highlighters options.
+ *
+ * There are two types of highlighters:
+ * - 'marker' - rendered as `<mark>` element with defined background color.
+ * - 'pen' - rendered as `<mark>` element with defined foreground (font) color.
+ *
+ * Note: Each highlighter must have it's own CSS class defined to properly match content data. Also it is advised
+ * that color value should match the values defined in content CSS stylesheet.
+ *
+ * @member {Array.<module:heading/heading~HeadingOption>} module:heading/heading~HeadingConfig#options
+ */

+ 33 - 0
packages/ckeditor5-highlight/src/highlightui.js

@@ -0,0 +1,33 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module highlight/highlightui
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+
+import HighlightEditing from './highlightediting';
+
+/**
+ * The default Highlight UI plugin.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class HighlightUI extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get requires() {
+		return [ HighlightEditing ];
+	}
+
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'HighlightUI';
+	}
+}

+ 39 - 0
packages/ckeditor5-highlight/tests/highlight.js

@@ -0,0 +1,39 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* global document */
+
+import Highlight from './../src/highlight';
+import HighlightEditing from './../src/highlightediting';
+import HighlightUI from './../src/highlightui';
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+
+describe( 'Highlight', () => {
+	let editor, element;
+
+	beforeEach( () => {
+		element = document.createElement( 'div' );
+		document.body.appendChild( element );
+
+		return ClassicTestEditor
+			.create( element, {
+				plugins: [ Highlight ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+			} );
+	} );
+
+	afterEach( () => {
+		element.remove();
+
+		return editor.destroy();
+	} );
+
+	it( 'requires HighlightEditing and HighlightUI', () => {
+		expect( Highlight.requires ).to.deep.equal( [ HighlightEditing, HighlightUI ] );
+	} );
+} );

+ 131 - 0
packages/ckeditor5-highlight/tests/highlightcommand.js

@@ -0,0 +1,131 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+import HighlightCommand from './../src/highlightcommand';
+
+import Command from '@ckeditor/ckeditor5-core/src/command';
+import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
+import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+
+describe( 'HighlightCommand', () => {
+	let editor, doc, command;
+
+	beforeEach( () => {
+		return ModelTestEditor.create()
+			.then( newEditor => {
+				doc = newEditor.document;
+				command = new HighlightCommand( newEditor );
+				editor = newEditor;
+
+				editor.commands.add( 'highlight', command );
+
+				doc.schema.registerItem( 'paragraph', '$block' );
+
+				doc.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$block' } );
+			} );
+	} );
+
+	afterEach( () => {
+		editor.destroy();
+	} );
+
+	it( 'is a command', () => {
+		expect( HighlightCommand.prototype ).to.be.instanceOf( Command );
+		expect( command ).to.be.instanceOf( Command );
+	} );
+
+	describe( 'value', () => {
+		it( 'is set to highlight attribute value when selection is in text with highlight attribute', () => {
+			setData( doc, '<paragraph><$text highlight="marker">fo[]o</$text></paragraph>' );
+
+			expect( command ).to.have.property( 'value', 'marker' );
+		} );
+
+		it( 'is undefined when selection is not in text with highlight attribute', () => {
+			setData( doc, '<paragraph>fo[]o</paragraph>' );
+
+			expect( command ).to.have.property( 'value', undefined );
+		} );
+	} );
+
+	describe( 'isEnabled', () => {
+		it( 'is true when selection is on text which can have highlight added', () => {
+			setData( doc, '<paragraph>fo[]o</paragraph>' );
+
+			expect( command ).to.have.property( 'isEnabled', true );
+		} );
+	} );
+
+	describe( 'execute()', () => {
+		it( 'should add highlight attribute on selected nodes nodes when passed as parameter', () => {
+			setData( doc, '<paragraph>a[bc<$text highlight="marker">fo]obar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.be.undefined;
+
+			command.execute( { class: 'marker' } );
+
+			expect( command.value ).to.equal( 'marker' );
+
+			expect( getData( doc ) ).to.equal( '<paragraph>a[<$text highlight="marker">bcfo]obar</$text>xyz</paragraph>' );
+		} );
+
+		it( 'should add highlight attribute on selected nodes nodes when passed as parameter (multiple nodes)', () => {
+			setData(
+				doc,
+				'<paragraph>abcabc[abc</paragraph>' +
+				'<paragraph>foofoofoo</paragraph>' +
+				'<paragraph>barbar]bar</paragraph>'
+			);
+
+			command.execute( { class: 'marker' } );
+
+			expect( command.value ).to.equal( 'marker' );
+
+			expect( getData( doc ) ).to.equal(
+				'<paragraph>abcabc[<$text highlight="marker">abc</$text></paragraph>' +
+				'<paragraph><$text highlight="marker">foofoofoo</$text></paragraph>' +
+				'<paragraph><$text highlight="marker">barbar</$text>]bar</paragraph>'
+			);
+		} );
+
+		it( 'should set highlight attribute on selected nodes when passed as parameter', () => {
+			setData( doc, '<paragraph>abc[<$text highlight="marker">foo]bar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.equal( 'marker' );
+
+			command.execute( { class: 'foo' } );
+
+			expect( getData( doc ) ).to.equal(
+				'<paragraph>abc[<$text highlight="foo">foo</$text>]<$text highlight="marker">bar</$text>xyz</paragraph>'
+			);
+
+			expect( command.value ).to.equal( 'foo' );
+		} );
+
+		it( 'should remove highlight attribute on selected nodes nodes when undefined passed as parameter', () => {
+			setData( doc, '<paragraph>abc[<$text highlight="marker">foo]bar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.equal( 'marker' );
+
+			command.execute();
+
+			expect( getData( doc ) ).to.equal( '<paragraph>abc[foo]<$text highlight="marker">bar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.be.undefined;
+		} );
+
+		it( 'should do nothing on collapsed range', () => {
+			setData( doc, '<paragraph>abc<$text highlight="marker">foo[]bar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.equal( 'marker' );
+
+			command.execute();
+
+			expect( getData( doc ) ).to.equal( '<paragraph>abc<$text highlight="marker">foo[]bar</$text>xyz</paragraph>' );
+
+			expect( command.value ).to.equal( 'marker' );
+		} );
+	} );
+} );

+ 94 - 0
packages/ckeditor5-highlight/tests/highlightediting.js

@@ -0,0 +1,94 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+import HighlightEditing from './../src/highlightediting';
+import HighlightCommand from './../src/highlightcommand';
+
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+
+import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
+import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+
+describe( 'HighlightEditing', () => {
+	let editor, doc;
+
+	beforeEach( () => {
+		return VirtualTestEditor
+			.create( {
+				plugins: [ HighlightEditing, Paragraph ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				doc = editor.document;
+			} );
+	} );
+
+	afterEach( () => {
+		editor.destroy();
+	} );
+
+	it( 'should set proper schema rules', () => {
+		expect( doc.schema.check( { name: '$inline', attributes: 'highlight', inside: '$block' } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: 'highlight', inside: '$clipboardHolder' } ) ).to.be.true;
+	} );
+
+	it( 'adds highlight commands', () => {
+		expect( editor.commands.get( 'highlight' ) ).to.be.instanceOf( HighlightCommand );
+	} );
+
+	describe( 'data pipeline conversions', () => {
+		it( 'should convert defined marker classes', () => {
+			const data = '<p>f<mark class="marker">o</mark>o</p>';
+
+			editor.setData( data );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph>[]f<$text highlight="marker">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>' );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph>[]f<$text highlight="marker-green">o</$text>o</paragraph>' );
+			expect( editor.getData() ).to.equal( '<p>f<mark class="marker-green">o</mark>o</p>' );
+		} );
+
+		it( 'should not convert undefined marker classes', () => {
+			editor.setData( '<p>f<mark class="some-unknown-marker">o</mark>o</p>' );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph>[]foo</paragraph>' );
+			expect( editor.getData() ).to.equal( '<p>foo</p>' );
+		} );
+
+		it( 'should not convert marker without class', () => {
+			editor.setData( '<p>f<mark>o</mark>o</p>' );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph>[]foo</paragraph>' );
+			expect( editor.getData() ).to.equal( '<p>foo</p>' );
+		} );
+	} );
+
+	describe( 'editing pipeline conversion', () => {
+		it( 'should convert mark element with defined class', () => {
+			setModelData( doc, '<paragraph>f<$text highlight="marker">o</$text>o</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p>f<mark class="marker">o</mark>o</p>' );
+		} );
+	} );
+
+	describe( 'config', () => {
+		describe( 'default value', () => {
+			it( 'should be set', () => {
+				expect( editor.config.get( 'highlight' ) ).to.deep.equal( [
+					{ class: 'marker', title: 'Marker', color: '#ffff66', type: 'marker' },
+					{ class: 'marker-green', title: 'Green Marker', color: '#66ff00', type: 'marker' },
+					{ class: 'marker-pink', title: 'Pink Marker', color: '#ff6fff', type: 'marker' },
+					{ class: 'pen-red', title: 'Red Pen', color: '#ff0000', type: 'pen' },
+					{ class: 'pen-blue', title: 'Blue Pen', color: '#0000ff', type: 'pen' }
+				] );
+			} );
+		} );
+	} );
+} );

+ 69 - 0
packages/ckeditor5-highlight/tests/integration.js

@@ -0,0 +1,69 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* global document */
+
+import Highlight from '../src/highlight';
+import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+import Heading from '@ckeditor/ckeditor5-heading/src/heading';
+import Image from '@ckeditor/ckeditor5-image/src/image';
+import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
+import List from '@ckeditor/ckeditor5-list/src/list';
+import Enter from '@ckeditor/ckeditor5-enter/src/enter';
+import Delete from '@ckeditor/ckeditor5-typing/src/delete';
+
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+
+describe( 'Highlight', () => {
+	let editor, doc, element;
+
+	beforeEach( () => {
+		element = document.createElement( 'div' );
+		document.body.appendChild( element );
+
+		return ClassicTestEditor
+			.create( element, {
+				plugins: [ Highlight, BlockQuote, Paragraph, Heading, Image, ImageCaption, List, Enter, Delete ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+				doc = editor.document;
+			} );
+	} );
+
+	afterEach( () => {
+		element.remove();
+
+		return editor.destroy();
+	} );
+
+	describe( 'compatibility with images', () => {
+		it( 'does not work inside image caption', () => {
+			setModelData( doc, '<image src="foo.png"><caption>foo[bar]baz</caption></image>' );
+
+			editor.execute( 'highlight', { class: 'marker' } );
+
+			expect( getModelData( doc ) )
+				.to.equal( '<image src="foo.png"><caption>foo[<$text highlight="marker">bar</$text>]baz</caption></image>' );
+		} );
+
+		it( 'does not work on selection with image', () => {
+			setModelData(
+				doc,
+				'<paragraph>foo[foo</paragraph><image src="foo.png"><caption>abc</caption></image><paragraph>bar]bar</paragraph>'
+			);
+
+			editor.execute( 'highlight', { class: 'marker' } );
+
+			expect( getModelData( doc ) ).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>'
+			);
+		} );
+	} );
+} );

+ 33 - 0
packages/ckeditor5-highlight/tests/manual/highlight.html

@@ -0,0 +1,33 @@
+<style>
+	.marker {
+		background-color: #ffff66;
+	}
+
+	.marker-green {
+		background-color: #66ff00;
+	}
+
+	.marker-pink {
+		background-color: #ff6fff;
+	}
+
+	.pen-red {
+		background-color: transparent;
+		color: #ff0000;
+	}
+
+	.pen-blue {
+		background-color: transparent;
+		color: #0000ff;
+	}
+
+</style>
+<div id="editor">
+	<p>Highlight feature example.</p>
+	<p>Here ares some markers:
+		<mark class="marker">yellow one</mark>, <mark class="marker-pink">pink one</mark> and <mark class="marker-green">green one</mark>.
+	</p>
+	<p>Here ares some pens:
+		<mark class="pen-red">red pen</mark> and <mark class="pen-blue">blue one</mark>.
+	</p>
+</div>

+ 24 - 0
packages/ckeditor5-highlight/tests/manual/highlight.js

@@ -0,0 +1,24 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '../../../ckeditor5-editor-classic/src/classiceditor';
+import ArticlePluginSet from '../../../ckeditor5-core/tests/_utils/articlepluginset';
+import Highlight from '../../src/highlight';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePluginSet, Highlight ],
+		toolbar: [
+			'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
+		]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 18 - 0
packages/ckeditor5-highlight/tests/manual/highlight.md

@@ -0,0 +1,18 @@
+### Loading
+
+1. The data should be loaded with different markers and pens.
+
+### Testing
+
+You should be able to:
+- see different markers class
+- 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', { class: 'pen-red' } );
+editor.execute( 'highlight', { class: 'pen-blue' } );	 
+```