Przeglądaj źródła

Adjustments to new 'Paste from Office' name.

Krzysztof Krztoń 7 lat temu
rodzic
commit
ac2715ff74

+ 2 - 2
packages/ckeditor5-paste-from-office/src/filters/list.js

@@ -7,7 +7,7 @@ import Element from '@ckeditor/ckeditor5-engine/src/view/element';
 import Matcher from '@ckeditor/ckeditor5-engine/src/view/matcher';
 import Position from '@ckeditor/ckeditor5-engine/src/view/position';
 import TreeWalker from '@ckeditor/ckeditor5-engine/src/view/treewalker';
-import RawWriter from '@ckeditor/ckeditor5-engine/src/view/rawwriter';
+import UpcastWriter from '@ckeditor/ckeditor5-engine/src/view/upcastwriter';
 
 /**
  * Transforms Word specific list-like elements to the semantic HTML lists.
@@ -38,7 +38,7 @@ export function paragraphsToLists( data ) {
 }
 
 // Writer used for View elements manipulation.
-const writer = new RawWriter();
+const writer = new UpcastWriter();
 
 // Matcher for finding list-like elements.
 const listMatcher = new Matcher( {

+ 3 - 3
packages/ckeditor5-paste-from-office/src/pastefromword.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module pastefromword/pastefromword
+ * @module pastefromoffice/pastefromoffice
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
@@ -19,12 +19,12 @@ import { paragraphsToLists } from './filters/list';
  *
  * @extends module:core/plugin~Plugin
  */
-export default class PasteFromWord extends Plugin {
+export default class PasteFromOffice extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
 	static get pluginName() {
-		return 'PasteFromWord';
+		return 'PasteFromOffice';
 	}
 
 	/**

+ 5 - 8
packages/ckeditor5-paste-from-office/tests/data/integration/list.js

@@ -14,8 +14,7 @@ import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
 import Link from '@ckeditor/ckeditor5-link/src/link';
 import List from '@ckeditor/ckeditor5-list/src/list';
-import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
-import PasteFromWord from '../../../src/pastefromword';
+import PasteFromOffice from '../../../src/pastefromoffice';
 
 import { setData, stringify } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { pasteHtml } from '../../_utils/utils';
@@ -30,9 +29,7 @@ import heading3Styled from '../../_data/list/heading3-styled/input.word2016.html
 import heading7 from '../../_data/list/heading7/input.word2016.html';
 
 describe( 'List – integration', () => {
-	let element, editor, insertContentStub, insertedModel;
-
-	testUtils.createSinonSandbox();
+	let element, editor, insertedModel;
 
 	before( () => {
 		element = document.createElement( 'div' );
@@ -40,14 +37,14 @@ describe( 'List – integration', () => {
 		document.body.appendChild( element );
 
 		return ClassicTestEditor
-			.create( element, { plugins: [ Clipboard, Paragraph, Heading, Bold, Italic, Underline, Link, List, PasteFromWord ] } )
+			.create( element, { plugins: [ Clipboard, Paragraph, Heading, Bold, Italic, Underline, Link, List, PasteFromOffice ] } )
 			.then( editorInstance => {
 				editor = editorInstance;
 
 				const model = editor.model;
 				const insertContent = model.insertContent;
 
-				insertContentStub = sinon.stub( editor.model, 'insertContent' ).callsFake( ( content, selection ) => {
+				sinon.stub( editor.model, 'insertContent' ).callsFake( ( content, selection ) => {
 					// Save model string representation now as it may change after `insertContent()` function call
 					// so accessing it later may not work as it may have empty/changed structure.
 					insertedModel = stringify( content );
@@ -65,7 +62,7 @@ describe( 'List – integration', () => {
 	} );
 
 	after( () => {
-		insertContentStub.restore();
+		sinon.restore();
 
 		editor.destroy();
 

+ 12 - 12
packages/ckeditor5-paste-from-office/tests/data/normalization/list.js

@@ -6,7 +6,7 @@
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
-import PasteFromWord from '../../../src/pastefromword';
+import PasteFromOffice from '../../../src/pastefromoffice';
 
 import { stringify } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml';
@@ -30,52 +30,52 @@ import heading3StyledNormalized from '../../_data/list/heading3-styled/normalize
 import heading7Normalized from '../../_data/list/heading7/normalized.word2016.html';
 
 describe( 'List – normalization', () => {
-	let editor, pasteFromWordPlugin;
+	let editor, pasteFromOfficePlugin;
 
 	testUtils.createSinonSandbox();
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Clipboard, PasteFromWord ]
+				plugins: [ Clipboard, PasteFromOffice ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
 
-				pasteFromWordPlugin = editor.plugins.get( 'PasteFromWord' );
+				pasteFromOfficePlugin = editor.plugins.get( 'PasteFromOffice' );
 			} );
 	} );
 
 	it( 'normalizes simple list', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( simple, editor ), simpleNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( simple, editor ), simpleNormalized );
 	} );
 
 	it( 'normalizes list with styled items prepended by a paragraph', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( styled, editor ), styledNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( styled, editor ), styledNormalized );
 	} );
 
 	it( 'normalizes multiple lists separated by the paragraph', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( multiple, editor ), multipleNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( multiple, editor ), multipleNormalized );
 	} );
 
 	it( 'normalizes multiple lists one right after another', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( multipleCombined, editor ), multipleCombinedNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( multipleCombined, editor ), multipleCombinedNormalized );
 	} );
 
 	it( 'normalizes many one item lists', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( manyOneItem, editor ), manyOneItemNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( manyOneItem, editor ), manyOneItemNormalized );
 	} );
 
 	it( 'normalizes list created from headings (h1)', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( heading1, editor ), heading1Normalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( heading1, editor ), heading1Normalized );
 	} );
 
 	it( 'normalizes list created from styled headings (h3)', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( heading3Styled, editor ), heading3StyledNormalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( heading3Styled, editor ), heading3StyledNormalized );
 	} );
 
 	it( 'normalizes list created from heading (h7)', () => {
-		expectNormalized( pasteFromWordPlugin._normalizeWordInput( heading7, editor ), heading7Normalized );
+		expectNormalized( pasteFromOfficePlugin._normalizeWordInput( heading7, editor ), heading7Normalized );
 	} );
 } );
 

+ 2 - 2
packages/ckeditor5-paste-from-office/tests/manual/integration.js

@@ -14,7 +14,7 @@ import Table from '@ckeditor/ckeditor5-table/src/table';
 
 import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-import PasteFromWord from '../../src/pastefromword';
+import PasteFromOffice from '../../src/pastefromoffice';
 
 const htmlDiv = document.querySelector( '#html' );
 const textDiv = document.querySelector( '#text' );
@@ -22,7 +22,7 @@ const dataDiv = document.querySelector( '#data' );
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ ArticlePluginSet, Strikethrough, Underline, Table, PasteFromWord ],
+		plugins: [ ArticlePluginSet, Strikethrough, Underline, Table, PasteFromOffice ],
 		toolbar: [ 'heading', '|', 'bold', 'italic', 'strikethrough', 'underline', 'link',
 			'bulletedList', 'numberedList', 'blockQuote', 'table', 'undo', 'redo' ]
 	} )

+ 4 - 4
packages/ckeditor5-paste-from-office/tests/pastefromword.js

@@ -7,10 +7,10 @@ import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-import PasteFromWord from '../src/pastefromword';
+import PasteFromOffice from '../src/pastefromoffice';
 import { createDataTransfer } from './_utils/utils';
 
-describe( 'Paste from Word plugin', () => {
+describe( 'Paste from Office plugin', () => {
 	let editor, normalizeSpy;
 
 	testUtils.createSinonSandbox();
@@ -18,11 +18,11 @@ describe( 'Paste from Word plugin', () => {
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Clipboard, PasteFromWord ]
+				plugins: [ Clipboard, PasteFromOffice ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
-				normalizeSpy = sinon.spy( editor.plugins.get( 'PasteFromWord' ), '_normalizeWordInput' );
+				normalizeSpy = sinon.spy( editor.plugins.get( 'PasteFromOffice' ), '_normalizeWordInput' );
 			} );
 	} );