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

Implement Plugin interface in custom plugin.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
b35e89739a

+ 0 - 2
packages/ckeditor5-engine/docs/_snippets/framework/build-extending-content-source.js

@@ -8,10 +8,8 @@
 import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
 import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
 import Font from '@ckeditor/ckeditor5-font/src/font';
-import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 
 ClassicEditor.builtinPlugins.push( Code );
 ClassicEditor.builtinPlugins.push( Font );
 
 window.ClassicEditor = ClassicEditor;
-window.Plugin = Plugin;

+ 10 - 2
packages/ckeditor5-engine/docs/_snippets/framework/extending-content-custom-figure-attributes.js

@@ -3,14 +3,22 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals ClassicEditor, Plugin,  console, window, document */
+/* globals ClassicEditor,  console, window, document */
 
 import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
 
 /**
  * Plugin that converts custom attributes for elements that are wrapped in <figure> in the view.
  */
-class CustomFigureAttributes extends Plugin {
+class CustomFigureAttributes {
+	/**
+	 * Plugin's constructor - receives editor instance on creation.
+	 */
+	constructor( editor ) {
+		// Save reference to the editor.
+		this.editor = editor;
+	}
+
 	/**
 	 * Setups conversion and extends table & image features schema.
 	 *

+ 8 - 3
packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md

@@ -287,12 +287,17 @@ To overcome this limitation it is sufficient to write a custom converter that ad
 The sample below is extensible. To add your own attributes to preserve, just add another `setupCustomAttributeConversion()` call with desired names.
 
 ```js
-import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-
 /**
  * Plugin that converts custom attributes for elements that are wrapped in <figure> in the view.
  */
-class CustomFigureAttributes extends Plugin {
+class CustomFigureAttributes {
+	/**
+	 * Plugin's constructor - receives editor instance on creation.
+	 */
+	constructor( editor ) {
+		// Save reference to the editor.
+		this.editor = editor;
+}
 
 	/**
 	 * Setups conversion and extends table & image features schema.