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

Styles Processor must be unique across the entire editor instance.

Kamil Piechaczek 6 лет назад
Родитель
Сommit
5e88f5f236

+ 11 - 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,14 @@ export default class Editor {
 		 */
 		this.model = new Model();
 
+		/**
+		 * StylesProcessor is responsible for writing and reading a normalized styles object.
+		 *
+		 * @readonly
+		 * @member {module:engine/view/stylesmap~StylesProcessor}
+		 */
+		this.stylesProcessor = new StylesProcessor();
+
 		/**
 		 * The {@link module:engine/controller/datacontroller~DataController data controller}.
 		 * Used e.g. for setting and retrieving the editor data.
@@ -168,7 +177,7 @@ export default class Editor {
 		 * @readonly
 		 * @member {module:engine/controller/datacontroller~DataController}
 		 */
-		this.data = new DataController( this.model );
+		this.data = new DataController( this.model, this.stylesProcessor );
 
 		/**
 		 * The {@link module:engine/controller/editingcontroller~EditingController editing controller}.
@@ -177,7 +186,7 @@ export default class Editor {
 		 * @readonly
 		 * @member {module:engine/controller/editingcontroller~EditingController}
 		 */
-		this.editing = new EditingController( this.model );
+		this.editing = new EditingController( this.model, this.stylesProcessor );
 		this.editing.view.document.bind( 'isReadOnly' ).to( this );
 
 		/**

+ 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.stylesProcessor );
 
 		// Create the ("main") root element of the model tree.
 		this.model.document.createRoot();