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

Merge pull request #61 from ckeditor/t/37

Other: Renamed "Image alternate text" to "Image text alternative" all across the code. Improved directory structure to have most important features in the top level of `src/`. Closes #37.

BREAKING CHANGES: The `src/imagealternatetext/imagealternatetext` module is now `src/imagetextalternative`. All other related classes and directories were renamed too.

BREAKING CHANGES: All the base image's util modules are now inside `src/image/`. The same applies to all other features. The main features are now directly in `src/`. Closes #33. Closes #26.
Piotrek Koszuliński 8 лет назад
Родитель
Сommit
a7ca05bae2
39 измененных файлов с 180 добавлено и 176 удалено
  1. 2 2
      packages/ckeditor5-image/lang/contexts.json
  2. 4 4
      packages/ckeditor5-image/src/image.js
  3. 1 1
      packages/ckeditor5-image/src/converters.js
  4. 2 2
      packages/ckeditor5-image/src/imageengine.js
  5. 15 11
      packages/ckeditor5-image/src/ui/imageballoonpanelview.js
  6. 2 2
      packages/ckeditor5-image/src/utils.js
  7. 0 26
      packages/ckeditor5-image/src/imagealternatetext/imagealternatetextengine.js
  8. 3 3
      packages/ckeditor5-image/src/imagecaption/imagecaption.js
  9. 1 1
      packages/ckeditor5-image/src/imagecaption/imagecaptionengine.js
  10. 2 2
      packages/ckeditor5-image/src/imagestyle/imagestyle.js
  11. 1 1
      packages/ckeditor5-image/src/imagestyle/converters.js
  12. 1 1
      packages/ckeditor5-image/src/imagestyle/imagestylecommand.js
  13. 1 1
      packages/ckeditor5-image/src/imagestyle/imagestyleengine.js
  14. 23 23
      packages/ckeditor5-image/src/imagealternatetext/imagealternatetext.js
  15. 4 4
      packages/ckeditor5-image/src/imagealternatetext/imagealternatetextcommand.js
  16. 26 0
      packages/ckeditor5-image/src/imagetextalternative/imagetextalternativeengine.js
  17. 6 6
      packages/ckeditor5-image/src/imagealternatetext/ui/alternatetextformview.js
  18. 3 3
      packages/ckeditor5-image/src/imagetoolbar.js
  19. 4 4
      packages/ckeditor5-image/tests/image.js
  20. 3 3
      packages/ckeditor5-image/tests/converters.js
  21. 2 2
      packages/ckeditor5-image/tests/imageengine.js
  22. 2 2
      packages/ckeditor5-image/tests/ui/imageballoonpanelview.js
  23. 2 2
      packages/ckeditor5-image/tests/utils.js
  24. 2 2
      packages/ckeditor5-image/tests/imagecaption/imagecaption.js
  25. 1 1
      packages/ckeditor5-image/tests/imagecaption/imagecaptionengine.js
  26. 3 3
      packages/ckeditor5-image/tests/imagestyle/imagestyle.js
  27. 1 1
      packages/ckeditor5-image/tests/imagestyle/imagestyleengine.js
  28. 24 24
      packages/ckeditor5-image/tests/imagealternatetext/imagealternatetext.js
  29. 3 3
      packages/ckeditor5-image/tests/imagealternatetext/imagealternatetextcommand.js
  30. 5 5
      packages/ckeditor5-image/tests/imagealternatetext/imagelaternatetextengine.js
  31. 4 4
      packages/ckeditor5-image/tests/imagealternatetext/ui/alternatetextformview.js
  32. 1 1
      packages/ckeditor5-image/tests/imagetoolbar.js
  33. 0 10
      packages/ckeditor5-image/tests/manual/alternatetext.md
  34. 8 8
      packages/ckeditor5-image/tests/manual/caption.js
  35. 7 7
      packages/ckeditor5-image/tests/manual/imagestyle.js
  36. 0 0
      packages/ckeditor5-image/tests/manual/textalternative.html
  37. 0 0
      packages/ckeditor5-image/tests/manual/textalternative.js
  38. 10 0
      packages/ckeditor5-image/tests/manual/textalternative.md
  39. 1 1
      packages/ckeditor5-image/theme/imagealternatetext/theme.scss

+ 2 - 2
packages/ckeditor5-image/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."
 }

+ 4 - 4
packages/ckeditor5-image/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 ];
 	}
 }

+ 1 - 1
packages/ckeditor5-image/src/converters.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module image/converters
+ * @module image/image/converters
  */
 
 import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element';

+ 2 - 2
packages/ckeditor5-image/src/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';

+ 15 - 11
packages/ckeditor5-image/src/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';
@@ -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'
+		};
+	}
 };
 
 /**

+ 2 - 2
packages/ckeditor5-image/src/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' );

+ 0 - 26
packages/ckeditor5-image/src/imagealternatetext/imagealternatetextengine.js

@@ -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 ) );
-	}
-}

+ 3 - 3
packages/ckeditor5-image/src/imagecaption/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.

+ 1 - 1
packages/ckeditor5-image/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';
 
 /**

+ 2 - 2
packages/ckeditor5-image/src/imagestyle/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';
 
 /**

+ 1 - 1
packages/ckeditor5-image/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.

+ 1 - 1
packages/ckeditor5-image/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.

+ 1 - 1
packages/ckeditor5-image/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';

+ 23 - 23
packages/ckeditor5-image/src/imagealternatetext/imagealternatetext.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
 			} );
 
@@ -94,20 +94,20 @@ export default class ImageAlternateText extends Plugin {
 	 * Creates balloon panel.
 	 *
 	 * @private
-	 * @return {Promise.<module:image/ui/imageballoonpanel~ImageBalloonPanelView>}
+	 * @return {Promise.<module:image/image/ui/imageballoonpanel~ImageBalloonPanelView>}
 	 */
 	_createBalloonPanel() {
 		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();

+ 4 - 4
packages/ckeditor5-image/src/imagealternatetext/imagealternatetextcommand.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
 	 */

+ 26 - 0
packages/ckeditor5-image/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 ) );
+	}
+}

+ 6 - 6
packages/ckeditor5-image/src/imagealternatetext/ui/alternatetextformview.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;
 	}

+ 3 - 3
packages/ckeditor5-image/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 {
 	/**

+ 4 - 4
packages/ckeditor5-image/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 );
 	} );
 } );

+ 3 - 3
packages/ckeditor5-image/tests/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';

+ 2 - 2
packages/ckeditor5-image/tests/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', () => {

+ 2 - 2
packages/ckeditor5-image/tests/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', () => {

+ 2 - 2
packages/ckeditor5-image/tests/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;

+ 2 - 2
packages/ckeditor5-image/tests/imagecaption/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;

+ 1 - 1
packages/ckeditor5-image/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';

+ 3 - 3
packages/ckeditor5-image/tests/imagestyle/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';
 

+ 1 - 1
packages/ckeditor5-image/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';

+ 24 - 24
packages/ckeditor5-image/tests/imagealternatetext/imagealternatetext.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, '[<image src="" alt="foo bar"></image>]' );
 			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, '[<image src="" alt="foo bar"></image>]' );
 			button.fire( 'execute' );
 			const spy = sinon.spy( imageToolbarPlugin, 'show' );

+ 3 - 3
packages/ckeditor5-image/tests/imagealternatetext/imagealternatetextcommand.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' );
 

+ 5 - 5
packages/ckeditor5-image/tests/imagealternatetext/imagelaternatetextengine.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 );
 	} );
 } );

+ 4 - 4
packages/ckeditor5-image/tests/imagealternatetext/ui/alternatetextformview.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', () => {

+ 1 - 1
packages/ckeditor5-image/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';

+ 0 - 10
packages/ckeditor5-image/tests/manual/alternatetext.md

@@ -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.
-

+ 8 - 8
packages/ckeditor5-image/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 );
+} );

+ 7 - 7
packages/ckeditor5-image/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 );
+} );

packages/ckeditor5-image/tests/manual/alternatetext.html → packages/ckeditor5-image/tests/manual/textalternative.html


packages/ckeditor5-image/tests/manual/alternatetext.js → packages/ckeditor5-image/tests/manual/textalternative.js


+ 10 - 0
packages/ckeditor5-image/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.
+

+ 1 - 1
packages/ckeditor5-image/theme/imagealternatetext/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;