8
0
Просмотр исходного кода

Merge pull request #218 from ckeditor/i/6091

Internal: Adjusted the code to changes required for replacing the `StylesProcessor` singleton with an instance of the class. See ckeditor/ckeditor5#6091.
Piotrek Koszuliński 5 лет назад
Родитель
Сommit
f7cc24d89b

+ 5 - 2
packages/ckeditor5-core/src/editor/editor.js

@@ -20,6 +20,7 @@ import EditingKeystrokeHandler from '../editingkeystrokehandler';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
+import { StylesProcessor } from '@ckeditor/ckeditor5-engine/src/view/stylesmap';
 
 /**
  * The class representing a basic, generic editor.
@@ -161,6 +162,8 @@ export default class Editor {
 		 */
 		this.model = new Model();
 
+		const stylesProcessor = new StylesProcessor();
+
 		/**
 		 * The {@link module:engine/controller/datacontroller~DataController data controller}.
 		 * Used e.g. for setting and retrieving the editor data.
@@ -168,7 +171,7 @@ export default class Editor {
 		 * @readonly
 		 * @member {module:engine/controller/datacontroller~DataController}
 		 */
-		this.data = new DataController( this.model );
+		this.data = new DataController( this.model, stylesProcessor );
 
 		/**
 		 * The {@link module:engine/controller/editingcontroller~EditingController editing controller}.
@@ -177,7 +180,7 @@ export default class Editor {
 		 * @readonly
 		 * @member {module:engine/controller/editingcontroller~EditingController}
 		 */
-		this.editing = new EditingController( this.model );
+		this.editing = new EditingController( this.model, stylesProcessor );
 		this.editing.view.document.bind( 'isReadOnly' ).to( this );
 
 		/**

+ 1 - 1
packages/ckeditor5-core/tests/_utils/classictesteditor.js

@@ -34,7 +34,7 @@ export default class ClassicTestEditor extends Editor {
 		}
 
 		// Use the HTML data processor in this editor.
-		this.data.processor = new HtmlDataProcessor();
+		this.data.processor = new HtmlDataProcessor( this.editing.view.document );
 
 		// Create the ("main") root element of the model tree.
 		this.model.document.createRoot();

+ 1 - 1
packages/ckeditor5-core/tests/_utils/modeltesteditor.js

@@ -21,7 +21,7 @@ export default class ModelTestEditor extends Editor {
 		super( config );
 
 		// Use the HTML data processor in this editor.
-		this.data.processor = new HtmlDataProcessor();
+		this.data.processor = new HtmlDataProcessor( this.editing.view.document );
 
 		// Disable editing pipeline.
 		this.editing.destroy();

+ 1 - 1
packages/ckeditor5-core/tests/_utils/virtualtesteditor.js

@@ -21,7 +21,7 @@ export default class VirtualTestEditor extends Editor {
 		super( config );
 
 		// Use the HTML data processor in this editor.
-		this.data.processor = new HtmlDataProcessor();
+		this.data.processor = new HtmlDataProcessor( this.editing.view.document );
 
 		// Create the ("main") root element of the model tree.
 		this.model.document.createRoot();

+ 1 - 1
packages/ckeditor5-core/tests/editor/utils/attachtoform.js

@@ -31,7 +31,7 @@ describe( 'attachToForm()', () => {
 		mix( CustomEditor, ElementApiMixin );
 
 		editor = new CustomEditor();
-		editor.data.processor = new HtmlDataProcessor();
+		editor.data.processor = new HtmlDataProcessor( editor.editing.view.document );
 		editor.model.document.createRoot();
 		editor.model.schema.extend( '$text', { allowIn: '$root' } );
 		editor.fire( 'ready' );

+ 1 - 1
packages/ckeditor5-core/tests/editor/utils/dataapimixin.js

@@ -18,7 +18,7 @@ describe( 'DataApiMixin', () => {
 		mix( CustomEditor, DataApiMixin );
 
 		editor = new CustomEditor();
-		editor.data.processor = new HtmlDataProcessor();
+		editor.data.processor = new HtmlDataProcessor( editor.editing.view.document );
 		editor.model.document.createRoot( '$root', 'main' );
 		editor.model.document.createRoot( '$root', 'secondRoot' );
 		editor.model.schema.extend( '$text', { allowIn: '$root' } );

+ 1 - 1
packages/ckeditor5-core/tests/editor/utils/elementapimixin.js

@@ -21,7 +21,7 @@ describe( 'ElementApiMixin', () => {
 		mix( CustomEditor, ElementApiMixin );
 
 		editor = new CustomEditor();
-		editor.data.processor = new HtmlDataProcessor();
+		editor.data.processor = new HtmlDataProcessor( editor.editing.view.document );
 		editor.model.document.createRoot();
 		editor.model.schema.extend( '$text', { allowIn: '$root' } );
 		editor.fire( 'ready' ); // (#6139)