diff --git a/docs/_snippets/features/special-characters-extended-category.html b/docs/_snippets/features/special-characters-extended-category.html new file mode 100644 index 0000000..734c720 --- /dev/null +++ b/docs/_snippets/features/special-characters-extended-category.html @@ -0,0 +1,15 @@ +
+

The Flavorful Tuscany Meetup

+

Welcome letter

+

Dear Guest,

+

We are delighted to welcome you to the annual Flavorful Tuscany Meetup and hope you will enjoy the programme as well as your stay at the Bilancino Hotel.

+

Please arrive at the Bilancino Hotel reception desk at least half an hour earlier to make sure that the registration process goes as smoothly as possible.

+

We look forward to welcoming you to the event. The full schedule can be found below.

+
+ + diff --git a/docs/_snippets/features/special-characters-extended-category.js b/docs/_snippets/features/special-characters-extended-category.js new file mode 100644 index 0000000..efeb795 --- /dev/null +++ b/docs/_snippets/features/special-characters-extended-category.js @@ -0,0 +1,65 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/* globals window, document, console, ClassicEditor */ + +import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config'; + +ClassicEditor + .create( document.querySelector( '#snippet-special-characters-extended-category' ), { + removePlugins: [ + 'SpecialCharactersEmoji' + ], + toolbar: { + items: [ + 'heading', + '|', + 'bold', + 'italic', + 'bulletedList', + 'numberedList', + '|', + 'outdent', + 'indent', + '|', + 'alignment', + '|', + 'specialCharacters', + 'blockQuote', + 'link', + 'imageUpload', + 'mediaEmbed', + 'insertTable', + '|', + 'undo', + 'redo' + ], + viewportTopOffset: window.getViewportTopOffsetConfig() + }, + image: { + styles: [ + 'full', + 'alignLeft', + 'alignRight' + ], + toolbar: [ + 'imageStyle:alignLeft', + 'imageStyle:full', + 'imageStyle:alignRight', + '|', + 'imageTextAlternative' + ] + }, + table: { + contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ] + }, + cloudServices: CS_CONFIG + } ) + .then( editor => { + window.editor = editor; + } ) + .catch( err => { + console.error( err.stack ); + } ); diff --git a/docs/_snippets/features/special-characters-new-category.html b/docs/_snippets/features/special-characters-new-category.html new file mode 100644 index 0000000..b89d927 --- /dev/null +++ b/docs/_snippets/features/special-characters-new-category.html @@ -0,0 +1,15 @@ +
+

The Flavorful Tuscany Meetup

+

Welcome letter

+

Dear Guest,

+

We are delighted to welcome you to the annual Flavorful Tuscany Meetup and hope you will enjoy the programme as well as your stay at the Bilancino Hotel.

+

Please arrive at the Bilancino Hotel reception desk at least half an hour earlier to make sure that the registration process goes as smoothly as possible.

+

We look forward to welcoming you to the event. The full schedule can be found below.

+
+ + diff --git a/docs/_snippets/features/special-characters-new-category.js b/docs/_snippets/features/special-characters-new-category.js new file mode 100644 index 0000000..67b57c0 --- /dev/null +++ b/docs/_snippets/features/special-characters-new-category.js @@ -0,0 +1,65 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/* globals window, document, console, ClassicEditor */ + +import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config'; + +ClassicEditor + .create( document.querySelector( '#snippet-special-characters-new-category' ), { + removePlugins: [ + 'SpecialCharactersArrowsExtended' + ], + toolbar: { + items: [ + 'heading', + '|', + 'bold', + 'italic', + 'bulletedList', + 'numberedList', + '|', + 'outdent', + 'indent', + '|', + 'alignment', + '|', + 'specialCharacters', + 'blockQuote', + 'link', + 'imageUpload', + 'mediaEmbed', + 'insertTable', + '|', + 'undo', + 'redo' + ], + viewportTopOffset: window.getViewportTopOffsetConfig() + }, + image: { + styles: [ + 'full', + 'alignLeft', + 'alignRight' + ], + toolbar: [ + 'imageStyle:alignLeft', + 'imageStyle:full', + 'imageStyle:alignRight', + '|', + 'imageTextAlternative' + ] + }, + table: { + contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ] + }, + cloudServices: CS_CONFIG + } ) + .then( editor => { + window.editor = editor; + } ) + .catch( err => { + console.error( err.stack ); + } ); diff --git a/docs/_snippets/features/special-characters-source.html b/docs/_snippets/features/special-characters-source.html new file mode 100644 index 0000000..e69de29 diff --git a/docs/_snippets/features/special-characters-source.js b/docs/_snippets/features/special-characters-source.js new file mode 100644 index 0000000..cfa082a --- /dev/null +++ b/docs/_snippets/features/special-characters-source.js @@ -0,0 +1,49 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/* globals window */ + +import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; +import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor'; +import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment'; +import SpecialCharactersEssentials from '@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials'; + +class SpecialCharactersEmoji extends Plugin { + static get pluginName() { + return 'SpecialCharactersEmoji'; + } + + init() { + this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Emoji', [ + { title: 'smiley face', character: '😊' }, + { title: 'rocket', character: '🚀' }, + { title: 'basketball', character: '🏀' }, + { title: 'floppy disk', character: '💾' }, + { title: 'hearth', character: '❤' } + ] ); + } +} + +class SpecialCharactersArrowsExtended extends Plugin { + static get pluginName() { + return 'SpecialCharactersArrowsExtended'; + } + + init() { + this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [ + { title: 'simple arrow left', character: '←' }, + { title: 'simple arrow up', character: '↑' }, + { title: 'simple arrow right', character: '→' }, + { title: 'simple arrow down', character: '↓' } + ] ); + } +} + +ClassicEditor.builtinPlugins.push( Alignment ); +ClassicEditor.builtinPlugins.push( SpecialCharactersEssentials ); +ClassicEditor.builtinPlugins.push( SpecialCharactersEmoji ); +ClassicEditor.builtinPlugins.push( SpecialCharactersArrowsExtended ); + +window.ClassicEditor = ClassicEditor; diff --git a/docs/_snippets/features/special-characters.html b/docs/_snippets/features/special-characters.html new file mode 100644 index 0000000..5d843c2 --- /dev/null +++ b/docs/_snippets/features/special-characters.html @@ -0,0 +1,15 @@ +
+

The Flavorful Tuscany Meetup

+

Welcome letter

+

Dear Guest,

+

We are delighted to welcome you to the annual Flavorful Tuscany Meetup and hope you will enjoy the programme as well as your stay at the Bilancino Hotel.

+

Please arrive at the Bilancino Hotel reception desk at least half an hour earlier to make sure that the registration process goes as smoothly as possible.

+

We look forward to welcoming you to the event. The full schedule can be found below.

+
+ + diff --git a/docs/_snippets/features/special-characters.js b/docs/_snippets/features/special-characters.js new file mode 100644 index 0000000..9618fdb --- /dev/null +++ b/docs/_snippets/features/special-characters.js @@ -0,0 +1,66 @@ +/** + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/* globals window, document, console, ClassicEditor */ + +import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config'; + +ClassicEditor + .create( document.querySelector( '#snippet-special-characters' ), { + removePlugins: [ + 'SpecialCharactersEmoji', + 'SpecialCharactersArrowsExtended' + ], + toolbar: { + items: [ + 'heading', + '|', + 'bold', + 'italic', + 'bulletedList', + 'numberedList', + '|', + 'outdent', + 'indent', + '|', + 'alignment', + '|', + 'specialCharacters', + 'blockQuote', + 'link', + 'imageUpload', + 'mediaEmbed', + 'insertTable', + '|', + 'undo', + 'redo' + ], + viewportTopOffset: window.getViewportTopOffsetConfig() + }, + image: { + styles: [ + 'full', + 'alignLeft', + 'alignRight' + ], + toolbar: [ + 'imageStyle:alignLeft', + 'imageStyle:full', + 'imageStyle:alignRight', + '|', + 'imageTextAlternative' + ] + }, + table: { + contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ] + }, + cloudServices: CS_CONFIG + } ) + .then( editor => { + window.editor = editor; + } ) + .catch( err => { + console.error( err.stack ); + } ); diff --git a/docs/api/special-characters.md b/docs/api/special-characters.md new file mode 100644 index 0000000..4c90694 --- /dev/null +++ b/docs/api/special-characters.md @@ -0,0 +1,34 @@ +--- +category: api-reference +--- + +# Special characters feature for CKEditor 5 + +[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-special-characters.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-special-characters) + +This package implements the special characters feature for CKEditor 5. + +## Demo + +Check out the {@link features/special-characters#demo demo in the Special characters feature} guide. + +## Documentation + +See the {@link features/special-characters Special characters feature} guide and the {@link module:special-characters/specialcharacters~SpecialCharacters} plugin documentation. + +## Installation + +```plaintext +npm install --save @ckeditor/ckeditor5-special-characters +``` + +## Contribute + +The source code of this package is available on GitHub in https://github.com/ckeditor/ckeditor5-special-characters. + +## External links + +* [`@ckeditor/ckeditor5-special-characters` on npm](https://www.npmjs.com/package/@ckeditor/ckeditor5-special-characters) +* [`ckeditor/ckeditor5-special-characters` on GitHub](https://github.com/ckeditor/ckeditor5-special-characters) +* [Issue tracker](https://github.com/ckeditor/ckeditor5/issues) +* [Changelog](https://github.com/ckeditor/ckeditor5-special-characters/blob/master/CHANGELOG.md) diff --git a/docs/features/special-characters.md b/docs/features/special-characters.md new file mode 100644 index 0000000..dab0252 --- /dev/null +++ b/docs/features/special-characters.md @@ -0,0 +1,147 @@ +--- +category: features +menu-title: Special characters +--- + +# Special characters + +The {@link module:special-characters/specialcharacters~SpecialCharacters} plugin provides a possibility to insert a special character into the rich-text editor. + +## Demo + +Use the editor below to see the {@link module:special-characters/specialcharacters~SpecialCharacters} plugin in action. + +{@snippet features/special-characters-source} + +{@snippet features/special-characters} + +## Installation + +To add this feature to your rich-text editor, install the [`@ckeditor/ckeditor5-special-characters`](https://www.npmjs.com/package/@ckeditor/ckeditor5-special-characters) package: + +```plaintext +npm install --save @ckeditor/ckeditor5-special-characters +``` + +And add it to your plugin list configuration: + +```js +// The plugin provides API for management special characters and their categories. +import SpecialCharacters from '@ckeditor/ckeditor5-special-characters/src/specialcharacters'; + +// `SpecialCharacters` does not provide any special character. They are delivered by another plugins. +// You can import those ones that you want to use in the editor. +import SpecialCharactersCurrency from '@ckeditor/ckeditor5-special-characters/src/specialcharacterscurrency'; +import SpecialCharactersMathematical from '@ckeditor/ckeditor5-special-characters/src/specialcharactersmathematical'; +import SpecialCharactersArrows from '@ckeditor/ckeditor5-special-characters/src/specialcharactersarrows'; +import SpecialCharactersLatin from '@ckeditor/ckeditor5-special-characters/src/specialcharacterslatin'; +import SpecialCharactersText from '@ckeditor/ckeditor5-special-characters/src/specialcharacterstext'; + +// Or import the plugin combining basic set of characters. The imports above can be replaced with the `SpecialCharactersEssentials` plugin. +import SpecialCharactersEssentials from '@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials'; + +ClassicEditor + .create( document.querySelector( '#editor' ), { + plugins: [ SpecialCharacters, ... ], + toolbar: [ 'specialCharacters', ... ], + } ) + .then( ... ) + .catch( ... ); +``` + + + Read more about {@link builds/guides/integration/installing-plugins installing plugins}. + + +## Common API + +The {@link module:special-characters/specialcharacters~SpecialCharacters} plugin registers the UI button component (`'specialCharacters'`). + + + We recommend using the official {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more. + + +## Special characters in the package + +The `@ckeditor/ckeditor5-special-characters` package provides a few basic special characters grouped into the following categories: + +- {@link module:special-characters/specialcharactersarrows~SpecialCharactersArrows} – arrows special characters, +- {@link module:special-characters/specialcharacterscurrency~SpecialCharactersCurrency} - currency special characters, +- {@link module:special-characters/specialcharacterslatin~SpecialCharactersLatin} – Latin special characters, +- {@link module:special-characters/specialcharactersmathematical~SpecialCharactersMathematical} – Mathematical special characters, +- {@link module:special-characters/specialcharacterstext~SpecialCharactersText} – Text special characters +- {@link module:special-characters/specialcharactersessentials~SpecialCharactersEssentials} – combining plugins listed above. + +## Adding a new special character category + +By using the {@link module:special-characters/specialcharacters~SpecialCharacters#addItems `SpecialCharacters#addItems()`} function, you can define a new special characters category. + +Let's create a simple plugin that provides the `Emoji` category in the special characters dropdown. + +```js +import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; + +export default class SpecialCharactersEmoji extends Plugin { + static get pluginName() { + return 'SpecialCharactersEmoji'; + } + + init() { + this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Emoji', [ + { title: 'smiley face', character: '😊' }, + { title: 'rocket', character: '🚀' }, + { title: 'basketball', character: '🏀' }, + { title: 'floppy disk', character: '💾' }, + { title: 'hearth', character: '❤' } + ] ); + } +} +``` + +After adding the above plugin into the editor, the new special characters category will be available in the dropdown. + + + A title of a special character must be unique across the entire special characters set. + + +### Custom special characters category demo + +Use the special character icon in the editor's toolbar then select `Emoji` in the select dropdown in order to insert a emoji into the editor. + +{@snippet features/special-characters-new-category} + +## Adding a new special characters to existing category + +By using the {@link module:special-characters/specialcharacters~SpecialCharacters#addItems `SpecialCharacters#addItems()`} function, you can also add new special characters into existing category. + +```js +class SpecialCharactersArrowsExtended extends Plugin { + static get pluginName() { + return 'SpecialCharactersArrowsExtended'; + } + + init() { + // The `Arrows` category is provided by the `SpecialCharactersArrows` plugin. + this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [ + { title: 'simple arrow left', character: '←' }, + { title: 'simple arrow up', character: '↑' }, + { title: 'simple arrow right', character: '→' }, + { title: 'simple arrow down', character: '↓' } + ] ); + } +} +``` + + + A title of a special character must be unique across the entire special characters set. + + +### Extending existing special characters category category demo + +Use the special character icon in the editor's toolbar then select `Arrows` in the select dropdown in order to add new arrows. + +{@snippet features/special-characters-extended-category} + +## Contribute + +The source code of the feature is available on GitHub in https://github.com/ckeditor/ckeditor5-special-characters. diff --git a/lang/contexts.json b/lang/contexts.json new file mode 100644 index 0000000..6c0890d --- /dev/null +++ b/lang/contexts.json @@ -0,0 +1,256 @@ +{ + "Special characters": "Special characters", + "leftwards double arrow": "leftwards double arrow", + "rightwards double arrow": "rightwards double arrow", + "upwards double arrow": "upwards double arrow", + "downwards double arrow": "downwards double arrow", + "leftwards dashed arrow": "leftwards dashed arrow", + "rightwards dashed arrow": "rightwards dashed arrow", + "upwards dashed arrow": "upwards dashed arrow", + "downwards dashed arrow": "downwards dashed arrow", + "leftwards arrow to bar": "leftwards arrow to bar", + "rightwards arrow to bar": "rightwards arrow to bar", + "upwards arrow to bar": "upwards arrow to bar", + "downwards arrow to bar": "downwards arrow to bar", + "up down arrow with base": "up down arrow with base", + "back with leftwards arrow above": "back with leftwards arrow above", + "end with leftwards arrow above": "end with leftwards arrow above", + "on with exclamation mark with left right arrow above": "on with exclamation mark with left right arrow above", + "soon with rightwards arrow above": "soon with rightwards arrow above", + "top with upwards arrow above": "top with upwards arrow above", + "Dollar sign": "Dollar sign", + "Euro sign": "Euro sign", + "Yen sign": "Yen sign", + "Pound sign": "Pound sign", + "Cent sign": "Cent sign", + "Euro-currency sign": "Euro-currency sign", + "Colon sign": "Colon sign", + "Cruzeiro sign": "Cruzeiro sign", + "French franc sign": "French franc sign", + "Lira sign": "Lira sign", + "Currency sign": "Currency sign", + "Bitcoin sign": "Bitcoin sign", + "Mill sign": "Mill sign", + "Naira sign": "Naira sign", + "Peseta sign": "Peseta sign", + "Rupee sign": "Rupee sign", + "Won sign": "Won sign", + "New sheqel sign": "New sheqel sign", + "Dong sign": "Dong sign", + "Kip sign": "Kip sign", + "Tugrik sign": "Tugrik sign", + "Drachma sign": "Drachma sign", + "German penny sign": "German penny sign", + "Peso sign": "Peso sign", + "Guarani sign": "Guarani sign", + "Austral sign": "Austral sign", + "Hryvnia sign": "Hryvnia sign", + "Cedi sign": "Cedi sign", + "Livre tournois sign": "Livre tournois sign", + "Spesmilo sign": "Spesmilo sign", + "Tenge sign": "Tenge sign", + "Indian rupee sign": "Indian rupee sign", + "Turkish lira sign": "Turkish lira sign", + "Nordic mark sign": "Nordic mark sign", + "Manat sign": "Manat sign", + "Ruble sign": "Ruble sign", + "Latin capital letter a with macron": "Latin capital letter a with macron", + "Latin small letter a with macron": "Latin small letter a with macron", + "Latin capital letter a with breve": "Latin capital letter a with breve", + "Latin small letter a with breve": "Latin small letter a with breve", + "Latin capital letter a with ogonek": "Latin capital letter a with ogonek", + "Latin small letter a with ogonek": "Latin small letter a with ogonek", + "Latin capital letter c with acute": "Latin capital letter c with acute", + "Latin small letter c with acute": "Latin small letter c with acute", + "Latin capital letter c with circumflex": "Latin capital letter c with circumflex", + "Latin small letter c with circumflex": "Latin small letter c with circumflex", + "Latin capital letter c with dot above": "Latin capital letter c with dot above", + "Latin small letter c with dot above": "Latin small letter c with dot above", + "Latin capital letter c with caron": "Latin capital letter c with caron", + "Latin small letter c with caron": "Latin small letter c with caron", + "Latin capital letter d with caron": "Latin capital letter d with caron", + "Latin small letter d with caron": "Latin small letter d with caron", + "Latin capital letter d with stroke": "Latin capital letter d with stroke", + "Latin small letter d with stroke": "Latin small letter d with stroke", + "Latin capital letter e with macron": "Latin capital letter e with macron", + "Latin small letter e with macron": "Latin small letter e with macron", + "Latin capital letter e with breve": "Latin capital letter e with breve", + "Latin small letter e with breve": "Latin small letter e with breve", + "Latin capital letter e with dot above": "Latin capital letter e with dot above", + "Latin small letter e with dot above": "Latin small letter e with dot above", + "Latin capital letter e with ogonek": "Latin capital letter e with ogonek", + "Latin small letter e with ogonek": "Latin small letter e with ogonek", + "Latin capital letter e with caron": "Latin capital letter e with caron", + "Latin small letter e with caron": "Latin small letter e with caron", + "Latin capital letter g with circumflex": "Latin capital letter g with circumflex", + "Latin small letter g with circumflex": "Latin small letter g with circumflex", + "Latin capital letter g with breve": "Latin capital letter g with breve", + "Latin small letter g with breve": "Latin small letter g with breve", + "Latin capital letter g with dot above": "Latin capital letter g with dot above", + "Latin small letter g with dot above": "Latin small letter g with dot above", + "Latin capital letter g with cedilla": "Latin capital letter g with cedilla", + "Latin small letter g with cedilla": "Latin small letter g with cedilla", + "Latin capital letter h with circumflex": "Latin capital letter h with circumflex", + "Latin small letter h with circumflex": "Latin small letter h with circumflex", + "Latin capital letter h with stroke": "Latin capital letter h with stroke", + "Latin small letter h with stroke": "Latin small letter h with stroke", + "Latin capital letter i with tilde": "Latin capital letter i with tilde", + "Latin small letter i with tilde": "Latin small letter i with tilde", + "Latin capital letter i with macron": "Latin capital letter i with macron", + "Latin small letter i with macron": "Latin small letter i with macron", + "Latin capital letter i with breve": "Latin capital letter i with breve", + "Latin small letter i with breve": "Latin small letter i with breve", + "Latin capital letter i with ogonek": "Latin capital letter i with ogonek", + "Latin small letter i with ogonek": "Latin small letter i with ogonek", + "Latin capital letter i with dot above": "Latin capital letter i with dot above", + "Latin small letter dotless i": "Latin small letter dotless i", + "Latin capital ligature ij": "Latin capital ligature ij", + "Latin small ligature ij": "Latin small ligature ij", + "Latin capital letter j with circumflex": "Latin capital letter j with circumflex", + "Latin small letter j with circumflex": "Latin small letter j with circumflex", + "Latin capital letter k with cedilla": "Latin capital letter k with cedilla", + "Latin small letter k with cedilla": "Latin small letter k with cedilla", + "Latin small letter kra": "Latin small letter kra", + "Latin capital letter l with acute": "Latin capital letter l with acute", + "Latin small letter l with acute": "Latin small letter l with acute", + "Latin capital letter l with cedilla": "Latin capital letter l with cedilla", + "Latin small letter l with cedilla": "Latin small letter l with cedilla", + "Latin capital letter l with caron": "Latin capital letter l with caron", + "Latin small letter l with caron": "Latin small letter l with caron", + "Latin capital letter l with middle dot": "Latin capital letter l with middle dot", + "Latin small letter l with middle dot": "Latin small letter l with middle dot", + "Latin capital letter l with stroke": "Latin capital letter l with stroke", + "Latin small letter l with stroke": "Latin small letter l with stroke", + "Latin capital letter n with acute": "Latin capital letter n with acute", + "Latin small letter n with acute": "Latin small letter n with acute", + "Latin capital letter n with cedilla": "Latin capital letter n with cedilla", + "Latin small letter n with cedilla": "Latin small letter n with cedilla", + "Latin capital letter n with caron": "Latin capital letter n with caron", + "Latin small letter n with caron": "Latin small letter n with caron", + "Latin small letter n preceded by apostrophe": "Latin small letter n preceded by apostrophe", + "Latin capital letter eng": "Latin capital letter eng", + "Latin small letter eng": "Latin small letter eng", + "Latin capital letter o with macron": "Latin capital letter o with macron", + "Latin small letter o with macron": "Latin small letter o with macron", + "Latin capital letter o with breve": "Latin capital letter o with breve", + "Latin small letter o with breve": "Latin small letter o with breve", + "Latin capital letter o with double acute": "Latin capital letter o with double acute", + "Latin small letter o with double acute": "Latin small letter o with double acute", + "Latin capital ligature oe": "Latin capital ligature oe", + "Latin small ligature oe": "Latin small ligature oe", + "Latin capital letter r with acute": "Latin capital letter r with acute", + "Latin small letter r with acute": "Latin small letter r with acute", + "Latin capital letter r with cedilla": "Latin capital letter r with cedilla", + "Latin small letter r with cedilla": "Latin small letter r with cedilla", + "Latin capital letter r with caron": "Latin capital letter r with caron", + "Latin small letter r with caron": "Latin small letter r with caron", + "Latin capital letter s with acute": "Latin capital letter s with acute", + "Latin small letter s with acute": "Latin small letter s with acute", + "Latin capital letter s with circumflex": "Latin capital letter s with circumflex", + "Latin small letter s with circumflex": "Latin small letter s with circumflex", + "Latin capital letter s with cedilla": "Latin capital letter s with cedilla", + "Latin small letter s with cedilla": "Latin small letter s with cedilla", + "Latin capital letter s with caron": "Latin capital letter s with caron", + "Latin small letter s with caron": "Latin small letter s with caron", + "Latin capital letter t with cedilla": "Latin capital letter t with cedilla", + "Latin small letter t with cedilla": "Latin small letter t with cedilla", + "Latin capital letter t with caron": "Latin capital letter t with caron", + "Latin small letter t with caron": "Latin small letter t with caron", + "Latin capital letter t with stroke": "Latin capital letter t with stroke", + "Latin small letter t with stroke": "Latin small letter t with stroke", + "Latin capital letter u with tilde": "Latin capital letter u with tilde", + "Latin small letter u with tilde": "Latin small letter u with tilde", + "Latin capital letter u with macron": "Latin capital letter u with macron", + "Latin small letter u with macron": "Latin small letter u with macron", + "Latin capital letter u with breve": "Latin capital letter u with breve", + "Latin small letter u with breve": "Latin small letter u with breve", + "Latin capital letter u with ring above": "Latin capital letter u with ring above", + "Latin small letter u with ring above": "Latin small letter u with ring above", + "Latin capital letter u with double acute": "Latin capital letter u with double acute", + "Latin small letter u with double acute": "Latin small letter u with double acute", + "Latin capital letter u with ogonek": "Latin capital letter u with ogonek", + "Latin small letter u with ogonek": "Latin small letter u with ogonek", + "Latin capital letter w with circumflex": "Latin capital letter w with circumflex", + "Latin small letter w with circumflex": "Latin small letter w with circumflex", + "Latin capital letter y with circumflex": "Latin capital letter y with circumflex", + "Latin small letter y with circumflex": "Latin small letter y with circumflex", + "Latin capital letter y with diaeresis": "Latin capital letter y with diaeresis", + "Latin capital letter z with acute": "Latin capital letter z with acute", + "Latin small letter z with acute": "Latin small letter z with acute", + "Latin capital letter z with dot above": "Latin capital letter z with dot above", + "Latin small letter z with dot above": "Latin small letter z with dot above", + "Latin capital letter z with caron": "Latin capital letter z with caron", + "Latin small letter z with caron": "Latin small letter z with caron", + "Latin small letter long s": "Latin small letter long s", + "Less-than sign": "Less-than sign", + "Greater-than sign": "Greater-than sign", + "Less-than or equal to": "Less-than or equal to", + "Greater-than or equal to": "Greater-than or equal to", + "En dash": "En dash", + "Em dash": "Em dash", + "Macron": "Macron", + "Overline": "Overline", + "Degree sign": "Degree sign", + "Minus sign": "Minus sign", + "Plus-minus sign": "Plus-minus sign", + "Division sign": "Division sign", + "Fraction slash": "Fraction slash", + "Multiplication sign": "Multiplication sign", + "Latin small letter f with hook": "Latin small letter f with hook", + "Integral": "Integral", + "N-ary summation": "N-ary summation", + "Infinity": "Infinity", + "Square root": "Square root", + "Tilde operator": "Tilde operator", + "Approximately equal to": "Approximately equal to", + "Almost equal to": "Almost equal to", + "Not equal to": "Not equal to", + "Identical to": "Identical to", + "Element of": "Element of", + "Not an element of": "Not an element of", + "Contains as member": "Contains as member", + "N-ary product": "N-ary product", + "Logical and": "Logical and", + "Logical or": "Logical or", + "Not sign": "Not sign", + "Intersection": "Intersection", + "Union": "Union", + "Partial differential": "Partial differential", + "For all": "For all", + "There exists": "There exists", + "Empty set": "Empty set", + "Nabla": "Nabla", + "Asterisk operator": "Asterisk operator", + "Proportional to": "Proportional to", + "Angle": "Angle", + "Vulgar fraction one quarter": "Vulgar fraction one quarter", + "Vulgar fraction one half": "Vulgar fraction one half", + "Vulgar fraction three quarters": "Vulgar fraction three quarters", + "Single left-pointing angle quotation mark": "Single left-pointing angle quotation mark", + "Single right-pointing angle quotation mark": "Single right-pointing angle quotation mark", + "Left-pointing double angle quotation mark": "Left-pointing double angle quotation mark", + "Right-pointing double angle quotation mark": "Right-pointing double angle quotation mark", + "Left single quotation mark": "Left single quotation mark", + "Right single quotation mark": "Right single quotation mark", + "Left double quotation mark": "Left double quotation mark", + "Right double quotation mark": "Right double quotation mark", + "Single low-9 quotation mark": "Single low-9 quotation mark", + "Double low-9 quotation mark": "Double low-9 quotation mark", + "Inverted exclamation mark": "Inverted exclamation mark", + "Inverted question mark": "Inverted question mark", + "Two dot leader": "Two dot leader", + "Horizontal ellipsis": "Horizontal ellipsis", + "Double dagger": "Double dagger", + "Per mille sign": "Per mille sign", + "Per ten thousand sign": "Per ten thousand sign", + "Double exclamation mark": "Double exclamation mark", + "Question exclamation mark": "Question exclamation mark", + "Exclamation question mark": "Exclamation question mark", + "Double question mark": "Double question mark", + "Copyright sign": "Copyright sign", + "Registered sign": "Registered sign", + "Trade mark sign": "Trade mark sign", + "Section sign": "Section sign", + "Paragraph sign": "Paragraph sign", + "Reversed paragraph sign": "Reversed paragraph sign" +} diff --git a/src/insertspecialcharactercommand.js b/src/insertspecialcharactercommand.js deleted file mode 100644 index b32bfbb..0000000 --- a/src/insertspecialcharactercommand.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -/** - * @module special-characters/insertspecialcharactercommand - */ - -import Command from '@ckeditor/ckeditor5-core/src/command'; - -/** - * @extends module:core/command~Command - */ -export default class InsertSpecialCharacterCommand extends Command { - /** - * Creates an instance of the command. - * - * @param {module:core/editor/editor~Editor} editor - */ - constructor( editor ) { - super( editor ); - - /** - * @readonly - * @private - * @member {module:typing/inputcommand~InputCommand} #_inputCommand - */ - this._inputCommand = editor.commands.get( 'input' ); - - // Use the state of `Input` command to determine whether the special characters could be inserted. - this.bind( 'isEnabled' ).to( this._inputCommand, 'isEnabled' ); - } - - /** - * @param {Object} options - * @param {String} options.item An id of the special character that should be added to the editor. - */ - execute( options ) { - const editor = this.editor; - const character = editor.plugins.get( 'SpecialCharacters' ).getCharacter( options.item ); - - this._inputCommand.execute( { text: character } ); - } -} diff --git a/src/specialcharacters.js b/src/specialcharacters.js index a52a587..dc553a4 100644 --- a/src/specialcharacters.js +++ b/src/specialcharacters.js @@ -9,7 +9,6 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharactersUI from './specialcharactersui'; -import SpecialCharactersEditing from './specialcharactersediting'; import '../theme/specialcharacters.css'; @@ -19,6 +18,20 @@ import '../theme/specialcharacters.css'; * @extends module:core/plugin~Plugin */ export default class SpecialCharacters extends Plugin { + /** + * @inheritDoc + */ + static get requires() { + return [ SpecialCharactersUI ]; + } + + /** + * @inheritDoc + */ + static get pluginName() { + return 'SpecialCharacters'; + } + /** * @inheritDoc */ @@ -42,20 +55,6 @@ export default class SpecialCharacters extends Plugin { this._groups = new Map(); } - /** - * @inheritDoc - */ - static get requires() { - return [ SpecialCharactersEditing, SpecialCharactersUI ]; - } - - /** - * @inheritDoc - */ - static get pluginName() { - return 'SpecialCharacters'; - } - /** * Adds a collection of special characters to specified group. A title of a special character must be unique. * @@ -118,6 +117,6 @@ export default class SpecialCharacters extends Plugin { /** * @typedef {Object} module:special-characters/specialcharacters~SpecialCharacterDefinition * - * @property {String} title A unique title of the character. - * @property {String} character A symbol that should be inserted to the editor. + * @property {String} title A unique name of the character (e.g. "greek small letter epsilon"). + * @property {String} character A human-readable character displayed as label (e.g. "ε"). */ diff --git a/src/specialcharactersarrows.js b/src/specialcharactersarrows.js index 7494a26..bb1bb5d 100644 --- a/src/specialcharactersarrows.js +++ b/src/specialcharactersarrows.js @@ -4,45 +4,58 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharactersarrows */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharacters from './specialcharacters'; +/** + * A plugin provides special characters for the "Arrows" category. + * + * ClassicEditor + * .create( { + * plugins: [ ..., SpecialCharacters, SpecialCharactersArrows ], + * } ) + * .then( ... ) + * .catch( ... ); + * + * @extends module:core/plugin~Plugin + */ export default class SpecialCharactersArrows extends Plugin { /** * @inheritDoc */ static get requires() { - return [ - SpecialCharacters - ]; + return [ SpecialCharacters ]; } /** * @inheritDoc */ init() { - this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [ - { title: 'leftwards double arrow', character: '⇐' }, - { title: 'rightwards double arrow', character: '⇒' }, - { title: 'upwards double arrow', character: '⇑' }, - { title: 'downwards double arrow', character: '⇓' }, - { title: 'leftwards dashed arrow', character: '⇠' }, - { title: 'rightwards dashed arrow', character: '⇢' }, - { title: 'upwards dashed arrow', character: '⇡' }, - { title: 'downwards dashed arrow', character: '⇣' }, - { title: 'leftwards arrow to bar', character: '⇤' }, - { title: 'rightwards arrow to bar', character: '⇥' }, - { title: 'upwards arrow to bar', character: '⤒' }, - { title: 'downwards arrow to bar', character: '⤓' }, - { title: 'up down arrow with base', character: '↨' }, - { title: 'back with leftwards arrow above', character: '🔙' }, - { title: 'end with leftwards arrow above', character: '🔚' }, - { title: 'on with exclamation mark with left right arrow above', character: '🔛' }, - { title: 'soon with rightwards arrow above', character: '🔜' }, - { title: 'top with upwards arrow above', character: '🔝' } + const editor = this.editor; + const t = editor.t; + + editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [ + { title: t( 'leftwards double arrow' ), character: '⇐' }, + { title: t( 'rightwards double arrow' ), character: '⇒' }, + { title: t( 'upwards double arrow' ), character: '⇑' }, + { title: t( 'downwards double arrow' ), character: '⇓' }, + { title: t( 'leftwards dashed arrow' ), character: '⇠' }, + { title: t( 'rightwards dashed arrow' ), character: '⇢' }, + { title: t( 'upwards dashed arrow' ), character: '⇡' }, + { title: t( 'downwards dashed arrow' ), character: '⇣' }, + { title: t( 'leftwards arrow to bar' ), character: '⇤' }, + { title: t( 'rightwards arrow to bar' ), character: '⇥' }, + { title: t( 'upwards arrow to bar' ), character: '⤒' }, + { title: t( 'downwards arrow to bar' ), character: '⤓' }, + { title: t( 'up down arrow with base' ), character: '↨' }, + { title: t( 'back with leftwards arrow above' ), character: '🔙' }, + { title: t( 'end with leftwards arrow above' ), character: '🔚' }, + { title: t( 'on with exclamation mark with left right arrow above' ), character: '🔛' }, + { title: t( 'soon with rightwards arrow above' ), character: '🔜' }, + { title: t( 'top with upwards arrow above' ), character: '🔝' } ] ); } } diff --git a/src/specialcharacterscurrency.js b/src/specialcharacterscurrency.js index 5c1d05d..f63759d 100644 --- a/src/specialcharacterscurrency.js +++ b/src/specialcharacterscurrency.js @@ -4,187 +4,76 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharacterscurrency */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharacters from './specialcharacters'; +/** + * A plugin provides special characters for the "Currency" category. + * + * ClassicEditor + * .create( { + * plugins: [ ..., SpecialCharacters, SpecialCharactersCurrency ], + * } ) + * .then( ... ) + * .catch( ... ); + * + * @extends module:core/plugin~Plugin + */ export default class SpecialCharactersCurrency extends Plugin { /** * @inheritDoc */ static get requires() { - return [ - SpecialCharacters - ]; + return [ SpecialCharacters ]; } /** * @inheritDoc */ init() { - this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Currency', [ - { - character: '$', - title: 'Dollar sign' - }, - { - character: '€', - title: 'Euro sign' - }, - { - character: '¥', - title: 'Yen sign' - }, - { - character: '£', - title: 'Pound sign' - }, - { - character: '¢', - title: 'Cent sign' - }, - { - character: '₠', - title: 'Euro-currency sign' - }, - { - character: '₡', - title: 'Colon sign' - }, - { - character: '₢', - title: 'Cruzeiro sign' - }, - { - character: '₣', - title: 'French franc sign' - }, - { - character: '₤', - title: 'Lira sign' - }, - { - character: '¤', - title: 'Currency sign' - }, - { - character: '₿', - title: 'Bitcoin sign' - }, - { - character: '₥', - title: 'Mill sign' - }, - { - character: '₦', - title: 'Naira sign' - }, - { - character: '₧', - title: 'Peseta sign' - }, - { - character: '₨', - title: 'Rupee sign' - }, - { - character: '₩', - title: 'Won sign' - }, - { - character: '₪', - title: 'New sheqel sign' - }, - { - character: '₫', - title: 'Dong sign' - }, - { - character: '₭', - title: 'Kip sign' - }, - { - character: '₮', - title: 'Tugrik sign' - }, - { - character: '₯', - title: 'Drachma sign' - }, - { - character: '₰', - title: 'German penny sign' - }, - { - character: '₱', - title: 'Peso sign' - }, - { - character: '₲', - title: 'Guarani sign' - }, - { - character: '₳', - title: 'Austral sign' - }, - { - character: '₴', - title: 'Hryvnia sign' - }, - { - character: '₵', - title: 'Cedi sign' - }, - { - character: '₶', - title: 'Livre tournois sign' - }, - { - character: '₷', - title: 'Spesmilo sign' - }, - { - character: '₸', - title: 'Tenge sign' - }, - { - character: '₹', - title: 'Indian rupee sign' - }, - { - character: '₺', - title: 'Turkish lira sign' - }, - { - character: '₻', - title: 'Nordic mark sign' - }, - { - character: '₼', - title: 'Manat sign' - }, - { - character: '₽', - title: 'Ruble sign' - }/* , - { - character: '円', - title: '' - }, - { - character: '元', - title: '' - }, - { - character: '圓', - title: '' - }, - { - character: '圆', - title: '' - } */ + const editor = this.editor; + const t = editor.t; + + editor.plugins.get( 'SpecialCharacters' ).addItems( 'Currency', [ + { character: '$', title: t( 'Dollar sign' ) }, + { character: '€', title: t( 'Euro sign' ) }, + { character: '¥', title: t( 'Yen sign' ) }, + { character: '£', title: t( 'Pound sign' ) }, + { character: '¢', title: t( 'Cent sign' ) }, + { character: '₠', title: t( 'Euro-currency sign' ) }, + { character: '₡', title: t( 'Colon sign' ) }, + { character: '₢', title: t( 'Cruzeiro sign' ) }, + { character: '₣', title: t( 'French franc sign' ) }, + { character: '₤', title: t( 'Lira sign' ) }, + { character: '¤', title: t( 'Currency sign' ) }, + { character: '₿', title: t( 'Bitcoin sign' ) }, + { character: '₥', title: t( 'Mill sign' ) }, + { character: '₦', title: t( 'Naira sign' ) }, + { character: '₧', title: t( 'Peseta sign' ) }, + { character: '₨', title: t( 'Rupee sign' ) }, + { character: '₩', title: t( 'Won sign' ) }, + { character: '₪', title: t( 'New sheqel sign' ) }, + { character: '₫', title: t( 'Dong sign' ) }, + { character: '₭', title: t( 'Kip sign' ) }, + { character: '₮', title: t( 'Tugrik sign' ) }, + { character: '₯', title: t( 'Drachma sign' ) }, + { character: '₰', title: t( 'German penny sign' ) }, + { character: '₱', title: t( 'Peso sign' ) }, + { character: '₲', title: t( 'Guarani sign' ) }, + { character: '₳', title: t( 'Austral sign' ) }, + { character: '₴', title: t( 'Hryvnia sign' ) }, + { character: '₵', title: t( 'Cedi sign' ) }, + { character: '₶', title: t( 'Livre tournois sign' ) }, + { character: '₷', title: t( 'Spesmilo sign' ) }, + { character: '₸', title: t( 'Tenge sign' ) }, + { character: '₹', title: t( 'Indian rupee sign' ) }, + { character: '₺', title: t( 'Turkish lira sign' ) }, + { character: '₻', title: t( 'Nordic mark sign' ) }, + { character: '₼', title: t( 'Manat sign' ) }, + { character: '₽', title: t( 'Ruble sign' ) } ] ); } } diff --git a/src/specialcharactersediting.js b/src/specialcharactersediting.js deleted file mode 100644 index 942a3bb..0000000 --- a/src/specialcharactersediting.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -/** - * @module special-characters/specialcharactersediting - */ - -import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import Typing from '@ckeditor/ckeditor5-typing/src/typing'; -import InsertSpecialCharacterCommand from './insertspecialcharactercommand'; - -/** - * Special characters editing plugin. - * - * It registers the {@link module:special-characters/insertspecialcharactercommand~InsertSpecialCharacterCommand Special Character} command. - * - * @extends module:core/plugin~Plugin - */ -export default class SpecialCharactersEditing extends Plugin { - /** - * @inheritDoc - */ - static get pluginName() { - return 'SpecialCharactersEditing'; - } - - /** - * @inheritDoc - */ - static get requires() { - return [ Typing ]; - } - - /** - * @inheritDoc - */ - init() { - const editor = this.editor; - - const command = new InsertSpecialCharacterCommand( editor ); - editor.commands.add( 'insertSpecialCharacter', command ); - } -} diff --git a/src/specialcharactersessentials.js b/src/specialcharactersessentials.js index 30262d7..09f6b8d 100644 --- a/src/specialcharactersessentials.js +++ b/src/specialcharactersessentials.js @@ -4,7 +4,7 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharactersessentials */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; @@ -25,6 +25,8 @@ import SpecialCharactersText from './specialcharacterstext'; * } ) * .then( ... ) * .catch( ... ); + * + * @extends module:core/plugin~Plugin */ export default class SpecialCharactersEssentials extends Plugin { /** diff --git a/src/specialcharacterslatin.js b/src/specialcharacterslatin.js index 2cccff0..131d343 100644 --- a/src/specialcharacterslatin.js +++ b/src/specialcharacterslatin.js @@ -4,539 +4,168 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharacterslatin */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharacters from './specialcharacters'; +/** + * A plugin provides special characters for the "Latin" category. + * + * ClassicEditor + * .create( { + * plugins: [ ..., SpecialCharacters, SpecialCharactersLatin ], + * } ) + * .then( ... ) + * .catch( ... ); + * + * @extends module:core/plugin~Plugin + */ export default class SpecialCharactersLatin extends Plugin { /** * @inheritDoc */ static get requires() { - return [ - SpecialCharacters - ]; + return [ SpecialCharacters ]; } /** * @inheritDoc */ init() { - this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Latin', [ - { - character: 'Ā', - title: 'Latin capital letter a with macron' - }, - { - character: 'ā', - title: 'Latin small letter a with macron' - }, - { - character: 'Ă', - title: 'Latin capital letter a with breve' - }, - { - character: 'ă', - title: 'Latin small letter a with breve' - }, - { - character: 'Ą', - title: 'Latin capital letter a with ogonek' - }, - { - character: 'ą', - title: 'Latin small letter a with ogonek' - }, - { - character: 'Ć', - title: 'Latin capital letter c with acute' - }, - { - character: 'ć', - title: 'Latin small letter c with acute' - }, - { - character: 'Ĉ', - title: 'Latin capital letter c with circumflex' - }, - { - character: 'ĉ', - title: 'Latin small letter c with circumflex' - }, - { - character: 'Ċ', - title: 'Latin capital letter c with dot above' - }, - { - character: 'ċ', - title: 'Latin small letter c with dot above' - }, - { - character: 'Č', - title: 'Latin capital letter c with caron' - }, - { - character: 'č', - title: 'Latin small letter c with caron' - }, - { - character: 'Ď', - title: 'Latin capital letter d with caron' - }, - { - character: 'ď', - title: 'Latin small letter d with caron' - }, - { - character: 'Đ', - title: 'Latin capital letter d with stroke' - }, - { - character: 'đ', - title: 'Latin small letter d with stroke' - }, - { - character: 'Ē', - title: 'Latin capital letter e with macron' - }, - { - character: 'ē', - title: 'Latin small letter e with macron' - }, - { - character: 'Ĕ', - title: 'Latin capital letter e with breve' - }, - { - character: 'ĕ', - title: 'Latin small letter e with breve' - }, - { - character: 'Ė', - title: 'Latin capital letter e with dot above' - }, - { - character: 'ė', - title: 'Latin small letter e with dot above' - }, - { - character: 'Ę', - title: 'Latin capital letter e with ogonek' - }, - { - character: 'ę', - title: 'Latin small letter e with ogonek' - }, - { - character: 'Ě', - title: 'Latin capital letter e with caron' - }, - { - character: 'ě', - title: 'Latin small letter e with caron' - }, - { - character: 'Ĝ', - title: 'Latin capital letter g with circumflex' - }, - { - character: 'ĝ', - title: 'Latin small letter g with circumflex' - }, - { - character: 'Ğ', - title: 'Latin capital letter g with breve' - }, - { - character: 'ğ', - title: 'Latin small letter g with breve' - }, - { - character: 'Ġ', - title: 'Latin capital letter g with dot above' - }, - { - character: 'ġ', - title: 'Latin small letter g with dot above' - }, - { - character: 'Ģ', - title: 'Latin capital letter g with cedilla' - }, - { - character: 'ģ', - title: 'Latin small letter g with cedilla' - }, - { - character: 'Ĥ', - title: 'Latin capital letter h with circumflex' - }, - { - character: 'ĥ', - title: 'Latin small letter h with circumflex' - }, - { - character: 'Ħ', - title: 'Latin capital letter h with stroke' - }, - { - character: 'ħ', - title: 'Latin small letter h with stroke' - }, - { - character: 'Ĩ', - title: 'Latin capital letter i with tilde' - }, - { - character: 'ĩ', - title: 'Latin small letter i with tilde' - }, - { - character: 'Ī', - title: 'Latin capital letter i with macron' - }, - { - character: 'ī', - title: 'Latin small letter i with macron' - }, - { - character: 'Ĭ', - title: 'Latin capital letter i with breve' - }, - { - character: 'ĭ', - title: 'Latin small letter i with breve' - }, - { - character: 'Į', - title: 'Latin capital letter i with ogonek' - }, - { - character: 'į', - title: 'Latin small letter i with ogonek' - }, - { - character: 'İ', - title: 'Latin capital letter i with dot above' - }, - { - character: 'ı', - title: 'Latin small letter dotless i' - }, - { - character: 'IJ', - title: 'Latin capital ligature ij' - }, - { - character: 'ij', - title: 'Latin small ligature ij' - }, - { - character: 'Ĵ', - title: 'Latin capital letter j with circumflex' - }, - { - character: 'ĵ', - title: 'Latin small letter j with circumflex' - }, - { - character: 'Ķ', - title: 'Latin capital letter k with cedilla' - }, - { - character: 'ķ', - title: 'Latin small letter k with cedilla' - }, - { - character: 'ĸ', - title: 'Latin small letter kra' - }, - { - character: 'Ĺ', - title: 'Latin capital letter l with acute' - }, - { - character: 'ĺ', - title: 'Latin small letter l with acute' - }, - { - character: 'Ļ', - title: 'Latin capital letter l with cedilla' - }, - { - character: 'ļ', - title: 'Latin small letter l with cedilla' - }, - { - character: 'Ľ', - title: 'Latin capital letter l with caron' - }, - { - character: 'ľ', - title: 'Latin small letter l with caron' - }, - { - character: 'Ŀ', - title: 'Latin capital letter l with middle dot' - }, - { - character: 'ŀ', - title: 'Latin small letter l with middle dot' - }, - { - character: 'Ł', - title: 'Latin capital letter l with stroke' - }, - { - character: 'ł', - title: 'Latin small letter l with stroke' - }, - { - character: 'Ń', - title: 'Latin capital letter n with acute' - }, - { - character: 'ń', - title: 'Latin small letter n with acute' - }, - { - character: 'Ņ', - title: 'Latin capital letter n with cedilla' - }, - { - character: 'ņ', - title: 'Latin small letter n with cedilla' - }, - { - character: 'Ň', - title: 'Latin capital letter n with caron' - }, - { - character: 'ň', - title: 'Latin small letter n with caron' - }, - { - character: 'ʼn', - title: 'Latin small letter n preceded by apostrophe' - }, - { - character: 'Ŋ', - title: 'Latin capital letter eng' - }, - { - character: 'ŋ', - title: 'Latin small letter eng' - }, - { - character: 'Ō', - title: 'Latin capital letter o with macron' - }, - { - character: 'ō', - title: 'Latin small letter o with macron' - }, - { - character: 'Ŏ', - title: 'Latin capital letter o with breve' - }, - { - character: 'ŏ', - title: 'Latin small letter o with breve' - }, - { - character: 'Ő', - title: 'Latin capital letter o with double acute' - }, - { - character: 'ő', - title: 'Latin small letter o with double acute' - }, - { - character: 'Œ', - title: 'Latin capital ligature oe' - }, - { - character: 'œ', - title: 'Latin small ligature oe' - }, - { - character: 'Ŕ', - title: 'Latin capital letter r with acute' - }, - { - character: 'ŕ', - title: 'Latin small letter r with acute' - }, - { - character: 'Ŗ', - title: 'Latin capital letter r with cedilla' - }, - { - character: 'ŗ', - title: 'Latin small letter r with cedilla' - }, - { - character: 'Ř', - title: 'Latin capital letter r with caron' - }, - { - character: 'ř', - title: 'Latin small letter r with caron' - }, - { - character: 'Ś', - title: 'Latin capital letter s with acute' - }, - { - character: 'ś', - title: 'Latin small letter s with acute' - }, - { - character: 'Ŝ', - title: 'Latin capital letter s with circumflex' - }, - { - character: 'ŝ', - title: 'Latin small letter s with circumflex' - }, - { - character: 'Ş', - title: 'Latin capital letter s with cedilla' - }, - { - character: 'ş', - title: 'Latin small letter s with cedilla' - }, - { - character: 'Š', - title: 'Latin capital letter s with caron' - }, - { - character: 'š', - title: 'Latin small letter s with caron' - }, - { - character: 'Ţ', - title: 'Latin capital letter t with cedilla' - }, - { - character: 'ţ', - title: 'Latin small letter t with cedilla' - }, - { - character: 'Ť', - title: 'Latin capital letter t with caron' - }, - { - character: 'ť', - title: 'Latin small letter t with caron' - }, - { - character: 'Ŧ', - title: 'Latin capital letter t with stroke' - }, - { - character: 'ŧ', - title: 'Latin small letter t with stroke' - }, - { - character: 'Ũ', - title: 'Latin capital letter u with tilde' - }, - { - character: 'ũ', - title: 'Latin small letter u with tilde' - }, - { - character: 'Ū', - title: 'Latin capital letter u with macron' - }, - { - character: 'ū', - title: 'Latin small letter u with macron' - }, - { - character: 'Ŭ', - title: 'Latin capital letter u with breve' - }, - { - character: 'ŭ', - title: 'Latin small letter u with breve' - }, - { - character: 'Ů', - title: 'Latin capital letter u with ring above' - }, - { - character: 'ů', - title: 'Latin small letter u with ring above' - }, - { - character: 'Ű', - title: 'Latin capital letter u with double acute' - }, - { - character: 'ű', - title: 'Latin small letter u with double acute' - }, - { - character: 'Ų', - title: 'Latin capital letter u with ogonek' - }, - { - character: 'ų', - title: 'Latin small letter u with ogonek' - }, - { - character: 'Ŵ', - title: 'Latin capital letter w with circumflex' - }, - { - character: 'ŵ', - title: 'Latin small letter w with circumflex' - }, - { - character: 'Ŷ', - title: 'Latin capital letter y with circumflex' - }, - { - character: 'ŷ', - title: 'Latin small letter y with circumflex' - }, - { - character: 'Ÿ', - title: 'Latin capital letter y with diaeresis' - }, - { - character: 'Ź', - title: 'Latin capital letter z with acute' - }, - { - character: 'ź', - title: 'Latin small letter z with acute' - }, - { - character: 'Ż', - title: 'Latin capital letter z with dot above' - }, - { - character: 'ż', - title: 'Latin small letter z with dot above' - }, - { - character: 'Ž', - title: 'Latin capital letter z with caron' - }, - { - character: 'ž', - title: 'Latin small letter z with caron' - }, - { - character: 'ſ', - title: 'Latin small letter long s' - } + const editor = this.editor; + const t = editor.t; + + editor.plugins.get( 'SpecialCharacters' ).addItems( 'Latin', [ + { character: 'Ā', title: t( 'Latin capital letter a with macron' ) }, + { character: 'ā', title: t( 'Latin small letter a with macron' ) }, + { character: 'Ă', title: t( 'Latin capital letter a with breve' ) }, + { character: 'ă', title: t( 'Latin small letter a with breve' ) }, + { character: 'Ą', title: t( 'Latin capital letter a with ogonek' ) }, + { character: 'ą', title: t( 'Latin small letter a with ogonek' ) }, + { character: 'Ć', title: t( 'Latin capital letter c with acute' ) }, + { character: 'ć', title: t( 'Latin small letter c with acute' ) }, + { character: 'Ĉ', title: t( 'Latin capital letter c with circumflex' ) }, + { character: 'ĉ', title: t( 'Latin small letter c with circumflex' ) }, + { character: 'Ċ', title: t( 'Latin capital letter c with dot above' ) }, + { character: 'ċ', title: t( 'Latin small letter c with dot above' ) }, + { character: 'Č', title: t( 'Latin capital letter c with caron' ) }, + { character: 'č', title: t( 'Latin small letter c with caron' ) }, + { character: 'Ď', title: t( 'Latin capital letter d with caron' ) }, + { character: 'ď', title: t( 'Latin small letter d with caron' ) }, + { character: 'Đ', title: t( 'Latin capital letter d with stroke' ) }, + { character: 'đ', title: t( 'Latin small letter d with stroke' ) }, + { character: 'Ē', title: t( 'Latin capital letter e with macron' ) }, + { character: 'ē', title: t( 'Latin small letter e with macron' ) }, + { character: 'Ĕ', title: t( 'Latin capital letter e with breve' ) }, + { character: 'ĕ', title: t( 'Latin small letter e with breve' ) }, + { character: 'Ė', title: t( 'Latin capital letter e with dot above' ) }, + { character: 'ė', title: t( 'Latin small letter e with dot above' ) }, + { character: 'Ę', title: t( 'Latin capital letter e with ogonek' ) }, + { character: 'ę', title: t( 'Latin small letter e with ogonek' ) }, + { character: 'Ě', title: t( 'Latin capital letter e with caron' ) }, + { character: 'ě', title: t( 'Latin small letter e with caron' ) }, + { character: 'Ĝ', title: t( 'Latin capital letter g with circumflex' ) }, + { character: 'ĝ', title: t( 'Latin small letter g with circumflex' ) }, + { character: 'Ğ', title: t( 'Latin capital letter g with breve' ) }, + { character: 'ğ', title: t( 'Latin small letter g with breve' ) }, + { character: 'Ġ', title: t( 'Latin capital letter g with dot above' ) }, + { character: 'ġ', title: t( 'Latin small letter g with dot above' ) }, + { character: 'Ģ', title: t( 'Latin capital letter g with cedilla' ) }, + { character: 'ģ', title: t( 'Latin small letter g with cedilla' ) }, + { character: 'Ĥ', title: t( 'Latin capital letter h with circumflex' ) }, + { character: 'ĥ', title: t( 'Latin small letter h with circumflex' ) }, + { character: 'Ħ', title: t( 'Latin capital letter h with stroke' ) }, + { character: 'ħ', title: t( 'Latin small letter h with stroke' ) }, + { character: 'Ĩ', title: t( 'Latin capital letter i with tilde' ) }, + { character: 'ĩ', title: t( 'Latin small letter i with tilde' ) }, + { character: 'Ī', title: t( 'Latin capital letter i with macron' ) }, + { character: 'ī', title: t( 'Latin small letter i with macron' ) }, + { character: 'Ĭ', title: t( 'Latin capital letter i with breve' ) }, + { character: 'ĭ', title: t( 'Latin small letter i with breve' ) }, + { character: 'Į', title: t( 'Latin capital letter i with ogonek' ) }, + { character: 'į', title: t( 'Latin small letter i with ogonek' ) }, + { character: 'İ', title: t( 'Latin capital letter i with dot above' ) }, + { character: 'ı', title: t( 'Latin small letter dotless i' ) }, + { character: 'IJ', title: t( 'Latin capital ligature ij' ) }, + { character: 'ij', title: t( 'Latin small ligature ij' ) }, + { character: 'Ĵ', title: t( 'Latin capital letter j with circumflex' ) }, + { character: 'ĵ', title: t( 'Latin small letter j with circumflex' ) }, + { character: 'Ķ', title: t( 'Latin capital letter k with cedilla' ) }, + { character: 'ķ', title: t( 'Latin small letter k with cedilla' ) }, + { character: 'ĸ', title: t( 'Latin small letter kra' ) }, + { character: 'Ĺ', title: t( 'Latin capital letter l with acute' ) }, + { character: 'ĺ', title: t( 'Latin small letter l with acute' ) }, + { character: 'Ļ', title: t( 'Latin capital letter l with cedilla' ) }, + { character: 'ļ', title: t( 'Latin small letter l with cedilla' ) }, + { character: 'Ľ', title: t( 'Latin capital letter l with caron' ) }, + { character: 'ľ', title: t( 'Latin small letter l with caron' ) }, + { character: 'Ŀ', title: t( 'Latin capital letter l with middle dot' ) }, + { character: 'ŀ', title: t( 'Latin small letter l with middle dot' ) }, + { character: 'Ł', title: t( 'Latin capital letter l with stroke' ) }, + { character: 'ł', title: t( 'Latin small letter l with stroke' ) }, + { character: 'Ń', title: t( 'Latin capital letter n with acute' ) }, + { character: 'ń', title: t( 'Latin small letter n with acute' ) }, + { character: 'Ņ', title: t( 'Latin capital letter n with cedilla' ) }, + { character: 'ņ', title: t( 'Latin small letter n with cedilla' ) }, + { character: 'Ň', title: t( 'Latin capital letter n with caron' ) }, + { character: 'ň', title: t( 'Latin small letter n with caron' ) }, + { character: 'ʼn', title: t( 'Latin small letter n preceded by apostrophe' ) }, + { character: 'Ŋ', title: t( 'Latin capital letter eng' ) }, + { character: 'ŋ', title: t( 'Latin small letter eng' ) }, + { character: 'Ō', title: t( 'Latin capital letter o with macron' ) }, + { character: 'ō', title: t( 'Latin small letter o with macron' ) }, + { character: 'Ŏ', title: t( 'Latin capital letter o with breve' ) }, + { character: 'ŏ', title: t( 'Latin small letter o with breve' ) }, + { character: 'Ő', title: t( 'Latin capital letter o with double acute' ) }, + { character: 'ő', title: t( 'Latin small letter o with double acute' ) }, + { character: 'Œ', title: t( 'Latin capital ligature oe' ) }, + { character: 'œ', title: t( 'Latin small ligature oe' ) }, + { character: 'Ŕ', title: t( 'Latin capital letter r with acute' ) }, + { character: 'ŕ', title: t( 'Latin small letter r with acute' ) }, + { character: 'Ŗ', title: t( 'Latin capital letter r with cedilla' ) }, + { character: 'ŗ', title: t( 'Latin small letter r with cedilla' ) }, + { character: 'Ř', title: t( 'Latin capital letter r with caron' ) }, + { character: 'ř', title: t( 'Latin small letter r with caron' ) }, + { character: 'Ś', title: t( 'Latin capital letter s with acute' ) }, + { character: 'ś', title: t( 'Latin small letter s with acute' ) }, + { character: 'Ŝ', title: t( 'Latin capital letter s with circumflex' ) }, + { character: 'ŝ', title: t( 'Latin small letter s with circumflex' ) }, + { character: 'Ş', title: t( 'Latin capital letter s with cedilla' ) }, + { character: 'ş', title: t( 'Latin small letter s with cedilla' ) }, + { character: 'Š', title: t( 'Latin capital letter s with caron' ) }, + { character: 'š', title: t( 'Latin small letter s with caron' ) }, + { character: 'Ţ', title: t( 'Latin capital letter t with cedilla' ) }, + { character: 'ţ', title: t( 'Latin small letter t with cedilla' ) }, + { character: 'Ť', title: t( 'Latin capital letter t with caron' ) }, + { character: 'ť', title: t( 'Latin small letter t with caron' ) }, + { character: 'Ŧ', title: t( 'Latin capital letter t with stroke' ) }, + { character: 'ŧ', title: t( 'Latin small letter t with stroke' ) }, + { character: 'Ũ', title: t( 'Latin capital letter u with tilde' ) }, + { character: 'ũ', title: t( 'Latin small letter u with tilde' ) }, + { character: 'Ū', title: t( 'Latin capital letter u with macron' ) }, + { character: 'ū', title: t( 'Latin small letter u with macron' ) }, + { character: 'Ŭ', title: t( 'Latin capital letter u with breve' ) }, + { character: 'ŭ', title: t( 'Latin small letter u with breve' ) }, + { character: 'Ů', title: t( 'Latin capital letter u with ring above' ) }, + { character: 'ů', title: t( 'Latin small letter u with ring above' ) }, + { character: 'Ű', title: t( 'Latin capital letter u with double acute' ) }, + { character: 'ű', title: t( 'Latin small letter u with double acute' ) }, + { character: 'Ų', title: t( 'Latin capital letter u with ogonek' ) }, + { character: 'ų', title: t( 'Latin small letter u with ogonek' ) }, + { character: 'Ŵ', title: t( 'Latin capital letter w with circumflex' ) }, + { character: 'ŵ', title: t( 'Latin small letter w with circumflex' ) }, + { character: 'Ŷ', title: t( 'Latin capital letter y with circumflex' ) }, + { character: 'ŷ', title: t( 'Latin small letter y with circumflex' ) }, + { character: 'Ÿ', title: t( 'Latin capital letter y with diaeresis' ) }, + { character: 'Ź', title: t( 'Latin capital letter z with acute' ) }, + { character: 'ź', title: t( 'Latin small letter z with acute' ) }, + { character: 'Ż', title: t( 'Latin capital letter z with dot above' ) }, + { character: 'ż', title: t( 'Latin small letter z with dot above' ) }, + { character: 'Ž', title: t( 'Latin capital letter z with caron' ) }, + { character: 'ž', title: t( 'Latin small letter z with caron' ) }, + { character: 'ſ', title: t( 'Latin small letter long s' ) } ] ); } } diff --git a/src/specialcharactersmathematical.js b/src/specialcharactersmathematical.js index 19aaa39..2dfcdd3 100644 --- a/src/specialcharactersmathematical.js +++ b/src/specialcharactersmathematical.js @@ -4,203 +4,84 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharactersmathematical */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharacters from './specialcharacters'; +/** + * A plugin provides special characters for the "Mathematical" category. + * + * ClassicEditor + * .create( { + * plugins: [ ..., SpecialCharacters, SpecialCharactersMathematical ], + * } ) + * .then( ... ) + * .catch( ... ); + * + * @extends module:core/plugin~Plugin + */ export default class SpecialCharactersMathematical extends Plugin { /** * @inheritDoc */ static get requires() { - return [ - SpecialCharacters - ]; + return [ SpecialCharacters ]; } /** * @inheritDoc */ init() { - this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Mathematical', [ - { - character: '<', - title: 'Less-than sign' - }, - { - character: '>', - title: 'Greater-than sign' - }, - { - character: '≤', - title: 'Less-than or equal to' - }, - { - character: '≥', - title: 'Greater-than or equal to' - }, - { - character: '–', - title: 'En dash' - }, - { - character: '—', - title: 'Em dash' - }, - { - character: '¯', - title: 'Macron' - }, - { - character: '‾', - title: 'Overline' - }, - { - character: '°', - title: 'Degree sign' - }, - { - character: '−', - title: 'Minus sign' - }, - { - character: '±', - title: 'Plus-minus sign' - }, - { - character: '÷', - title: 'Division sign' - }, - { - character: '⁄', - title: 'Fraction slash' - }, - { - character: '×', - title: 'Multiplication sign' - }, - { - character: 'ƒ', - title: 'Latin small letter f with hook' - }, - { - character: '∫', - title: 'Integral' - }, - { - character: '∑', - title: 'N-ary summation' - }, - { - character: '∞', - title: 'Infinity' - }, - { - character: '√', - title: 'Square root' - }, - { - character: '∼', - title: 'Tilde operator' - }, - { - character: '≅', - title: 'Approximately equal to' - }, - { - character: '≈', - title: 'Almost equal to' - }, - { - character: '≠', - title: 'Not equal to' - }, - { - character: '≡', - title: 'Identical to' - }, - { - character: '∈', - title: 'Element of' - }, - { - character: '∉', - title: 'Not an element of' - }, - { - character: '∋', - title: 'Contains as member' - }, - { - character: '∏', - title: 'N-ary product' - }, - { - character: '∧', - title: 'Logical and' - }, - { - character: '∨', - title: 'Logical or' - }, - { - character: '¬', - title: 'Not sign' - }, - { - character: '∩', - title: 'Intersection' - }, - { - character: '∪', - title: 'Union' - }, - { - character: '∂', - title: 'Partial differential' - }, - { - character: '∀', - title: 'For all' - }, - { - character: '∃', - title: 'There exists' - }, - { - character: '∅', - title: 'Empty set' - }, - { - character: '∇', - title: 'Nabla' - }, - { - character: '∗', - title: 'Asterisk operator' - }, - { - character: '∝', - title: 'Proportional to' - }, - { - character: '∠', - title: 'Angle' - }, - { - character: '¼', - title: 'Vulgar fraction one quarter' - }, - { - character: '½', - title: 'Vulgar fraction one half' - }, - { - character: '¾', - title: 'Vulgar fraction three quarters' - } + const editor = this.editor; + const t = editor.t; + + editor.plugins.get( 'SpecialCharacters' ).addItems( 'Mathematical', [ + { character: '<', title: t( 'Less-than sign' ) }, + { character: '>', title: t( 'Greater-than sign' ) }, + { character: '≤', title: t( 'Less-than or equal to' ) }, + { character: '≥', title: t( 'Greater-than or equal to' ) }, + { character: '–', title: t( 'En dash' ) }, + { character: '—', title: t( 'Em dash' ) }, + { character: '¯', title: t( 'Macron' ) }, + { character: '‾', title: t( 'Overline' ) }, + { character: '°', title: t( 'Degree sign' ) }, + { character: '−', title: t( 'Minus sign' ) }, + { character: '±', title: t( 'Plus-minus sign' ) }, + { character: '÷', title: t( 'Division sign' ) }, + { character: '⁄', title: t( 'Fraction slash' ) }, + { character: '×', title: t( 'Multiplication sign' ) }, + { character: 'ƒ', title: t( 'Latin small letter f with hook' ) }, + { character: '∫', title: t( 'Integral' ) }, + { character: '∑', title: t( 'N-ary summation' ) }, + { character: '∞', title: t( 'Infinity' ) }, + { character: '√', title: t( 'Square root' ) }, + { character: '∼', title: t( 'Tilde operator' ) }, + { character: '≅', title: t( 'Approximately equal to' ) }, + { character: '≈', title: t( 'Almost equal to' ) }, + { character: '≠', title: t( 'Not equal to' ) }, + { character: '≡', title: t( 'Identical to' ) }, + { character: '∈', title: t( 'Element of' ) }, + { character: '∉', title: t( 'Not an element of' ) }, + { character: '∋', title: t( 'Contains as member' ) }, + { character: '∏', title: t( 'N-ary product' ) }, + { character: '∧', title: t( 'Logical and' ) }, + { character: '∨', title: t( 'Logical or' ) }, + { character: '¬', title: t( 'Not sign' ) }, + { character: '∩', title: t( 'Intersection' ) }, + { character: '∪', title: t( 'Union' ) }, + { character: '∂', title: t( 'Partial differential' ) }, + { character: '∀', title: t( 'For all' ) }, + { character: '∃', title: t( 'There exists' ) }, + { character: '∅', title: t( 'Empty set' ) }, + { character: '∇', title: t( 'Nabla' ) }, + { character: '∗', title: t( 'Asterisk operator' ) }, + { character: '∝', title: t( 'Proportional to' ) }, + { character: '∠', title: t( 'Angle' ) }, + { character: '¼', title: t( 'Vulgar fraction one quarter' ) }, + { character: '½', title: t( 'Vulgar fraction one half' ) }, + { character: '¾', title: t( 'Vulgar fraction three quarters' ) } ] ); } } diff --git a/src/specialcharacterstext.js b/src/specialcharacterstext.js index aa04a26..2544f4c 100644 --- a/src/specialcharacterstext.js +++ b/src/specialcharacterstext.js @@ -4,111 +4,67 @@ */ /** - * @module special-characters/specialcharacters + * @module special-characters/specialcharacterstext */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import SpecialCharacters from './specialcharacters'; +/** + * A plugin provides special characters for the "Text" category. + * + * ClassicEditor + * .create( { + * plugins: [ ..., SpecialCharacters, SpecialCharactersText ], + * } ) + * .then( ... ) + * .catch( ... ); + * + * @extends module:core/plugin~Plugin + */ export default class SpecialCharactersText extends Plugin { /** * @inheritDoc */ static get requires() { - return [ - SpecialCharacters - ]; + return [ SpecialCharacters ]; } /** * @inheritDoc */ init() { - this.editor.plugins.get( 'SpecialCharacters' ).addItems( 'Text', [ - { - character: '‹', - title: 'Single left-pointing angle quotation mark' - }, - { - character: '›', - title: 'Single right-pointing angle quotation mark' - }, - { - character: '«', - title: 'Left-pointing double angle quotation mark' - }, - { - character: '»', - title: 'Right-pointing double angle quotation mark' - }, - { - character: '‘', - title: 'Left single quotation mark' - }, - { - character: '’', - title: 'Right single quotation mark' - }, - { - character: '“', - title: 'Left double quotation mark' - }, - { - character: '”', - title: 'Right double quotation mark' - }, - { - character: '‚', - title: 'Single low-9 quotation mark' - }, - { - character: '„', - title: 'Double low-9 quotation mark' - }, - { - character: '¡', - title: 'Inverted exclamation mark' - }, - { - character: '¿', - title: 'Inverted question mark' - }, - { - character: '‥', - title: 'Two dot leader' - }, - { - character: '…', - title: 'Horizontal ellipsis' - }, - { - character: '‡', - title: 'Double dagger' - }, - { - character: '‰', - title: 'Per mille sign' - }, - { - character: '‱', - title: 'Per ten thousand sign' - }, - { - character: '‼', - title: 'Double exclamation mark' - }, - { - character: '⁈', - title: 'Question exclamation mark' - }, - { - character: '⁉', - title: 'Exclamation question mark' - }, - { - character: '⁇', - title: 'Double question mark' - } + const editor = this.editor; + const t = editor.t; + + editor.plugins.get( 'SpecialCharacters' ).addItems( 'Text', [ + { character: '‹', title: t( 'Single left-pointing angle quotation mark' ) }, + { character: '›', title: t( 'Single right-pointing angle quotation mark' ) }, + { character: '«', title: t( 'Left-pointing double angle quotation mark' ) }, + { character: '»', title: t( 'Right-pointing double angle quotation mark' ) }, + { character: '‘', title: t( 'Left single quotation mark' ) }, + { character: '’', title: t( 'Right single quotation mark' ) }, + { character: '“', title: t( 'Left double quotation mark' ) }, + { character: '”', title: t( 'Right double quotation mark' ) }, + { character: '‚', title: t( 'Single low-9 quotation mark' ) }, + { character: '„', title: t( 'Double low-9 quotation mark' ) }, + { character: '¡', title: t( 'Inverted exclamation mark' ) }, + { character: '¿', title: t( 'Inverted question mark' ) }, + { character: '‥', title: t( 'Two dot leader' ) }, + { character: '…', title: t( 'Horizontal ellipsis' ) }, + { character: '‡', title: t( 'Double dagger' ) }, + { character: '‰', title: t( 'Per mille sign' ) }, + { character: '‱', title: t( 'Per ten thousand sign' ) }, + { character: '‼', title: t( 'Double exclamation mark' ) }, + { character: '⁈', title: t( 'Question exclamation mark' ) }, + { character: '⁉', title: t( 'Exclamation question mark' ) }, + { character: '⁇', title: t( 'Double question mark' ) }, + { character: '©', title: t( 'Copyright sign' ) }, + { character: '®', title: t( 'Registered sign' ) }, + { character: '™', title: t( 'Trade mark sign' ) }, + { character: '§', title: t( 'Section sign' ) }, + { character: '¶', title: t( 'Paragraph sign' ) }, + { character: '⁋', title: t( 'Reversed paragraph sign' ) } ] ); } } diff --git a/src/specialcharactersui.js b/src/specialcharactersui.js index 3a7f5f7..60d525a 100644 --- a/src/specialcharactersui.js +++ b/src/specialcharactersui.js @@ -12,6 +12,7 @@ import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils'; import specialCharactersIcon from '../theme/icons/specialcharacters.svg'; import CharacterGridView from './ui/charactergridview'; import SpecialCharactersNavigationView from './ui/specialcharactersnavigationview'; +import Typing from '@ckeditor/ckeditor5-typing/src/typing'; /** * The special characters UI plugin. @@ -21,6 +22,13 @@ import SpecialCharactersNavigationView from './ui/specialcharactersnavigationvie * @extends module:core/plugin~Plugin */ export default class SpecialCharactersUI extends Plugin { + /** + * @inheritDoc + */ + static get requires() { + return [ Typing ]; + } + /** * @inheritDoc */ @@ -34,6 +42,8 @@ export default class SpecialCharactersUI extends Plugin { init() { const editor = this.editor; const t = editor.t; + + const inputCommand = editor.commands.get( 'input' ); const specialCharsPlugin = editor.plugins.get( 'SpecialCharacters' ); // Add the `specialCharacters` dropdown button to feature components. @@ -43,7 +53,6 @@ export default class SpecialCharactersUI extends Plugin { const gridView = new CharacterGridView( this.locale, { columns: 10 } ); - const command = editor.commands.get( 'insertSpecialCharacter' ); gridView.delegate( 'execute' ).to( dropdownView ); @@ -61,11 +70,11 @@ export default class SpecialCharactersUI extends Plugin { tooltip: true } ); - dropdownView.bind( 'isEnabled' ).to( command ); + dropdownView.bind( 'isEnabled' ).to( inputCommand ); // Insert a special character when a tile was clicked. dropdownView.on( 'execute', ( evt, data ) => { - editor.execute( 'insertSpecialCharacter', { item: data.name } ); + editor.execute( 'input', { text: data.character } ); editor.editing.view.focus(); } ); diff --git a/src/ui/charactergridview.js b/src/ui/charactergridview.js index f104f69..9913398 100644 --- a/src/ui/charactergridview.js +++ b/src/ui/charactergridview.js @@ -62,7 +62,8 @@ export default class CharacterGridView extends View { * * @event execute * @param {Object} data Additional information about the event. - * @param {String} data.name Name of the tile that caused the event (e.g. "greek small letter epsilon"). + * @param {String} data.name A name of the tile that caused the event (e.g. "greek small letter epsilon"). + * @param {String} data.character A human-readable character displayed as label (e.g. "ε"). */ } @@ -91,7 +92,7 @@ export default class CharacterGridView extends View { } ); tile.on( 'execute', () => { - this.fire( 'execute', { name } ); + this.fire( 'execute', { name, character } ); } ); return tile; diff --git a/tests/insertspecialcharactercommand.js b/tests/insertspecialcharactercommand.js deleted file mode 100644 index 0be356e..0000000 --- a/tests/insertspecialcharactercommand.js +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -/* globals document */ - -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; -import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; -import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; -import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; -import SpecialCharacters from '../src/specialcharacters'; - -describe( 'InsertSpecialCharacterCommand', () => { - let editor, model, editorElement, command; - - testUtils.createSinonSandbox(); - - beforeEach( () => { - editorElement = document.createElement( 'div' ); - document.body.appendChild( editorElement ); - - return ClassicTestEditor - .create( editorElement, { - plugins: [ Paragraph, SpecialCharacters ] - } ) - .then( newEditor => { - editor = newEditor; - model = editor.model; - command = editor.commands.get( 'insertSpecialCharacter' ); - - editor.plugins.get( 'SpecialCharacters' ).addItems( 'Arrows', [ - { title: 'arrow left', character: '←' }, - { title: 'arrow right', character: '→' } - ] ); - } ); - } ); - - afterEach( () => { - return editor.destroy() - .then( () => { - editorElement.remove(); - } ); - } ); - - describe( 'isEnabled', () => { - it( 'should be bound to InputCommand#isEnables', () => { - const inputCommand = editor.commands.get( 'input' ); - - inputCommand.isEnabled = true; - expect( command.isEnabled ).to.equal( true ); - - inputCommand.isEnabled = false; - expect( command.isEnabled ).to.equal( false ); - } ); - } ); - - describe( 'execute()', () => { - it( 'should create a single batch', () => { - setModelData( model, 'foo[]' ); - - const spy = sinon.spy(); - - model.document.on( 'change', spy ); - - command.execute( { item: 'arrow left' } ); - - sinon.assert.calledOnce( spy ); - } ); - - it( 'executes InputCommand#execute()', () => { - const inputCommand = editor.commands.get( 'input' ); - - setModelData( model, 'foo[]' ); - - const spy = sinon.stub( inputCommand, 'execute' ); - - command.execute( { item: 'arrow left' } ); - - sinon.assert.calledWithExactly( spy, { text: '←' } ); - - spy.restore(); - } ); - - it( 'does nothing if specified object is invalid', () => { - setModelData( model, 'foo[]' ); - - const spy = sinon.spy(); - - model.document.on( 'change', spy ); - - command.execute( { foo: 'arrow left' } ); - - sinon.assert.notCalled( spy ); - } ); - - it( 'does nothing if specified item name does not exist', () => { - setModelData( model, 'foo[]' ); - - const spy = sinon.spy(); - - model.document.on( 'change', spy ); - - command.execute( { item: 'arrow up' } ); - - sinon.assert.notCalled( spy ); - } ); - } ); -} ); diff --git a/tests/specialcharacters.js b/tests/specialcharacters.js index 570686d..f330e69 100644 --- a/tests/specialcharacters.js +++ b/tests/specialcharacters.js @@ -5,7 +5,6 @@ import SpecialCharacters from '../src/specialcharacters'; import SpecialCharactersUI from '../src/specialcharactersui'; -import SpecialCharactersEditing from '../src/specialcharactersediting'; describe( 'SpecialCharacters', () => { let plugin; @@ -15,7 +14,7 @@ describe( 'SpecialCharacters', () => { } ); it( 'should require proper plugins', () => { - expect( SpecialCharacters.requires ).to.deep.equal( [ SpecialCharactersEditing, SpecialCharactersUI ] ); + expect( SpecialCharacters.requires ).to.deep.equal( [ SpecialCharactersUI ] ); } ); it( 'should be named', () => { diff --git a/tests/specialcharactersediting.js b/tests/specialcharactersediting.js deleted file mode 100644 index 986da6b..0000000 --- a/tests/specialcharactersediting.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -import SpecialCharactersEditing from '../src/specialcharactersediting'; -import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; -import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import InsertSpecialCharacterCommand from '../src/insertspecialcharactercommand'; - -describe( 'SpecialCharactersEditing', () => { - let editor; - - beforeEach( () => { - return VirtualTestEditor - .create( { - plugins: [ SpecialCharactersEditing, Paragraph ] - } ) - .then( newEditor => { - editor = newEditor; - } ); - } ); - - afterEach( () => { - return editor.destroy(); - } ); - - it( 'should have proper pluginName', () => { - expect( SpecialCharactersEditing.pluginName ).to.equal( 'SpecialCharactersEditing' ); - } ); - - it( 'adds a command', () => { - expect( editor.commands.get( 'insertSpecialCharacter' ) ).to.be.instanceOf( InsertSpecialCharacterCommand ); - } ); -} ); diff --git a/tests/specialcharactersui.js b/tests/specialcharactersui.js index 50bfd06..c9b4fd0 100644 --- a/tests/specialcharactersui.js +++ b/tests/specialcharactersui.js @@ -33,7 +33,7 @@ describe( 'SpecialCharactersUI', () => { } ) .then( newEditor => { editor = newEditor; - command = editor.commands.get( 'insertSpecialCharacter' ); + command = editor.commands.get( 'input' ); } ); } ); @@ -91,8 +91,8 @@ describe( 'SpecialCharactersUI', () => { sinon.assert.calledOnce( executeSpy ); sinon.assert.calledOnce( focusSpy ); - sinon.assert.calledWithExactly( executeSpy.firstCall, 'insertSpecialCharacter', { - item: 'Less-than or equal to' + sinon.assert.calledWithExactly( executeSpy.firstCall, 'input', { + text: '≤' } ); } ); diff --git a/tests/ui/charactergridview.js b/tests/ui/charactergridview.js index ffe69c5..7ae7774 100644 --- a/tests/ui/charactergridview.js +++ b/tests/ui/charactergridview.js @@ -61,7 +61,7 @@ describe( 'CharacterGridView', () => { tile.fire( 'execute' ); sinon.assert.calledOnce( spy ); - sinon.assert.calledWithExactly( spy, sinon.match.any, { name: 'foo bar baz' } ); + sinon.assert.calledWithExactly( spy, sinon.match.any, { name: 'foo bar baz', character: 'ε' } ); } ); } ); } );