| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- /**
- * @license Copyright (c) 2003-2018, 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 loads the {@link module:highlight/highlightediting~HighlightEditing} and
- * {@link module:highlight/highlightui~HighlightUI} plugins.
- *
- * Read more about the feature in the {@glink api/highlight highlight package} page.
- *
- * @extends module:core/plugin~Plugin
- */
- export default class Highlight extends Plugin {
- /**
- * @inheritDoc
- */
- static get requires() {
- return [ HighlightEditing, HighlightUI ];
- }
- /**
- * @inheritDoc
- */
- static get pluginName() {
- return 'Highlight';
- }
- }
- /**
- * The highlight option descriptor. See the {@link module:highlight/highlight~HighlightConfig} to learn more.
- *
- * {
- * model: 'pinkMarker',
- * class: 'marker-pink',
- * title: 'Pink Marker',
- * color: '#ff6fff',
- * type: 'marker'
- * }
- *
- * @typedef {Object} module:highlight/highlight~HighlightOption
- * @property {String} title The user-readable title of the option.
- * @property {String} model The unique attribute value in the model.
- * @property {String} color The color used for the highlighter. It should match the `class` CSS definition.
- * The color is used in the user interface to represent the highlighter.
- * @property {String} class The CSS class used on the `<mark>` element in the view. It should match the `color` setting.
- * @property {'marker'|'pen'} type The type of highlighter:
- * - `'marker'` – uses the `color` as a `background-color` style,
- * - `'pen'` – uses the `color` as a font `color` style.
- */
- /**
- * The configuration of the {@link module:highlight/highlight~Highlight} feature.
- *
- * Read more in {@link module:highlight/highlight~HighlightConfig}.
- *
- * @member {module:highlight/highlight~HighlightConfig} module:core/editor/editorconfig~EditorConfig#highlight
- */
- /**
- * The configuration of the {@link module:highlight/highlight~Highlight Highlight feature}.
- *
- * ClassicEditor
- * .create( editorElement, {
- * highlight: ... // Highlight feature config.
- * } )
- * .then( ... )
- * .catch( ... );
- *
- * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
- *
- * @interface HighlightConfig
- */
- /**
- * The available highlighters options. The default value is:
- *
- * options: [
- * { model: 'marker', class: 'marker', title: 'Marker', color: '#ffff66', type: 'marker' },
- * { model: 'greenMarker', class: 'marker-green', title: 'Green marker', color: '#66ff00', type: 'marker' },
- * { model: 'pinkMarker', class: 'marker-pink', title: 'Pink marker', color: '#ff6fff', type: 'marker' },
- * { model: 'redPen', class: 'pen-red', title: 'Red pen', color: '#ff2929', type: 'pen' },
- * { model: 'bluePen', class: 'pen-blue', title: 'Blue pen', color: '#0091ff', type: 'pen' }
- * ]
- *
- * There are two types of highlighters available:
- * - `'marker'` - rendered as a `<mark>` element, styled with the `background-color`,
- * - `'pen'` - rendered as a `<mark>` element, styled with the font `color`.
- *
- * **Note**: A style sheet with CSS classes is required for the configuration to work properly.
- * The highlight feature does not provide the actual styles by itself.
- *
- * **Note**: It is recommended that the `color` value should correspond to the class in the content
- * style sheet. It represents the highlighter in the user interface of the editor.
- *
- * ClassicEditor
- * .create( editorElement, {
- * highlight: {
- * options: [
- * {
- * model: 'pinkMarker',
- * class: 'marker-pink',
- * title: 'Pink Marker',
- * color: '#ff6fff',
- * type: 'marker'
- * },
- * {
- * model: 'redPen',
- * class: 'pen-red',
- * title: 'Red Pen',
- * color: '#ff2929',
- * type: 'pen'
- * },
- * ]
- * }
- * } )
- * .then( ... )
- * .catch( ... );
- *
- * @member {Array.<module:highlight/highlight~HighlightOption>} module:highlight/highlight~HighlightConfig#options
- */
|