Jelajahi Sumber

Other: Move configuration definition to constructor.

Maciej Gołaszewski 8 tahun lalu
induk
melakukan
3eebb8526e
1 mengubah file dengan 11 tambahan dan 4 penghapusan
  1. 11 4
      packages/ckeditor5-highlight/src/highlightediting.js

+ 11 - 4
packages/ckeditor5-highlight/src/highlightediting.js

@@ -25,10 +25,8 @@ export default class HighlightEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
-	init() {
-		const editor = this.editor;
-		const data = editor.data;
-		const editing = editor.editing;
+	constructor( editor ) {
+		super( editor );
 
 		editor.config.define( 'highlight', [
 			{ class: 'marker', title: 'Marker', color: '#ffff66', type: 'marker' },
@@ -37,6 +35,15 @@ export default class HighlightEditing extends Plugin {
 			{ class: 'pen-red', title: 'Red Pen', color: '#ff0000', type: 'pen' },
 			{ class: 'pen-blue', title: 'Blue Pen', color: '#0000ff', type: 'pen' }
 		] );
+	}
+
+	/**
+	 * @inheritDoc
+	 */
+	init() {
+		const editor = this.editor;
+		const data = editor.data;
+		const editing = editor.editing;
 
 		// Allow highlight attribute on all elements
 		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$block' } );