Sfoglia il codice sorgente

Remove unnecessary propeties form PFO class.

Mateusz Samsel 6 anni fa
parent
commit
8180902813

+ 5 - 13
packages/ckeditor5-paste-from-office/src/pastefromoffice.js

@@ -27,18 +27,6 @@ export default class PasteFromOffice extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
-	constructor( editor ) {
-		super( editor );
-
-		this._normalizers = new Set();
-
-		this._normalizers.add( mswordNormalizer );
-		this._normalizers.add( googleDocsNormalizer );
-	}
-
-	/**
-	 * @inheritDoc
-	 */
 	static get pluginName() {
 		return 'PasteFromOffice';
 	}
@@ -55,12 +43,16 @@ export default class PasteFromOffice extends Plugin {
 	 */
 	init() {
 		const editor = this.editor;
+		const normalizers = new Set();
+
+		normalizers.add( mswordNormalizer );
+		normalizers.add( googleDocsNormalizer );
 
 		this.listenTo(
 			editor.plugins.get( 'Clipboard' ),
 			'inputTransformation',
 			( evt, data ) => {
-				for ( const normalizer of this._normalizers ) {
+				for ( const normalizer of normalizers ) {
 					normalizer.transform( data );
 				}
 			},

+ 0 - 12
packages/ckeditor5-paste-from-office/tests/pastefromoffice.js

@@ -6,7 +6,6 @@
 import PasteFromOffice from '../src/pastefromoffice';
 import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
-import ContentNormalizer from '../src/contentnormalizer';
 
 describe( 'PasteFromOffice', () => {
 	let editor, pasteFromOffice;
@@ -31,15 +30,4 @@ describe( 'PasteFromOffice', () => {
 	it( 'should load Clipboard plugin', () => {
 		expect( editor.plugins.get( Clipboard ) ).to.be.instanceOf( Clipboard );
 	} );
-
-	describe( 'constructor()', () => {
-		it( 'should initialize 2 normalizers', () => {
-			expect( pasteFromOffice._normalizers ).to.be.a( 'set' );
-			expect( pasteFromOffice._normalizers.size ).to.equal( 2 );
-
-			pasteFromOffice._normalizers.forEach( value => {
-				expect( value ).to.be.instanceOf( ContentNormalizer );
-			} );
-		} );
-	} );
 } );