Browse Source

Renamed `contextual/contextualtoolbar~ContextualToolbar` to `balloon/balloontoolbar~BalloonToolbar`.

Maciej Gołaszewski 7 years ago
parent
commit
6a5ad09dc3

+ 4 - 4
packages/ckeditor5-image/src/image.js

@@ -42,13 +42,13 @@ export default class Image extends Plugin {
 	 */
 	init() {
 		const editor = this.editor;
-		const contextualToolbar = editor.plugins.get( 'ContextualToolbar' );
+		const balloonToolbar = editor.plugins.get( 'BalloonToolbar' );
 
-		// If `ContextualToolbar` plugin is loaded, it should be disabled for images
+		// If `BalloonToolbar` plugin is loaded, it should be disabled for images
 		// which have their own toolbar to avoid duplication.
 		// https://github.com/ckeditor/ckeditor5-image/issues/110
-		if ( contextualToolbar ) {
-			this.listenTo( contextualToolbar, 'show', evt => {
+		if ( balloonToolbar ) {
+			this.listenTo( balloonToolbar, 'show', evt => {
 				if ( isImageWidgetSelected( editor.editing.view.selection ) ) {
 					evt.stop();
 				}

+ 17 - 17
packages/ckeditor5-image/tests/integration.js

@@ -5,15 +5,15 @@
 
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
-import ContextualToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/contextual/contextualtoolbar';
+import BalloonToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/balloon/balloontoolbar';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import Image from '../src/image';
 import View from '@ckeditor/ckeditor5-ui/src/view';
 
 describe( 'Image integration', () => {
-	describe( 'with the ContextualToolbar', () => {
-		let balloon, contextualToolbar, newEditor, editorElement;
+	describe( 'with the BalloonToolbar', () => {
+		let balloon, balloonToolbar, newEditor, editorElement;
 
 		beforeEach( () => {
 			editorElement = global.document.createElement( 'div' );
@@ -21,19 +21,19 @@ describe( 'Image integration', () => {
 
 			return ClassicTestEditor
 				.create( editorElement, {
-					plugins: [ Image, ContextualToolbar, Paragraph ]
+					plugins: [ Image, BalloonToolbar, Paragraph ]
 				} )
 				.then( editor => {
 					newEditor = editor;
 					balloon = newEditor.plugins.get( 'ContextualBalloon' );
-					contextualToolbar = newEditor.plugins.get( 'ContextualToolbar' );
+					balloonToolbar = newEditor.plugins.get( 'BalloonToolbar' );
 					const button = new View();
 
 					button.element = global.document.createElement( 'div' );
 
 					// There must be at least one toolbar items which is not disabled to show it.
 					// https://github.com/ckeditor/ckeditor5-ui/issues/269
-					contextualToolbar.toolbarView.items.add( button );
+					balloonToolbar.toolbarView.items.add( button );
 
 					newEditor.editing.view.isFocused = true;
 					newEditor.editing.view.getDomRoot().focus();
@@ -45,25 +45,25 @@ describe( 'Image integration', () => {
 			return newEditor.destroy();
 		} );
 
-		it( 'should prevent the ContextualToolbar from being displayed when an image is selected', () => {
+		it( 'should prevent the BalloonToolbar from being displayed when an image is selected', () => {
 			// When image is selected along with text.
 			setModelData( newEditor.model, '<paragraph>fo[o</paragraph><image alt="alt text" src="foo.png"></image>]' );
 
-			contextualToolbar.show();
+			balloonToolbar.show();
 
-			// ContextualToolbar should be visible.
-			expect( balloon.visibleView ).to.equal( contextualToolbar.toolbarView );
+			// BalloonToolbar should be visible.
+			expect( balloon.visibleView ).to.equal( balloonToolbar.toolbarView );
 
 			// When only image is selected.
 			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="foo.png"></image>]' );
 
-			contextualToolbar.show();
+			balloonToolbar.show();
 
-			// ContextualToolbar should not be visible.
+			// BalloonToolbar should not be visible.
 			expect( balloon.visibleView ).to.be.null;
 		} );
 
-		it( 'should listen to ContextualToolbar#show event with the high priority', () => {
+		it( 'should listen to BalloonToolbar#show event with the high priority', () => {
 			const highestPrioritySpy = sinon.spy();
 			const highPrioritySpy = sinon.spy();
 			const normalPrioritySpy = sinon.spy();
@@ -71,11 +71,11 @@ describe( 'Image integration', () => {
 			// Select an image
 			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="foo.png"></image>]' );
 
-			newEditor.listenTo( contextualToolbar, 'show', highestPrioritySpy, { priority: 'highest' } );
-			newEditor.listenTo( contextualToolbar, 'show', highPrioritySpy, { priority: 'high' } );
-			newEditor.listenTo( contextualToolbar, 'show', normalPrioritySpy, { priority: 'normal' } );
+			newEditor.listenTo( balloonToolbar, 'show', highestPrioritySpy, { priority: 'highest' } );
+			newEditor.listenTo( balloonToolbar, 'show', highPrioritySpy, { priority: 'high' } );
+			newEditor.listenTo( balloonToolbar, 'show', normalPrioritySpy, { priority: 'normal' } );
 
-			contextualToolbar.show();
+			balloonToolbar.show();
 
 			sinon.assert.calledOnce( highestPrioritySpy );
 			sinon.assert.notCalled( highPrioritySpy );

+ 3 - 3
packages/ckeditor5-image/tests/manual/tickets/110/1.js

@@ -12,13 +12,13 @@ import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
 import ImagePlugin from '../../../../src/image';
 import UndoPlugin from '@ckeditor/ckeditor5-undo/src/undo';
-import ContextualToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/contextual/contextualtoolbar';
+import BalloonToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/balloon/balloontoolbar';
 import ImageToolbar from '../../../../src/imagetoolbar';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ EnterPlugin, TypingPlugin, ParagraphPlugin, HeadingPlugin, ImagePlugin, UndoPlugin, ImageToolbar, ContextualToolbar ],
-		contextualToolbar: [ 'headings', '|', 'undo', 'redo' ],
+		plugins: [ EnterPlugin, TypingPlugin, ParagraphPlugin, HeadingPlugin, ImagePlugin, UndoPlugin, ImageToolbar, BalloonToolbar ],
+		balloonToolbar: [ 'headings', '|', 'undo', 'redo' ],
 		image: {
 			toolbar: [ 'imageTextAlternative' ]
 		}

+ 3 - 3
packages/ckeditor5-image/tests/manual/tickets/110/1.md

@@ -1,6 +1,6 @@
-### Double image toolbar when ContextualToolbar plugin is loaded [#110](https://github.com/ckeditor/ckeditor5-image/issues/110)
+### Double image toolbar when BalloonToolbar plugin is loaded [#110](https://github.com/ckeditor/ckeditor5-image/issues/110)
 
-1. When selecting a text, the `ContextualToolbar` should appear.
+1. When selecting a text, the `BalloonToolbar` should appear.
 2. Click on image:
    1. The image toolbar in a balloon should show up,
-   2. The ContextualToolbar should not be visible.
+   2. The BalloonToolbar should not be visible.

+ 2 - 2
packages/ckeditor5-image/tests/manual/tickets/127/1.js

@@ -14,12 +14,12 @@ import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Image from '../../../../src/image';
 import ImageCaption from '../../../../src/imagecaption';
 import Undo from '@ckeditor/ckeditor5-undo/src/undo';
-import ContextualToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/contextual/contextualtoolbar';
+import BalloonToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/balloon/balloontoolbar';
 import ImageToolbar from '../../../../src/imagetoolbar';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ Enter, Typing, Paragraph, Link, Bold, Image, Undo, ImageToolbar, ContextualToolbar, ImageCaption ],
+		plugins: [ Enter, Typing, Paragraph, Link, Bold, Image, Undo, ImageToolbar, BalloonToolbar, ImageCaption ],
 		toolbar: [ 'bold', 'undo', 'redo' ],
 	} )
 	.then( editor => {