|
|
@@ -3,16 +3,22 @@
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
|
|
|
|
-/* globals ClassicEditor, console, window, document */
|
|
|
+/* globals ClassicEditor, Plugin, 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.
|
|
|
*/
|
|
|
-function CustomFigureAttributes( editor ) {
|
|
|
- // Schema extending must be done in the “afterInit()” call because plugins define their schema in “init()“.
|
|
|
- this.afterInit = () => {
|
|
|
+class CustomFigureAttributes extends Plugin {
|
|
|
+ /**
|
|
|
+ * Setups conversion and extends table & image features schema.
|
|
|
+ *
|
|
|
+ * Schema extending must be done in the “afterInit()” call because plugins define their schema in “init()“.
|
|
|
+ */
|
|
|
+ afterInit() {
|
|
|
+ const editor = this.editor;
|
|
|
+
|
|
|
// Define on which elements the CSS classes should be preserved:
|
|
|
setupCustomClassConversion( 'img', 'image', editor );
|
|
|
setupCustomClassConversion( 'table', 'table', editor );
|
|
|
@@ -22,7 +28,7 @@ function CustomFigureAttributes( editor ) {
|
|
|
// Define custom attributes that should be preserved.
|
|
|
setupCustomAttributeConversion( 'img', 'image', 'id', editor );
|
|
|
setupCustomAttributeConversion( 'table', 'table', 'id', editor );
|
|
|
- };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|