ソースを参照

Renamed `WidgetTypeAround#typeAround` -> `WidgetTypeAround#_insertParagraph`.

Aleksander Nowodzinski 5 年 前
コミット
897accdc12

+ 3 - 2
packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js

@@ -70,10 +70,11 @@ export default class WidgetTypeAround extends Plugin {
 	 * **Note**: This method is heavily user-oriented and will both focus the editing view and scroll
 	 * **Note**: This method is heavily user-oriented and will both focus the editing view and scroll
 	 * the viewport to the selection in the inserted paragraph.
 	 * the viewport to the selection in the inserted paragraph.
 	 *
 	 *
+	 * @private
 	 * @param {module:engine/view/element~Element} widgetViewElement The view widget element next to which a paragraph is inserted.
 	 * @param {module:engine/view/element~Element} widgetViewElement The view widget element next to which a paragraph is inserted.
 	 * @param {String} position The position where the paragraph is inserted. Either `'before'` or `'after'` the widget.
 	 * @param {String} position The position where the paragraph is inserted. Either `'before'` or `'after'` the widget.
 	 */
 	 */
-	typeAround( widgetViewElement, position ) {
+	_insertParagraph( widgetViewElement, position ) {
 		const editor = this.editor;
 		const editor = this.editor;
 		const editingView = editor.editing.view;
 		const editingView = editor.editing.view;
 		let viewPosition;
 		let viewPosition;
@@ -185,7 +186,7 @@ export default class WidgetTypeAround extends Plugin {
 			const buttonPosition = getTypeAroundButtonPosition( button );
 			const buttonPosition = getTypeAroundButtonPosition( button );
 			const widgetViewElement = getClosestWidgetViewElement( button, editingView.domConverter );
 			const widgetViewElement = getClosestWidgetViewElement( button, editingView.domConverter );
 
 
-			this.typeAround( widgetViewElement, buttonPosition );
+			this._insertParagraph( widgetViewElement, buttonPosition );
 
 
 			domEventData.preventDefault();
 			domEventData.preventDefault();
 			evt.stop();
 			evt.stop();

+ 9 - 9
packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js

@@ -53,11 +53,11 @@ describe( 'WidgetTypeAround', () => {
 		} );
 		} );
 	} );
 	} );
 
 
-	describe( 'typeAround()', () => {
+	describe( '_insertParagraph()', () => {
 		it( 'should insert a paragraph with a selection before a widget when position is "before"', () => {
 		it( 'should insert a paragraph with a selection before a widget when position is "before"', () => {
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 
 
-			plugin.typeAround( viewRoot.getChild( 0 ), 'before' );
+			plugin._insertParagraph( viewRoot.getChild( 0 ), 'before' );
 
 
 			expect( getModelData( editor.model ) ).to.equal( '<paragraph>[]</paragraph><blockWidget></blockWidget>' );
 			expect( getModelData( editor.model ) ).to.equal( '<paragraph>[]</paragraph><blockWidget></blockWidget>' );
 		} );
 		} );
@@ -65,7 +65,7 @@ describe( 'WidgetTypeAround', () => {
 		it( 'should insert a paragraph with a selection after a widget when position is "after"', () => {
 		it( 'should insert a paragraph with a selection after a widget when position is "after"', () => {
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 
 
-			plugin.typeAround( viewRoot.getChild( 0 ), 'after' );
+			plugin._insertParagraph( viewRoot.getChild( 0 ), 'after' );
 
 
 			expect( getModelData( editor.model ) ).to.equal( '<blockWidget></blockWidget><paragraph>[]</paragraph>' );
 			expect( getModelData( editor.model ) ).to.equal( '<blockWidget></blockWidget><paragraph>[]</paragraph>' );
 		} );
 		} );
@@ -75,7 +75,7 @@ describe( 'WidgetTypeAround', () => {
 
 
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 
 
-			plugin.typeAround( viewRoot.getChild( 0 ), 'after' );
+			plugin._insertParagraph( viewRoot.getChild( 0 ), 'after' );
 
 
 			sinon.assert.calledOnce( spy );
 			sinon.assert.calledOnce( spy );
 		} );
 		} );
@@ -85,7 +85,7 @@ describe( 'WidgetTypeAround', () => {
 
 
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 			setModelData( editor.model, '<blockWidget></blockWidget>' );
 
 
-			plugin.typeAround( viewRoot.getChild( 0 ), 'after' );
+			plugin._insertParagraph( viewRoot.getChild( 0 ), 'after' );
 
 
 			sinon.assert.calledOnce( spy );
 			sinon.assert.calledOnce( spy );
 		} );
 		} );
@@ -170,9 +170,9 @@ describe( 'WidgetTypeAround', () => {
 					expect( buttonBefore.getAttribute( 'title' ) ).to.equal( 'Insert paragraph before widget' );
 					expect( buttonBefore.getAttribute( 'title' ) ).to.equal( 'Insert paragraph before widget' );
 				} );
 				} );
 
 
-				it( 'should execute WidgetTypeAround#typeAround() when clicked', () => {
+				it( 'should execute WidgetTypeAround#_insertParagraph() when clicked', () => {
 					const preventDefaultSpy = sinon.spy();
 					const preventDefaultSpy = sinon.spy();
-					const typeAroundSpy = sinon.spy( plugin, 'typeAround' );
+					const typeAroundSpy = sinon.spy( plugin, '_insertParagraph' );
 
 
 					const eventInfo = new EventInfo( viewDocument, 'mousedown' );
 					const eventInfo = new EventInfo( viewDocument, 'mousedown' );
 					const stopSpy = sinon.stub( eventInfo, 'stop' );
 					const stopSpy = sinon.stub( eventInfo, 'stop' );
@@ -199,9 +199,9 @@ describe( 'WidgetTypeAround', () => {
 					expect( buttonAfter.getAttribute( 'title' ) ).to.equal( 'Insert paragraph after widget' );
 					expect( buttonAfter.getAttribute( 'title' ) ).to.equal( 'Insert paragraph after widget' );
 				} );
 				} );
 
 
-				it( 'should execute WidgetTypeAround#typeAround() when clicked', () => {
+				it( 'should execute WidgetTypeAround#_insertParagraph() when clicked', () => {
 					const preventDefaultSpy = sinon.spy();
 					const preventDefaultSpy = sinon.spy();
-					const typeAroundSpy = sinon.spy( plugin, 'typeAround' );
+					const typeAroundSpy = sinon.spy( plugin, '_insertParagraph' );
 
 
 					const eventInfo = new EventInfo( viewDocument, 'mousedown' );
 					const eventInfo = new EventInfo( viewDocument, 'mousedown' );
 					const stopSpy = sinon.stub( eventInfo, 'stop' );
 					const stopSpy = sinon.stub( eventInfo, 'stop' );