瀏覽代碼

Code refactoring: Got rid of the Paragraph dependency in the WidgetTypeAround plugin.

Aleksander Nowodzinski 5 年之前
父節點
當前提交
415f0bf809

+ 0 - 8
packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js

@@ -10,7 +10,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Template from '@ckeditor/ckeditor5-ui/src/template';
 import {
 	isArrowKeyCode,
@@ -57,13 +56,6 @@ export default class WidgetTypeAround extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
-	static get requires() {
-		return [ Paragraph ];
-	}
-
-	/**
-	 * @inheritDoc
-	 */
 	static get pluginName() {
 		return 'WidgetTypeAround';
 	}

+ 2 - 1
packages/ckeditor5-widget/tests/widget-integration.js

@@ -6,6 +6,7 @@
 /* global document */
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Typing from '@ckeditor/ckeditor5-typing/src/typing';
 import Widget from '../src/widget';
 import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventdata';
@@ -31,7 +32,7 @@ describe( 'Widget - integration', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicEditor.create( editorElement, { plugins: [ Widget, Typing ] } )
+		return ClassicEditor.create( editorElement, { plugins: [ Paragraph, Widget, Typing ] } )
 			.then( newEditor => {
 				editor = newEditor;
 				model = editor.model;

+ 3 - 2
packages/ckeditor5-widget/tests/widget.js

@@ -7,6 +7,7 @@
 
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import Enter from '@ckeditor/ckeditor5-enter/src/enter';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Widget from '../src/widget';
 import WidgetTypeAround from '../src/widgettypearound/widgettypearound';
 import Typing from '@ckeditor/ckeditor5-typing/src/typing';
@@ -29,7 +30,7 @@ describe( 'Widget', () => {
 
 		return ClassicTestEditor
 			.create( element, {
-				plugins: [ Widget, Typing, Enter ]
+				plugins: [ Paragraph, Widget, Typing, Enter ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -1262,7 +1263,7 @@ describe( 'Widget', () => {
 
 			return ClassicTestEditor
 				.create( element, {
-					plugins: [ Widget, Typing ]
+					plugins: [ Paragraph, Widget, Typing ]
 				} )
 				.then( newEditor => {
 					editor = newEditor;

+ 3 - 4
packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js

@@ -5,7 +5,6 @@
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventdata';
 import EventInfo from '@ckeditor/ckeditor5-utils/src/eventinfo';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
@@ -46,12 +45,12 @@ describe( 'WidgetTypeAround', () => {
 	} );
 
 	describe( 'plugin', () => {
-		it( 'is loaded', () => {
+		it( 'should be loaded', () => {
 			expect( editor.plugins.get( WidgetTypeAround ) ).to.be.instanceOf( WidgetTypeAround );
 		} );
 
-		it( 'requires the Paragraph plugin', () => {
-			expect( WidgetTypeAround.requires ).to.deep.equal( [ Paragraph ] );
+		it( 'should have a name', () => {
+			expect( WidgetTypeAround.pluginName ).to.equal( 'WidgetTypeAround' );
 		} );
 	} );