From 4535809025fb2f3a10f3c188617f4202bbb82475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Fri, 24 Feb 2017 17:24:57 +0100 Subject: [PATCH 1/2] Fixed various naming and directory structure issues. --- lang/contexts.json | 4 +- src/image.js | 8 ++-- src/{ => image}/converters.js | 2 +- src/{ => image}/imageengine.js | 4 +- src/{ => image}/ui/imageballoonpanelview.js | 2 +- src/{ => image}/utils.js | 4 +- .../imagealternatetextengine.js | 26 ---------- src/{imagecaption => }/imagecaption.js | 6 +-- src/imagecaption/imagecaptionengine.js | 2 +- src/{imagestyle => }/imagestyle.js | 4 +- src/imagestyle/converters.js | 2 +- src/imagestyle/imagestylecommand.js | 2 +- src/imagestyle/imagestyleengine.js | 2 +- ...ternatetext.js => imagetextalternative.js} | 44 ++++++++--------- .../imagetextalternativecommand.js} | 8 ++-- .../imagetextalternativeengine.js | 26 ++++++++++ .../ui/textalternativeformview.js} | 12 ++--- src/imagetoolbar.js | 6 +-- tests/image.js | 8 ++-- tests/{ => image}/converters.js | 6 +-- tests/{ => image}/imageengine.js | 4 +- tests/{ => image}/ui/imageballoonpanelview.js | 4 +- tests/{ => image}/utils.js | 4 +- tests/{imagecaption => }/imagecaption.js | 4 +- tests/imagecaption/imagecaptionengine.js | 2 +- tests/{imagestyle => }/imagestyle.js | 6 +-- tests/imagestyle/imagestyleengine.js | 2 +- ...ternatetext.js => imagetextalternative.js} | 48 +++++++++---------- .../imagetextalternativecommand.js} | 6 +-- .../imagetextalternativeengine.js} | 10 ++-- .../ui/textalternativeformview.js} | 8 ++-- tests/imagetoolbar.js | 2 +- tests/manual/alternatetext.md | 10 ---- tests/manual/caption.js | 16 +++---- tests/manual/imagestyle.js | 14 +++--- ...lternatetext.html => textalternative.html} | 0 .../{alternatetext.js => textalternative.js} | 0 tests/manual/textalternative.md | 10 ++++ .../theme.scss | 2 +- 39 files changed, 165 insertions(+), 165 deletions(-) rename src/{ => image}/converters.js (99%) rename src/{ => image}/imageengine.js (96%) rename src/{ => image}/ui/imageballoonpanelview.js (98%) rename src/{ => image}/utils.js (94%) delete mode 100644 src/imagealternatetext/imagealternatetextengine.js rename src/{imagecaption => }/imagecaption.js (74%) rename src/{imagestyle => }/imagestyle.js (95%) rename src/{imagealternatetext/imagealternatetext.js => imagetextalternative.js} (68%) rename src/{imagealternatetext/imagealternatetextcommand.js => imagetextalternative/imagetextalternativecommand.js} (87%) create mode 100644 src/imagetextalternative/imagetextalternativeengine.js rename src/{imagealternatetext/ui/alternatetextformview.js => imagetextalternative/ui/textalternativeformview.js} (89%) rename tests/{ => image}/converters.js (97%) rename tests/{ => image}/imageengine.js (98%) rename tests/{ => image}/ui/imageballoonpanelview.js (97%) rename tests/{ => image}/utils.js (91%) rename tests/{imagecaption => }/imagecaption.js (85%) rename tests/{imagestyle => }/imagestyle.js (94%) rename tests/{imagealternatetext/imagealternatetext.js => imagetextalternative.js} (80%) rename tests/{imagealternatetext/imagealternatetextcommand.js => imagetextalternative/imagetextalternativecommand.js} (92%) rename tests/{imagealternatetext/imagelaternatetextengine.js => imagetextalternative/imagetextalternativeengine.js} (51%) rename tests/{imagealternatetext/ui/alternatetextformview.js => imagetextalternative/ui/textalternativeformview.js} (79%) delete mode 100644 tests/manual/alternatetext.md rename tests/manual/{alternatetext.html => textalternative.html} (100%) rename tests/manual/{alternatetext.js => textalternative.js} (100%) create mode 100644 tests/manual/textalternative.md rename theme/{imagealternatetext => imagetextalternative}/theme.scss (95%) diff --git a/lang/contexts.json b/lang/contexts.json index 1d3ab0a1..01d8061e 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -2,6 +2,6 @@ "image widget": "Label for the image widget.", "Side image": "Label for the Side image option.", "Full size image": "Label for the Full size image option.", - "Change alternate text": "Label for the Change alternate text button.", - "Alternate image text": "Label for the Alternate image text option." + "Change image text alternative": "Label for the Change image text alternative button.", + "Text alternative": "Label for the image text alternative input." } diff --git a/src/image.js b/src/image.js index 42dda98f..074fd382 100644 --- a/src/image.js +++ b/src/image.js @@ -8,16 +8,16 @@ */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ImageEngine from './imageengine'; +import ImageEngine from './image/imageengine'; import Widget from './widget/widget'; -import ImageAlternateText from './imagealternatetext/imagealternatetext'; +import ImageTextAlternative from './imagetextalternative'; import '../theme/theme.scss'; /** * The image plugin. * - * Uses {@link module:image/imageengine~ImageEngine}. + * Uses {@link module:image/image/imageengine~ImageEngine}. * * @extends module:core/plugin~Plugin */ @@ -26,6 +26,6 @@ export default class Image extends Plugin { * @inheritDoc */ static get requires() { - return [ ImageEngine, Widget, ImageAlternateText ]; + return [ ImageEngine, Widget, ImageTextAlternative ]; } } diff --git a/src/converters.js b/src/image/converters.js similarity index 99% rename from src/converters.js rename to src/image/converters.js index 6d8574a2..747b26a7 100644 --- a/src/converters.js +++ b/src/image/converters.js @@ -4,7 +4,7 @@ */ /** - * @module image/converters + * @module image/image/converters */ import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; diff --git a/src/imageengine.js b/src/image/imageengine.js similarity index 96% rename from src/imageengine.js rename to src/image/imageengine.js index cbb9f83e..3ef76464 100644 --- a/src/imageengine.js +++ b/src/image/imageengine.js @@ -4,12 +4,12 @@ */ /** - * @module image/imageengine + * @module image/image/imageengine */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter'; -import WidgetEngine from './widget/widgetengine'; +import WidgetEngine from '../widget/widgetengine'; import { viewToModelImage, modelToViewSelection, createImageAttributeConverter } from './converters'; import { toImageWidget } from './utils'; import ViewContainerElement from '@ckeditor/ckeditor5-engine/src/view/containerelement'; diff --git a/src/ui/imageballoonpanelview.js b/src/image/ui/imageballoonpanelview.js similarity index 98% rename from src/ui/imageballoonpanelview.js rename to src/image/ui/imageballoonpanelview.js index df051d8e..465c26b5 100644 --- a/src/ui/imageballoonpanelview.js +++ b/src/image/ui/imageballoonpanelview.js @@ -4,7 +4,7 @@ */ /** - * @module image/ui/imageballoonpanel + * @module image/image/ui/imageballoonpanel */ import throttle from '@ckeditor/ckeditor5-utils/src/lib/lodash/throttle'; diff --git a/src/utils.js b/src/image/utils.js similarity index 94% rename from src/utils.js rename to src/image/utils.js index 251d819b..8d001dfe 100644 --- a/src/utils.js +++ b/src/image/utils.js @@ -4,10 +4,10 @@ */ /** - * @module image/utils + * @module image/image/utils */ -import { widgetize, isWidget } from './widget/utils'; +import { widgetize, isWidget } from '../widget/utils'; import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; const imageSymbol = Symbol( 'isImage' ); diff --git a/src/imagealternatetext/imagealternatetextengine.js b/src/imagealternatetext/imagealternatetextengine.js deleted file mode 100644 index b0ba3524..00000000 --- a/src/imagealternatetext/imagealternatetextengine.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/** - * @module image/imagealternatetext/imagealternatetextengine - */ - -import ImageAlternateTextCommand from './imagealternatetextcommand'; -import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; - -/** - * The ImageAlternateTextEngine plugin. - * Registers `imageAlternateText` command. - * - * @extends module:core/plugin~Plugin - */ -export default class ImageAlternateTextEngine extends Plugin { - /** - * @inheritDoc - */ - init() { - this.editor.commands.set( 'imageAlternateText', new ImageAlternateTextCommand( this.editor ) ); - } -} diff --git a/src/imagecaption/imagecaption.js b/src/imagecaption.js similarity index 74% rename from src/imagecaption/imagecaption.js rename to src/imagecaption.js index 9d9da843..7d087af5 100644 --- a/src/imagecaption/imagecaption.js +++ b/src/imagecaption.js @@ -4,12 +4,12 @@ */ /** - * @module image/imagecaption/imagecaption + * @module image/imagecaption */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ImageCaptionEngine from './imagecaptionengine'; -import '../../theme/imagecaption/theme.scss'; +import ImageCaptionEngine from './imagecaption/imagecaptionengine'; +import '../theme/imagecaption/theme.scss'; /** * The image caption plugin. diff --git a/src/imagecaption/imagecaptionengine.js b/src/imagecaption/imagecaptionengine.js index d6687741..199c2dbe 100644 --- a/src/imagecaption/imagecaptionengine.js +++ b/src/imagecaption/imagecaptionengine.js @@ -18,7 +18,7 @@ import viewWriter from '@ckeditor/ckeditor5-engine/src/view/writer'; import ModelPosition from '@ckeditor/ckeditor5-engine/src/model/position'; import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter'; import ViewMatcher from '@ckeditor/ckeditor5-engine/src/view/matcher'; -import { isImage, isImageWidget } from '../utils'; +import { isImage, isImageWidget } from '../image/utils'; import { captionElementCreator, isCaption, getCaptionFromImage } from './utils'; /** diff --git a/src/imagestyle/imagestyle.js b/src/imagestyle.js similarity index 95% rename from src/imagestyle/imagestyle.js rename to src/imagestyle.js index 3933bd4f..2d62874c 100644 --- a/src/imagestyle/imagestyle.js +++ b/src/imagestyle.js @@ -4,11 +4,11 @@ */ /** - * @module image/imagestyle/imagestyle + * @module image/imagestyle */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ImageStyleEngine from './imagestyleengine'; +import ImageStyleEngine from './imagestyle/imagestyleengine'; import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; /** diff --git a/src/imagestyle/converters.js b/src/imagestyle/converters.js index dd6c7689..10da9f71 100644 --- a/src/imagestyle/converters.js +++ b/src/imagestyle/converters.js @@ -7,7 +7,7 @@ * @module image/imagestyle/converters */ -import { isImage } from '../utils'; +import { isImage } from '../image/utils'; /** * Returns converter for the `imageStyle` attribute. It can be used for adding, changing and removing the attribute. diff --git a/src/imagestyle/imagestylecommand.js b/src/imagestyle/imagestylecommand.js index 57ad1c53..f7f4b74c 100644 --- a/src/imagestyle/imagestylecommand.js +++ b/src/imagestyle/imagestylecommand.js @@ -8,7 +8,7 @@ */ import Command from '@ckeditor/ckeditor5-core/src/command/command'; -import { isImage } from '../utils'; +import { isImage } from '../image/utils'; /** * The image style command. It is used to apply different image styles. diff --git a/src/imagestyle/imagestyleengine.js b/src/imagestyle/imagestyleengine.js index ab7d4cac..71c9e202 100644 --- a/src/imagestyle/imagestyleengine.js +++ b/src/imagestyle/imagestyleengine.js @@ -9,7 +9,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import ImageStyleCommand from './imagestylecommand'; -import ImageEngine from '../imageengine'; +import ImageEngine from '../image/imageengine'; import { viewToModelStyleAttribute, modelToViewStyleAttribute } from './converters'; import fullSizeIcon from '@ckeditor/ckeditor5-core/theme/icons/object-center.svg'; import sideIcon from '@ckeditor/ckeditor5-core/theme/icons/object-right.svg'; diff --git a/src/imagealternatetext/imagealternatetext.js b/src/imagetextalternative.js similarity index 68% rename from src/imagealternatetext/imagealternatetext.js rename to src/imagetextalternative.js index 2fcae5ce..ff5ca3c7 100644 --- a/src/imagealternatetext/imagealternatetext.js +++ b/src/imagetextalternative.js @@ -4,32 +4,32 @@ */ /** - * @module image/imagealternatetext/imagealternatetext + * @module image/imagetextalternative */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; -import ImageAlternateTextEngine from './imagealternatetextengine'; +import ImageTextAlternativeEngine from './imagetextalternative/imagetextalternativeengine'; import escPressHandler from '@ckeditor/ckeditor5-ui/src/bindings/escpresshandler'; import clickOutsideHandler from '@ckeditor/ckeditor5-ui/src/bindings/clickoutsidehandler'; -import ImageToolbar from '../imagetoolbar'; -import AlternateTextFormView from './ui/alternatetextformview'; -import ImageBalloonPanel from '../ui/imageballoonpanelview'; +import ImageToolbar from './imagetoolbar'; +import TextAlternativeFormView from './imagetextalternative/ui/textalternativeformview'; +import ImageBalloonPanel from './image/ui/imageballoonpanelview'; -import alternateTextIcon from '@ckeditor/ckeditor5-core/theme/icons/input.svg'; -import '../../theme/imagealternatetext/theme.scss'; +import textAlternativeIcon from '@ckeditor/ckeditor5-core/theme/icons/input.svg'; +import '../theme/imagetextalternative/theme.scss'; /** - * The image alternate text plugin. + * The image text alternative plugin. * * @extends module:core/plugin~Plugin */ -export default class ImageAlternateText extends Plugin { +export default class ImageTextAlternative extends Plugin { /** * @inheritDoc */ static get requires() { - return [ ImageAlternateTextEngine ]; + return [ ImageTextAlternativeEngine ]; } /** @@ -42,12 +42,12 @@ export default class ImageAlternateText extends Plugin { const defaultImageToolbarConfig = this.editor.config.get( 'image.defaultToolbar' ); if ( defaultImageToolbarConfig ) { - defaultImageToolbarConfig.push( 'imageAlternateText' ); + defaultImageToolbarConfig.push( 'imageTextAlternative' ); } return this._createBalloonPanel().then( panel => { /** - * Balloon panel containing alternate text change form. + * Balloon panel containing text alternative change form. * * @member {module:image/ui/imageballoonpanel~ImageBalloonPanelView} #baloonPanel */ @@ -56,29 +56,29 @@ export default class ImageAlternateText extends Plugin { /** * Form containing textarea and buttons, used to change `alt` text value. * - * @member {module:image/imagealternatetext/ui/imagealternatetextformview~AlternateTextFormView} #form + * @member {module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView} #form */ this.form = panel.content.get( 0 ); } ); } /** - * Creates button showing alternate text change balloon panel and registers it in + * Creates button showing text alternative change balloon panel and registers it in * editor's {@link module:ui/componentfactory~ComponentFactory ComponentFactory}. * * @private */ _createButton() { const editor = this.editor; - const command = editor.commands.get( 'imageAlternateText' ); + const command = editor.commands.get( 'imageTextAlternative' ); const t = editor.t; - editor.ui.componentFactory.add( 'imageAlternateText', ( locale ) => { + editor.ui.componentFactory.add( 'imageTextAlternative', ( locale ) => { const view = new ButtonView( locale ); view.set( { - label: t( 'Change alternate text' ), - icon: alternateTextIcon, + label: t( 'Change image text alternative' ), + icon: textAlternativeIcon, tooltip: true } ); @@ -100,14 +100,14 @@ export default class ImageAlternateText extends Plugin { const editor = this.editor; const panel = new ImageBalloonPanel( editor ); - const form = new AlternateTextFormView( editor.locale ); + const form = new TextAlternativeFormView( editor.locale ); this.listenTo( form, 'submit', () => { - editor.execute( 'imageAlternateText', { newValue: form.lebeledInput.inputView.element.value } ); + editor.execute( 'imageTextAlternative', { newValue: form.lebeledInput.inputView.element.value } ); this._hideBalloonPanel(); } ); - // If image toolbar is present - hide it when alternate text balloon is visible. + // If image toolbar is present - hide it when text alternative balloon is visible. const imageToolbar = editor.plugins.get( ImageToolbar ); if ( imageToolbar ) { @@ -152,7 +152,7 @@ export default class ImageAlternateText extends Plugin { */ _showBalloonPanel() { const editor = this.editor; - const command = editor.commands.get( 'imageAlternateText' ); + const command = editor.commands.get( 'imageTextAlternative' ); this.form.lebeledInput.value = command.value || ''; this.balloonPanel.attach(); this.form.lebeledInput.select(); diff --git a/src/imagealternatetext/imagealternatetextcommand.js b/src/imagetextalternative/imagetextalternativecommand.js similarity index 87% rename from src/imagealternatetext/imagealternatetextcommand.js rename to src/imagetextalternative/imagetextalternativecommand.js index b123e7cd..2c866d84 100644 --- a/src/imagealternatetext/imagealternatetextcommand.js +++ b/src/imagetextalternative/imagetextalternativecommand.js @@ -4,18 +4,18 @@ */ /** - * @module image/imagelaternatetext/imagealternatetextcommand + * @module image/imagelaternatetext/imagetextalternativecommand */ import Command from '@ckeditor/ckeditor5-core/src/command/command'; -import { isImage } from '../utils'; +import { isImage } from '../image/utils'; /** - * The image alternate text command. It is used to change `alt` attribute on `image` elements. + * The image text alternative command. It is used to change `alt` attribute on `image` elements. * * @extends module:core/command/command~Command */ -export default class ImageAlternateTextCommand extends Command { +export default class ImageTextAlternativeCommand extends Command { /** * @inheritDoc */ diff --git a/src/imagetextalternative/imagetextalternativeengine.js b/src/imagetextalternative/imagetextalternativeengine.js new file mode 100644 index 00000000..a6a5bf52 --- /dev/null +++ b/src/imagetextalternative/imagetextalternativeengine.js @@ -0,0 +1,26 @@ +/** + * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md. + */ + +/** + * @module image/imagetextalternative/imagetextalternativeengine + */ + +import ImageTextAlternativeCommand from './imagetextalternativecommand'; +import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; + +/** + * The ImageTextAlternativeEngine plugin. + * Registers `imageTextAlternative` command. + * + * @extends module:core/plugin~Plugin + */ +export default class ImageTextAlternativeEngine extends Plugin { + /** + * @inheritDoc + */ + init() { + this.editor.commands.set( 'imageTextAlternative', new ImageTextAlternativeCommand( this.editor ) ); + } +} diff --git a/src/imagealternatetext/ui/alternatetextformview.js b/src/imagetextalternative/ui/textalternativeformview.js similarity index 89% rename from src/imagealternatetext/ui/alternatetextformview.js rename to src/imagetextalternative/ui/textalternativeformview.js index 53a3b49f..7def38bc 100644 --- a/src/imagealternatetext/ui/alternatetextformview.js +++ b/src/imagetextalternative/ui/textalternativeformview.js @@ -4,7 +4,7 @@ */ /** - * @module image/imagealternatetext/ui/imagealternatetextformview + * @module image/imagetextalternative/ui/imagetextalternativeformview */ import View from '@ckeditor/ckeditor5-ui/src/view'; @@ -15,11 +15,11 @@ import InputTextView from '@ckeditor/ckeditor5-ui/src/inputtext/inputtextview'; import submitHandler from '@ckeditor/ckeditor5-ui/src/bindings/submithandler'; /** - * AlternateTextFormView class. + * TextAlternativeFormView class. * * @extends module:ui/view~View */ -export default class AlternateTextFormView extends View { +export default class TextAlternativeFormView extends View { /** * @inheritDoc */ @@ -63,7 +63,7 @@ export default class AlternateTextFormView extends View { attributes: { class: [ - 'ck-alternate-text-form', + 'cke-text-alternative-form', ] }, @@ -74,7 +74,7 @@ export default class AlternateTextFormView extends View { attributes: { class: [ - 'ck-alternate-text-form__actions' + 'cke-text-alternative-form__actions' ] }, @@ -121,7 +121,7 @@ export default class AlternateTextFormView extends View { _createLabeledInputView() { const t = this.locale.t; const labeledInput = new LabeledInputView( this.locale, InputTextView ); - labeledInput.label = t( 'Alternate image text' ); + labeledInput.label = t( 'Text alternative' ); return labeledInput; } diff --git a/src/imagetoolbar.js b/src/imagetoolbar.js index 5bf8029e..761a0c66 100644 --- a/src/imagetoolbar.js +++ b/src/imagetoolbar.js @@ -10,8 +10,8 @@ import Template from '@ckeditor/ckeditor5-ui/src/template'; import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview'; -import { isImageWidget } from './utils'; -import ImageBalloonPanel from './ui/imageballoonpanelview'; +import { isImageWidget } from './image/utils'; +import ImageBalloonPanel from './image/ui/imageballoonpanelview'; /** * Image toolbar class. Creates image toolbar placed inside balloon panel that is showed when image widget is selected. @@ -20,7 +20,7 @@ import ImageBalloonPanel from './ui/imageballoonpanelview'; * Other plugins can add new components to the default toolbar configuration by pushing them to `image.defaultToolbar` * configuration. Default configuration is used when `image.toolbar` config is not present. * - * @extends module:core/plugin~Plugin. + * @extends module:core/plugin~Plugin */ export default class ImageToolbar extends Plugin { /** diff --git a/tests/image.js b/tests/image.js index b80d75d5..1cb7105d 100644 --- a/tests/image.js +++ b/tests/image.js @@ -7,9 +7,9 @@ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import Image from '../src/image'; -import ImageEngine from '../src/imageengine'; +import ImageEngine from '../src/image/imageengine'; import Widget from '../src/widget/widget'; -import ImageAlternateText from '../src/imagealternatetext/imagealternatetext'; +import ImageTextAlternative from '../src/imagetextalternative'; describe( 'Image', () => { let editor; @@ -38,7 +38,7 @@ describe( 'Image', () => { expect( editor.plugins.get( Widget ) ).to.instanceOf( Widget ); } ); - it( 'should load ImageAlternateText plugin', () => { - expect( editor.plugins.get( ImageAlternateText ) ).to.instanceOf( ImageAlternateText ); + it( 'should load ImageTextAlternative plugin', () => { + expect( editor.plugins.get( ImageTextAlternative ) ).to.instanceOf( ImageTextAlternative ); } ); } ); diff --git a/tests/converters.js b/tests/image/converters.js similarity index 97% rename from tests/converters.js rename to tests/image/converters.js index 614449b0..b11d8fc4 100644 --- a/tests/converters.js +++ b/tests/image/converters.js @@ -3,10 +3,10 @@ * For licensing, see LICENSE.md. */ -import { viewToModelImage, modelToViewSelection, createImageAttributeConverter } from '../src/converters'; +import { viewToModelImage, modelToViewSelection, createImageAttributeConverter } from '../../src/image/converters'; import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import { createImageViewElement } from '../src/imageengine'; -import { toImageWidget } from '../src/utils'; +import { createImageViewElement } from '../../src/image/imageengine'; +import { toImageWidget } from '../../src/image/utils'; import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter'; import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; diff --git a/tests/imageengine.js b/tests/image/imageengine.js similarity index 98% rename from tests/imageengine.js rename to tests/image/imageengine.js index c8f24e22..ebb9d2e4 100644 --- a/tests/imageengine.js +++ b/tests/image/imageengine.js @@ -4,12 +4,12 @@ */ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import ImageEngine from '../src/imageengine'; +import ImageEngine from '../../src/image/imageengine'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter'; import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter'; -import { isImageWidget } from '../src/utils'; +import { isImageWidget } from '../../src/image/utils'; import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range'; describe( 'ImageEngine', () => { diff --git a/tests/ui/imageballoonpanelview.js b/tests/image/ui/imageballoonpanelview.js similarity index 97% rename from tests/ui/imageballoonpanelview.js rename to tests/image/ui/imageballoonpanelview.js index 0d0d2abc..15033371 100644 --- a/tests/ui/imageballoonpanelview.js +++ b/tests/image/ui/imageballoonpanelview.js @@ -7,9 +7,9 @@ import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic'; import global from '@ckeditor/ckeditor5-utils/src/dom/global'; -import ImageBalloonPanel from '../../src/ui/imageballoonpanelview'; +import ImageBalloonPanel from '../../../src/image/ui/imageballoonpanelview'; import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/balloonpanel/balloonpanelview'; -import ImageEngine from '../../src/imageengine'; +import ImageEngine from '../../../src/image/imageengine'; import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; describe( 'ImageBalloonPanel', () => { diff --git a/tests/utils.js b/tests/image/utils.js similarity index 91% rename from tests/utils.js rename to tests/image/utils.js index 11c223a7..a06e361f 100644 --- a/tests/utils.js +++ b/tests/image/utils.js @@ -5,8 +5,8 @@ import ViewElement from '@ckeditor/ckeditor5-engine/src/view/element'; import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; -import { toImageWidget, isImageWidget, isImage } from '../src/utils'; -import { isWidget } from '../src/widget/utils'; +import { toImageWidget, isImageWidget, isImage } from '../../src/image/utils'; +import { isWidget } from '../../src/widget/utils'; describe( 'image widget utils', () => { let element; diff --git a/tests/imagecaption/imagecaption.js b/tests/imagecaption.js similarity index 85% rename from tests/imagecaption/imagecaption.js rename to tests/imagecaption.js index 55c61701..5a6c844c 100644 --- a/tests/imagecaption/imagecaption.js +++ b/tests/imagecaption.js @@ -6,8 +6,8 @@ /* global window */ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; -import ImageCaption from '../../src/imagecaption/imagecaption'; -import ImageCaptionEngine from '../../src/imagecaption/imagecaptionengine'; +import ImageCaption from '../src/imagecaption'; +import ImageCaptionEngine from '../src/imagecaption/imagecaptionengine'; describe( 'ImageCaption', () => { let editor; diff --git a/tests/imagecaption/imagecaptionengine.js b/tests/imagecaption/imagecaptionengine.js index 99359648..dde70b8c 100644 --- a/tests/imagecaption/imagecaptionengine.js +++ b/tests/imagecaption/imagecaptionengine.js @@ -11,7 +11,7 @@ import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; import ModelRange from '@ckeditor/ckeditor5-engine/src/model/range'; import ModelPosition from '@ckeditor/ckeditor5-engine/src/model/position'; import ImageCaptionEngine from '../../src/imagecaption/imagecaptionengine'; -import ImageEngine from '../../src/imageengine'; +import ImageEngine from '../../src/image/imageengine'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter'; diff --git a/tests/imagestyle/imagestyle.js b/tests/imagestyle.js similarity index 94% rename from tests/imagestyle/imagestyle.js rename to tests/imagestyle.js index 3cbafa17..2a1978b6 100644 --- a/tests/imagestyle/imagestyle.js +++ b/tests/imagestyle.js @@ -4,9 +4,9 @@ */ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; -import ImageToolbar from '../../src/imagetoolbar'; -import ImageStyle from '../../src/imagestyle/imagestyle'; -import ImageStyleEngine from '../../src/imagestyle/imagestyleengine'; +import ImageToolbar from '../src/imagetoolbar'; +import ImageStyle from '../src/imagestyle'; +import ImageStyleEngine from '../src/imagestyle/imagestyleengine'; import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; import global from '@ckeditor/ckeditor5-utils/src/dom/global'; diff --git a/tests/imagestyle/imagestyleengine.js b/tests/imagestyle/imagestyleengine.js index c728a151..6c5edbff 100644 --- a/tests/imagestyle/imagestyleengine.js +++ b/tests/imagestyle/imagestyleengine.js @@ -5,7 +5,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; import ImageStyleEngine from '../../src/imagestyle/imagestyleengine'; -import ImageEngine from '../../src/imageengine'; +import ImageEngine from '../../src/image/imageengine'; import ImageStyleCommand from '../../src/imagestyle/imagestylecommand'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; diff --git a/tests/imagealternatetext/imagealternatetext.js b/tests/imagetextalternative.js similarity index 80% rename from tests/imagealternatetext/imagealternatetext.js rename to tests/imagetextalternative.js index f4511a54..4f259fad 100644 --- a/tests/imagealternatetext/imagealternatetext.js +++ b/tests/imagetextalternative.js @@ -4,10 +4,10 @@ */ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; -import Image from '../../src/image'; -import ImageToolbar from '../../src/imagetoolbar'; -import ImageAlternateText from '../../src/imagealternatetext/imagealternatetext'; -import ImageAlternateTextEngine from '../../src/imagealternatetext/imagealternatetextengine'; +import Image from '../src/image'; +import ImageToolbar from '../src/imagetoolbar'; +import ImageTextAlternative from '../src/imagetextalternative'; +import ImageTextAlternativeEngine from '../src/imagetextalternative/imagetextalternativeengine'; import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; import global from '@ckeditor/ckeditor5-utils/src/dom/global'; import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; @@ -15,7 +15,7 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; /* global Event */ -describe( 'ImageAlternateText', () => { +describe( 'ImageTextAlternative', () => { let editor, plugin, command, balloonPanel, form; beforeEach( () => { @@ -23,13 +23,13 @@ describe( 'ImageAlternateText', () => { global.document.body.appendChild( editorElement ); return ClassicTestEditor.create( editorElement, { - plugins: [ ImageAlternateText, Image ] + plugins: [ ImageTextAlternative, Image ] } ) .then( newEditor => { editor = newEditor; newEditor.editing.view.attachDomRoot( editorElement ); - plugin = editor.plugins.get( ImageAlternateText ); - command = editor.commands.get( 'imageAlternateText' ); + plugin = editor.plugins.get( ImageTextAlternative ); + command = editor.commands.get( 'imageTextAlternative' ); balloonPanel = plugin.balloonPanel; form = plugin.form; } ); @@ -40,18 +40,18 @@ describe( 'ImageAlternateText', () => { } ); it( 'should be loaded', () => { - expect( plugin ).to.be.instanceOf( ImageAlternateText ); + expect( plugin ).to.be.instanceOf( ImageTextAlternative ); } ); - it( 'should load ImageAlternateTextEngine plugin', () => { - expect( editor.plugins.get( ImageAlternateTextEngine ) ).to.be.instanceOf( ImageAlternateTextEngine ); + it( 'should load ImageTextAlternativeEngine plugin', () => { + expect( editor.plugins.get( ImageTextAlternativeEngine ) ).to.be.instanceOf( ImageTextAlternativeEngine ); } ); describe( 'toolbar button', () => { let button; beforeEach( () => { - button = editor.ui.componentFactory.create( 'imageAlternateText' ); + button = editor.ui.componentFactory.create( 'imageTextAlternative' ); } ); it( 'should be registered in component factory', () => { @@ -101,10 +101,10 @@ describe( 'ImageAlternateText', () => { global.document.body.appendChild( editorElement ); return ClassicTestEditor.create( editorElement, { - plugins: [ ImageAlternateText, ImageToolbar ] + plugins: [ ImageTextAlternative, ImageToolbar ] } ) .then( newEditor => { - expect( newEditor.config.get( 'image.defaultToolbar' ) ).to.eql( [ 'imageAlternateText' ] ); + expect( newEditor.config.get( 'image.defaultToolbar' ) ).to.eql( [ 'imageTextAlternative' ] ); newEditor.destroy(); } ); @@ -117,7 +117,7 @@ describe( 'ImageAlternateText', () => { form.fire( 'submit' ); sinon.assert.calledOnce( spy ); - sinon.assert.calledWithExactly( spy, 'imageAlternateText', { newValue: form.lebeledInput.inputView.element.value } ); + sinon.assert.calledWithExactly( spy, 'imageTextAlternative', { newValue: form.lebeledInput.inputView.element.value } ); } ); it( 'should detach panel on cancel', () => { @@ -132,14 +132,14 @@ describe( 'ImageAlternateText', () => { global.document.body.appendChild( editorElement ); return ClassicTestEditor.create( editorElement, { - plugins: [ ImageAlternateText, Image, ImageToolbar ], + plugins: [ ImageTextAlternative, Image, ImageToolbar ], image: { - toolbar: [ 'imageAlternateText' ] + toolbar: [ 'imageTextAlternative' ] } } ) .then( newEditor => { newEditor.editing.view.attachDomRoot( editorElement ); - const plugin = newEditor.plugins.get( ImageAlternateText ); + const plugin = newEditor.plugins.get( ImageTextAlternative ); const toolbarPlugin = newEditor.plugins.get( ImageToolbar ); const form = plugin.form; @@ -197,17 +197,17 @@ describe( 'ImageAlternateText', () => { global.document.body.appendChild( editorElement ); return ClassicTestEditor.create( editorElement, { - plugins: [ ImageAlternateText, Image, ImageToolbar ], + plugins: [ ImageTextAlternative, Image, ImageToolbar ], image: { - toolbar: [ 'imageAlternateText' ] + toolbar: [ 'imageTextAlternative' ] } } ) .then( newEditor => { editor = newEditor; editor.editing.view.attachDomRoot( editorElement ); - button = newEditor.ui.componentFactory.create( 'imageAlternateText' ); + button = newEditor.ui.componentFactory.create( 'imageTextAlternative' ); imageToolbarPlugin = newEditor.plugins.get( ImageToolbar ); - plugin = editor.plugins.get( ImageAlternateText ); + plugin = editor.plugins.get( ImageTextAlternative ); } ); } ); @@ -221,7 +221,7 @@ describe( 'ImageAlternateText', () => { sinon.assert.calledOnce( spy ); } ); - it( 'ImageToolbar should not show when alternate text panel is visible', () => { + it( 'ImageToolbar should not show when text alternative panel is visible', () => { setData( editor.document, '[foo bar]' ); button.fire( 'execute' ); const spy = sinon.spy( imageToolbarPlugin, 'show' ); @@ -230,7 +230,7 @@ describe( 'ImageAlternateText', () => { sinon.assert.notCalled( spy ); } ); - it( 'ImageToolbar should show when alternate text panel is not visible', () => { + it( 'ImageToolbar should show when text alternative panel is not visible', () => { setData( editor.document, '[foo bar]' ); button.fire( 'execute' ); const spy = sinon.spy( imageToolbarPlugin, 'show' ); diff --git a/tests/imagealternatetext/imagealternatetextcommand.js b/tests/imagetextalternative/imagetextalternativecommand.js similarity index 92% rename from tests/imagealternatetext/imagealternatetextcommand.js rename to tests/imagetextalternative/imagetextalternativecommand.js index ff1cbaef..0140d85c 100644 --- a/tests/imagealternatetext/imagealternatetextcommand.js +++ b/tests/imagetextalternative/imagetextalternativecommand.js @@ -4,17 +4,17 @@ */ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; -import ImageAlternateTextCommand from '../../src/imagealternatetext/imagealternatetextcommand'; +import ImageTextAlternativeCommand from '../../src/imagetextalternative/imagetextalternativecommand'; import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; -describe( 'ImageAlternateTextCommand', () => { +describe( 'ImageTextAlternativeCommand', () => { let document, command; beforeEach( () => { return ModelTestEditor.create() .then( newEditor => { document = newEditor.document; - command = new ImageAlternateTextCommand( newEditor ); + command = new ImageTextAlternativeCommand( newEditor ); document.schema.registerItem( 'p', '$block' ); diff --git a/tests/imagealternatetext/imagelaternatetextengine.js b/tests/imagetextalternative/imagetextalternativeengine.js similarity index 51% rename from tests/imagealternatetext/imagelaternatetextengine.js rename to tests/imagetextalternative/imagetextalternativeengine.js index 84acb815..b3ba2fe7 100644 --- a/tests/imagealternatetext/imagelaternatetextengine.js +++ b/tests/imagetextalternative/imagetextalternativeengine.js @@ -4,14 +4,14 @@ */ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import ImageAlternateTextEngine from '../../src/imagealternatetext/imagealternatetextengine'; -import ImageAlternateTextCommand from '../../src/imagealternatetext/imagealternatetextcommand'; +import ImageTextAlternativeEngine from '../../src/imagetextalternative/imagetextalternativeengine'; +import ImageTextAlternativeCommand from '../../src/imagetextalternative/imagetextalternativecommand'; -describe( 'ImageAlternateTextEngine', () => { +describe( 'ImageTextAlternativeEngine', () => { let editor; beforeEach( () => { return VirtualTestEditor.create( { - plugins: [ ImageAlternateTextEngine ] + plugins: [ ImageTextAlternativeEngine ] } ) .then( newEditor => { editor = newEditor; @@ -19,6 +19,6 @@ describe( 'ImageAlternateTextEngine', () => { } ); it( 'should register ImageAlteranteTextCommand', () => { - expect( editor.commands.get( 'imageAlternateText' ) ).to.be.instanceOf( ImageAlternateTextCommand ); + expect( editor.commands.get( 'imageTextAlternative' ) ).to.be.instanceOf( ImageTextAlternativeCommand ); } ); } ); diff --git a/tests/imagealternatetext/ui/alternatetextformview.js b/tests/imagetextalternative/ui/textalternativeformview.js similarity index 79% rename from tests/imagealternatetext/ui/alternatetextformview.js rename to tests/imagetextalternative/ui/textalternativeformview.js index 09bfcecc..0931c66a 100644 --- a/tests/imagealternatetext/ui/alternatetextformview.js +++ b/tests/imagetextalternative/ui/textalternativeformview.js @@ -5,21 +5,21 @@ /* global Event */ -import AlternateTextFormView from '../../../src/imagealternatetext/ui/alternatetextformview'; +import TextAlternativeFormView from '../../../src/imagetextalternative/ui/textalternativeformview'; import View from '@ckeditor/ckeditor5-ui/src/view'; -describe( 'AlternateTextFormView', () => { +describe( 'TextAlternativeFormView', () => { let view; beforeEach( () => { - view = new AlternateTextFormView( { t: () => {} } ); + view = new TextAlternativeFormView( { t: () => {} } ); view.init(); } ); describe( 'constructor()', () => { it( 'should create element from template', () => { - expect( view.element.classList.contains( 'ck-alternate-text-form' ) ).to.be.true; + expect( view.element.classList.contains( 'cke-text-alternative-form' ) ).to.be.true; } ); it( 'should create child views', () => { diff --git a/tests/imagetoolbar.js b/tests/imagetoolbar.js index 84a3cafb..ad0a446b 100644 --- a/tests/imagetoolbar.js +++ b/tests/imagetoolbar.js @@ -7,7 +7,7 @@ import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic'; import ImageToolbar from '../src/imagetoolbar'; import Image from '../src/image'; import global from '@ckeditor/ckeditor5-utils/src/dom/global'; -import ImageBalloonPanel from '../src/ui/imageballoonpanelview'; +import ImageBalloonPanel from '../src/image/ui/imageballoonpanelview'; import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; diff --git a/tests/manual/alternatetext.md b/tests/manual/alternatetext.md deleted file mode 100644 index bc2a3933..00000000 --- a/tests/manual/alternatetext.md +++ /dev/null @@ -1,10 +0,0 @@ -## Image alternate text - -* Click on image - balloon toolbar with alternate text change button should appear. -* Click on button in toolbar: - * balloon toolbar should hide, - * alternate image text balloon panel should be visible - * there should be `CKEditor logo` text selected inside textarea. -* Change the text and press `Ok`. Check if alternate text is changed by opening balloon panel again. -* Change the text and press `Cancel`. Check if alternate text is NOT changed by opening balloon panel again. - diff --git a/tests/manual/caption.js b/tests/manual/caption.js index 27f3c7a8..62ab8753 100644 --- a/tests/manual/caption.js +++ b/tests/manual/caption.js @@ -11,11 +11,11 @@ import Typing from '@ckeditor/ckeditor5-typing/src/typing'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import Heading from '@ckeditor/ckeditor5-heading/src/heading'; import Image from '../../src/image'; -import ImageCaption from '../../src/imagecaption/imagecaption'; +import ImageCaption from '../../src/imagecaption'; import Undo from '@ckeditor/ckeditor5-undo/src/undo'; import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import ImageToolbar from '../../src/imagetoolbar'; -import ImageStyle from '../../src/imagestyle/imagestyle'; +import ImageStyle from '../../src/imagestyle'; import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'; import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'; import List from '@ckeditor/ckeditor5-list/src/list'; @@ -27,9 +27,9 @@ ClassicEditor.create( document.querySelector( '#editor' ), { ], toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList' ] } ) - .then( editor => { - window.editor = editor; - } ) - .catch( err => { - console.error( err.stack ); - } ); +.then( editor => { + window.editor = editor; +} ) +.catch( err => { + console.error( err.stack ); +} ); diff --git a/tests/manual/imagestyle.js b/tests/manual/imagestyle.js index ba63754f..5f915740 100644 --- a/tests/manual/imagestyle.js +++ b/tests/manual/imagestyle.js @@ -13,16 +13,16 @@ import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; import ImagePlugin from '../../src/image'; import UndoPlugin from '@ckeditor/ckeditor5-undo/src/undo'; import ClipboardPlugin from '@ckeditor/ckeditor5-clipboard/src/clipboard'; -import ImageStyle from '../../src/imagestyle/imagestyle'; +import ImageStyle from '../../src/imagestyle'; import ImageToolbar from '../../src/imagetoolbar'; ClassicEditor.create( document.querySelector( '#editor' ), { plugins: [ ImageToolbar, EnterPlugin, TypingPlugin, ParagraphPlugin, HeadingPlugin, ImagePlugin, UndoPlugin, ClipboardPlugin, ImageStyle ], toolbar: [ 'headings', 'undo', 'redo' ] } ) - .then( editor => { - window.editor = editor; - } ) - .catch( err => { - console.error( err.stack ); - } ); +.then( editor => { + window.editor = editor; +} ) +.catch( err => { + console.error( err.stack ); +} ); diff --git a/tests/manual/alternatetext.html b/tests/manual/textalternative.html similarity index 100% rename from tests/manual/alternatetext.html rename to tests/manual/textalternative.html diff --git a/tests/manual/alternatetext.js b/tests/manual/textalternative.js similarity index 100% rename from tests/manual/alternatetext.js rename to tests/manual/textalternative.js diff --git a/tests/manual/textalternative.md b/tests/manual/textalternative.md new file mode 100644 index 00000000..b34f8970 --- /dev/null +++ b/tests/manual/textalternative.md @@ -0,0 +1,10 @@ +## Image text alternative + +* Click on image - balloon toolbar with text alternative change button should appear. +* Click on button in toolbar: + * balloon toolbar should hide, + * image text alternative balloon panel should be visible + * there should be `CKEditor logo` text selected inside textarea. +* Change the text and press `Ok`. Check if text alternative is changed by opening balloon panel again. +* Change the text and press `Cancel`. Check if text alternative is NOT changed by opening balloon panel again. + diff --git a/theme/imagealternatetext/theme.scss b/theme/imagetextalternative/theme.scss similarity index 95% rename from theme/imagealternatetext/theme.scss rename to theme/imagetextalternative/theme.scss index 0898dee9..374b4efa 100644 --- a/theme/imagealternatetext/theme.scss +++ b/theme/imagetextalternative/theme.scss @@ -3,7 +3,7 @@ @import '~@ckeditor/ckeditor5-theme-lark/theme/helpers/_spacing'; -.ck-alternate-text { +.cke-text-alternative { &-form { padding: ck-spacing( 'large' ); overflow: hidden; From 8e8b36b239517feb552ab4201666a4732cb9f83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Fri, 24 Feb 2017 17:37:54 +0100 Subject: [PATCH 2/2] Fixed API docs and minor code style issue. --- src/image/ui/imageballoonpanelview.js | 24 ++++++++++++++---------- src/imagetextalternative.js | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/image/ui/imageballoonpanelview.js b/src/image/ui/imageballoonpanelview.js index 465c26b5..9505c9e5 100644 --- a/src/image/ui/imageballoonpanelview.js +++ b/src/image/ui/imageballoonpanelview.js @@ -19,22 +19,26 @@ const positions = { // +-----------------+ // | Balloon | // +-----------------+ - south: ( targetRect, balloonRect ) => ( { - top: targetRect.bottom + arrowVOffset, - left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2, - name: 's' - } ), + south( targetRect, balloonRect ) { + return { + top: targetRect.bottom + arrowVOffset, + left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2, + name: 's' + }; + }, // +-----------------+ // | Balloon | // +-----------------+ // V // [text range] - north: ( targetRect, balloonRect ) => ( { - top: targetRect.top - balloonRect.height - arrowVOffset, - left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2, - name: 'n' - } ) + north( targetRect, balloonRect ) { + return { + top: targetRect.top - balloonRect.height - arrowVOffset, + left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2, + name: 'n' + }; + } }; /** diff --git a/src/imagetextalternative.js b/src/imagetextalternative.js index ff5ca3c7..5c5438b2 100644 --- a/src/imagetextalternative.js +++ b/src/imagetextalternative.js @@ -94,7 +94,7 @@ export default class ImageTextAlternative extends Plugin { * Creates balloon panel. * * @private - * @return {Promise.} + * @return {Promise.} */ _createBalloonPanel() { const editor = this.editor;