qms-angular 1.1.76 → 1.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/bundles/qms-angular.umd.js +18 -7
  2. package/bundles/qms-angular.umd.js.map +1 -1
  3. package/esm2015/lib/model/en.js +6 -2
  4. package/esm2015/lib/model/no.js +6 -2
  5. package/esm2015/lib/qms-ckeditor-components/common/functions/resource.function.js +9 -6
  6. package/fesm2015/qms-angular.js +18 -7
  7. package/fesm2015/qms-angular.js.map +1 -1
  8. package/lib/model/en.d.ts +4 -0
  9. package/lib/model/no.d.ts +4 -0
  10. package/lib/qms-ckeditor-components/common/functions/resource.function.d.ts +8 -5
  11. package/package.json +1 -1
  12. package/qms-angular.metadata.json +1 -1
  13. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +2 -2
  14. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  15. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +6 -2
  16. package/src/assets/qms-ckeditor-plugin/src/plugins/collapsible/collapsible.js +229 -0
  17. package/src/assets/qms-ckeditor-plugin/src/plugins/collapsible/collapsiblecommand.js +13 -0
  18. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +165 -163
  19. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +18 -8
  20. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/ingress/ingress.js +63 -0
  21. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/ingress/ingresscommand.js +33 -0
  22. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +44 -35
  23. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +2 -1
  24. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +99 -95
  25. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +110 -105
  26. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -529
  27. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -67
  28. package/src/assets/qms-ckeditor-plugin/src/plugins/tooltip/tooltipcommand.js +74 -75
  29. package/src/assets/qms-ckeditor-plugin/src/themes/icons/angles-up-down.svg +1 -0
@@ -68,6 +68,7 @@ import ToggleToolbar from './plugins/toggletoolbar/toggletoolbar.js';
68
68
  import Tooltip from './plugins/tooltip/tooltip.js';
69
69
  //import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader';
70
70
  import SourceEditing from './plugins/ckeditor5-source-editing/src/sourceediting';
71
+ import Collapsible from './plugins/collapsible/collapsible.js';
71
72
  import SpecialCharactersBlockElements from './plugins/ckeditor5-special-characters/src/specialcharactersblockelements.js';
72
73
  import SpecialCharactersBopomofo from './plugins/ckeditor5-special-characters/src/specialcharactersbopomofo.js';
73
74
  import SpecialCharactersBoxDrawing from './plugins/ckeditor5-special-characters/src/specialcharactersboxdrawing.js';
@@ -117,6 +118,7 @@ import SpecialCharactersLatinExtendedAdditional from './plugins/ckeditor5-specia
117
118
  import SpecialCharactersGreekExtended from './plugins/ckeditor5-special-characters/src/specialcharactersgreekextended.js';
118
119
  import SpecialCharactersGeneralPunctuation from './plugins/ckeditor5-special-characters/src/specialcharactersgeneralpunctuation.js';
119
120
  import SpecialCharactersSuperscriptsandSubscripts from './plugins/ckeditor5-special-characters/src/specialcharacterssuperscriptsandsubscripts.js';
121
+ import Ingress from './plugins/heading/ingress/ingress.js';
120
122
 
121
123
  class Editor extends ClassicEditor { }
122
124
 
@@ -185,7 +187,8 @@ Editor.builtinPlugins = [
185
187
  ToggleToolbar,
186
188
  TableOfContents,
187
189
  //WProofreader,
188
- SourceEditing,
190
+ SourceEditing,
191
+ Collapsible,
189
192
  SoftHyphenPlugin,
190
193
  QMSClipboardPlugin,
191
194
  ShowBlocksnPlugin,
@@ -236,7 +239,8 @@ Editor.builtinPlugins = [
236
239
  SpecialCharactersHiragana,
237
240
  SpecialCharactersKatakana,
238
241
  SpecialCharactersBopomofo,
239
- SpecialCharactersSpecials
242
+ SpecialCharactersSpecials,
243
+ Ingress
240
244
  ];
241
245
 
242
246
  Editor.defaultConfig = {
@@ -0,0 +1,229 @@
1
+ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
+ import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
3
+ import angleUpDownIcon from '../../themes/icons/angles-up-down.svg';
4
+ import CollapsibleCommand from './collapsiblecommand';
5
+ export default class Collapsible extends Plugin {
6
+ init() {
7
+ const openAttribute = "open";
8
+ const editor = this.editor;
9
+ const t = editor.t;
10
+ editor.commands.add('collapsible', new CollapsibleCommand(editor));
11
+
12
+ // DETAILS TAG
13
+ editor.model.schema.register('Details', {
14
+ allowWhere: '$block',
15
+ allowContentOf: '$root',
16
+ allowAttributes: [openAttribute],
17
+ });
18
+
19
+ editor.conversion.for('downcast').elementToElement({ model: 'Details', view: 'details' });
20
+
21
+ editor.conversion.for('downcast').add(dispatcher => {
22
+ dispatcher.on('insert:Details', (evt, data, conversionApi) => {
23
+ const viewWriter = conversionApi.writer;
24
+
25
+ const openAttributeValue = data.item._attrs.get('open');
26
+ if (openAttributeValue !== null && openAttributeValue !== undefined) {
27
+ viewWriter.setAttribute(openAttribute, openAttributeValue, conversionApi.mapper.toViewElement(data.item));
28
+ }
29
+ }, { priority: 'low' });
30
+ });
31
+
32
+ editor.conversion.for('upcast').elementToElement({
33
+ view: 'details',
34
+ model: (viewElement, { writer }) => {
35
+ const openAttributeValue = viewElement._attrs.get('open');
36
+ let attributes = {};
37
+ if (openAttributeValue !== null && openAttributeValue !== undefined) {
38
+ attributes = { open: openAttributeValue };
39
+ }
40
+ let detailsElement = writer.createElement('Details', attributes);
41
+ if(!viewElement._children.some(x => x.name.toLowerCase() === "summary"))
42
+ {
43
+ const summaryElement = writer.createElement('Summary');
44
+ const titleSummary = writer.createText(t('Details'));
45
+ writer.append(titleSummary, summaryElement);
46
+ writer.append(summaryElement, detailsElement);
47
+ }
48
+ return detailsElement;
49
+ }
50
+ });
51
+
52
+ // SUMMARY TAG
53
+ editor.model.schema.register('Summary', {
54
+ allowWhere: '$block',
55
+ allowContentOf: '$block'
56
+ });
57
+
58
+ editor.conversion.for('downcast').elementToElement({ model: 'Summary', view: 'summary' });
59
+
60
+ editor.conversion.for('downcast').add(dispatcher => {
61
+ dispatcher.on('insert:Summary', (evt, data, conversionApi) => {
62
+ const viewWriter = conversionApi.writer;
63
+
64
+ }, { priority: 'low' });
65
+ });
66
+
67
+ editor.conversion.for('upcast').elementToElement({
68
+ view: 'summary',
69
+ model: (viewElement, { writer }) => {
70
+ return writer.createElement('Summary');
71
+ }
72
+ });
73
+
74
+ const viewDocument = this.editor.editing.view.document;
75
+
76
+ // Handle click on view document and when user click on details section, we must update open attribute
77
+ this.listenTo(viewDocument, 'click', (event, data) => {
78
+ const detailsElement = data.target.findAncestor('details');
79
+
80
+ if (detailsElement) {
81
+ editor.model.change(writer => {
82
+ const modelElement = editor.editing.mapper.toModelElement(detailsElement);
83
+ if (modelElement.hasAttribute(openAttribute)) {
84
+ writer.removeAttribute(openAttribute, modelElement);
85
+ }
86
+ else {
87
+ writer.setAttribute(openAttribute, "", modelElement);
88
+ }
89
+ });
90
+ }
91
+ });
92
+
93
+ editor.editing.view.document.on('enter', (evt, data) => {
94
+ // if soft enter (shift + enter), keep it's default behavior
95
+ if (data.isSoft)
96
+ return;
97
+ const selection = editor.model.document.selection;
98
+ const firstPosition = selection.getFirstPosition();
99
+ const summaryElement = firstPosition.parent;
100
+
101
+ if (summaryElement.is('element', 'Summary')) {
102
+ evt.stop();
103
+ const detailsElement = summaryElement.findAncestor('Details');
104
+ if (detailsElement) {
105
+ this.createTempParagraphContent(detailsElement, true);
106
+ }
107
+ }
108
+ });
109
+
110
+ this.listenTo(viewDocument, 'arrowKey', (evt, data) => {
111
+ // Handle arrow down event
112
+ if (data.keyCode === 40) {
113
+ const selection = editor.model.document.selection;
114
+ const firstPosition = selection.getFirstPosition();
115
+ const element = firstPosition.parent;
116
+
117
+ if (element.is('element')) {
118
+ const detailsElement = element.findAncestor('Details');
119
+ // check reach last element of details tag
120
+ if (detailsElement && !element.nextSibling && !detailsElement.nextSibling) {
121
+ this.createTempParagraphContent(detailsElement);
122
+ }
123
+ else if (element.is('element', 'Summary') && detailsElement && !detailsElement.nextSibling && !detailsElement.hasAttribute(openAttribute)) {
124
+ this.createTempParagraphContent(detailsElement);
125
+ }
126
+ }
127
+ }
128
+ });
129
+
130
+ editor.ui.componentFactory.add('collapsible', locale => {
131
+ const view = new ButtonView(locale);
132
+
133
+ view.set({
134
+ label: t('Collapsible'),
135
+ icon: angleUpDownIcon,
136
+ tooltip: true
137
+ });
138
+
139
+ view.bind('isEnabled').to(editor.commands.get('collapsible'));
140
+ // const selection = editor.model.document.selection;
141
+
142
+ editor.model.document.selection.on('change:range', () => {
143
+ // Disable plugin when selection not a paragraph.
144
+ const selectedElements = Array.from(editor.model.document.selection.getSelectedBlocks());
145
+
146
+ if (editor.isReadOnly || (selectedElements && (selectedElements.length !== 1 || selectedElements[0].name !== "paragraph"))) {
147
+ view.isEnabled = false;
148
+ }
149
+ else
150
+ {
151
+ view.isEnabled = true;
152
+ }
153
+ });
154
+
155
+
156
+ view.on('execute', () => {
157
+ editor.model.change(writer => {
158
+ // Create a <details> element with an editable <summary> element
159
+ const detailsElement = writer.createElement('Details');
160
+ writer.setAttribute(openAttribute, "", detailsElement);
161
+
162
+ // Create <summary>
163
+ const summaryElement = writer.createElement('Summary');
164
+ const selectedElements = Array.from(editor.model.document.selection.getSelectedBlocks());
165
+ if (selectedElements && selectedElements.length === 1 && selectedElements[0].name === "paragraph") {
166
+
167
+ const selection = editor.model.document.selection;
168
+ const range = selection.getFirstRange();
169
+
170
+ let haveInputDataSummary = 0;
171
+
172
+ for (const item of range.getItems()) {
173
+ var itemText = writer.createText(item.data, item.textNode.getAttributes());
174
+ writer.append(itemText, summaryElement);
175
+ haveInputDataSummary = 1;
176
+ }
177
+
178
+ if(haveInputDataSummary === 0)
179
+ {
180
+ const titleSummary = writer.createText(t('Collapsible title'), { bold: true });
181
+ writer.append(titleSummary, summaryElement);
182
+ }
183
+ }
184
+ else
185
+ {
186
+ const titleSummary = writer.createText(t('Collapsible title'), { bold: true });
187
+ writer.append(titleSummary, summaryElement);
188
+ }
189
+
190
+ // Append summary to the details element
191
+ writer.append(summaryElement, detailsElement);
192
+
193
+
194
+ // Add default endline for collapsible content
195
+ const paragraphElement = writer.createElement('paragraph');
196
+
197
+ const defaultContent = writer.createText(t('Collapsible content'));
198
+ writer.append(defaultContent, paragraphElement);
199
+ writer.append(paragraphElement, detailsElement);
200
+ const endLineElement = writer.createElement('paragraph');
201
+
202
+ const endLine = writer.createText('-----------------------------------------------------');
203
+ writer.append(endLine, endLineElement);
204
+ writer.append(endLineElement, detailsElement);
205
+
206
+ editor.model.insertContent(detailsElement, editor.model.document.selection);
207
+ });
208
+ });
209
+
210
+ return view;
211
+ });
212
+ }
213
+
214
+ createTempParagraphContent(detailsElement, addContentBefore) {
215
+ this.editor.model.change(writer => {
216
+ let position = writer.createPositionAfter(detailsElement);
217
+
218
+ if(addContentBefore)
219
+ {
220
+ position = writer.createPositionBefore(detailsElement);
221
+ }
222
+ const newParagraph = writer.createElement('paragraph');
223
+
224
+ writer.insert(newParagraph, position);
225
+
226
+ writer.setSelection(newParagraph, 'in');
227
+ });
228
+ }
229
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '@ckeditor/ckeditor5-core';
2
+
3
+ export default class CollapsibleCommand extends Command {
4
+
5
+ constructor(editor) {
6
+ super(editor);
7
+
8
+ }
9
+ // disable button in toolbar
10
+ execute() {
11
+
12
+ }
13
+ }
@@ -1,163 +1,165 @@
1
- /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
-
6
- /**
7
- * @module heading/headingediting
8
- */
9
-
10
- import { Plugin } from 'ckeditor5/src/core';
11
- import { Paragraph } from 'ckeditor5/src/paragraph';
12
- import { priorities } from 'ckeditor5/src/utils';
13
-
14
- import HeadingCommand from './headingcommand';
15
-
16
- const defaultModelElement = 'paragraph';
17
-
18
- /**
19
- * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.
20
- * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
21
- * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
22
- *
23
- * @extends module:core/plugin~Plugin
24
- */
25
- export default class HeadingEditing extends Plugin {
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName() {
30
- return 'HeadingEditing';
31
- }
32
-
33
- /**
34
- * @inheritDoc
35
- */
36
- constructor( editor ) {
37
- super( editor );
38
-
39
- editor.config.define( 'heading', {
40
- options: [
41
- { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
42
- { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
43
- { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
44
- { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' }
45
- ]
46
- } );
47
- }
48
-
49
- /**
50
- * @inheritDoc
51
- */
52
- static get requires() {
53
- return [ Paragraph ];
54
- }
55
-
56
- /**
57
- * @inheritDoc
58
- */
59
- init() {
60
- const editor = this.editor;
61
- const options = editor.config.get( 'heading.options' );
62
-
63
- const modelElements = [];
64
-
65
- for ( const option of options ) {
66
- // Skip paragraph - it is defined in required Paragraph feature.
67
- if ( option.model !== defaultModelElement ) {
68
- // Schema.
69
- editor.model.schema.register( option.model, {
70
- allowIn: '$root',
71
- inheritAllFrom: '$block'
72
- } );
73
-
74
- editor.conversion.elementToElement( option );
75
-
76
- modelElements.push( option.model );
77
- }
78
- }
79
-
80
- this._addClassToAllHeading( editor );
81
-
82
- // Register the heading command for this option.
83
- editor.commands.add( 'heading', new HeadingCommand( editor, modelElements ) );
84
- }
85
-
86
- /**
87
- * @inheritDoc
88
- */
89
- afterInit() {
90
- // If the enter command is added to the editor, alter its behavior.
91
- // Enter at the end of a heading element should create a paragraph.
92
- const editor = this.editor;
93
- const enterCommand = editor.commands.get( 'enter' );
94
- const options = editor.config.get( 'heading.options' );
95
-
96
- if ( enterCommand ) {
97
- this.listenTo( enterCommand, 'afterExecute', ( evt, data ) => {
98
- const positionParent = editor.model.document.selection.getFirstPosition().parent;
99
- const isHeading = options.some( option => positionParent.is( 'element', option.model ) );
100
-
101
- if ( isHeading && !positionParent.is( 'element', defaultModelElement ) && positionParent.childCount === 0 ) {
102
- data.writer.rename( positionParent, defaultModelElement );
103
- }
104
- } );
105
- }
106
- }
107
-
108
- /**
109
- * Adds default conversion for `h1` -> `heading1` with a low priority.
110
- *
111
- * @private
112
- * @param {module:core/editor/editor~Editor} editor Editor instance on which to add the `h1` conversion.
113
- */
114
- _addDefaultH1Conversion( editor ) {
115
- editor.conversion.for( 'upcast' ).elementToElement( {
116
- model: 'heading1',
117
- view: 'h1',
118
- // With a `low` priority, `paragraph` plugin autoparagraphing mechanism is executed. Make sure
119
- // this listener is called before it. If not, `h1` will be transformed into a paragraph.
120
- converterPriority: priorities.get( 'low' ) + 1
121
- } )
122
- }
123
-
124
- /**
125
- * This plugin brings customization to the downcast pipeline of the editor.
126
- *
127
- * @private
128
- * @param {module:core/editor/editor~Editor} editor
129
- */
130
- _addClassToAllHeading( editor ) {
131
- // Both the data and the editing pipelines are affected by this conversion.
132
- editor.conversion.for( 'downcast' ).add( dispatcher => {
133
- // Headings are represented in the model as a "heading1" element.
134
- // Use the "low" listener priority to apply the changes after the headings feature.
135
- dispatcher.on( 'insert:heading1', ( evt, data, conversionApi ) => {
136
- const viewWriter = conversionApi.writer;
137
-
138
- viewWriter.addClass( 'radEdH1', conversionApi.mapper.toViewElement( data.item ) );
139
- }, { priority: 'low' } );
140
- } );
141
-
142
- editor.conversion.for( 'downcast' ).add( dispatcher => {
143
- // Headings are represented in the model as a "heading2" element.
144
- // Use the "low" listener priority to apply the changes after the headings feature.
145
- dispatcher.on( 'insert:heading2', ( evt, data, conversionApi ) => {
146
- const viewWriter = conversionApi.writer;
147
-
148
- viewWriter.addClass( 'radEdH2', conversionApi.mapper.toViewElement( data.item ) );
149
- }, { priority: 'low' } );
150
- } );
151
-
152
- editor.conversion.for( 'downcast' ).add( dispatcher => {
153
- // Headings are represented in the model as a "heading3" element.
154
- // Use the "low" listener priority to apply the changes after the headings feature.
155
- dispatcher.on( 'insert:heading3', ( evt, data, conversionApi ) => {
156
- const viewWriter = conversionApi.writer;
157
-
158
- viewWriter.addClass( 'radEdH3', conversionApi.mapper.toViewElement( data.item ) );
159
- }, { priority: 'low' } );
160
- } );
161
- }
162
-
163
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module heading/headingediting
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import { Paragraph } from 'ckeditor5/src/paragraph';
12
+ import { priorities } from 'ckeditor5/src/utils';
13
+
14
+ import HeadingCommand from './headingcommand';
15
+ import Ingress from './ingress/ingress';
16
+
17
+ const defaultModelElement = 'paragraph';
18
+
19
+ /**
20
+ * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.
21
+ * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
22
+ * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
23
+ *
24
+ * @extends module:core/plugin~Plugin
25
+ */
26
+ export default class HeadingEditing extends Plugin {
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName() {
31
+ return 'HeadingEditing';
32
+ }
33
+
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ constructor( editor ) {
38
+ super( editor );
39
+
40
+ editor.config.define( 'heading', {
41
+ options: [
42
+ { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
43
+ { model: 'ingress', title: 'Ingress', class: 'ck-heading_ingress' },
44
+ { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
45
+ { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
46
+ { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' }
47
+ ]
48
+ } );
49
+ }
50
+
51
+ /**
52
+ * @inheritDoc
53
+ */
54
+ static get requires() {
55
+ return [ Paragraph , Ingress];
56
+ }
57
+
58
+ /**
59
+ * @inheritDoc
60
+ */
61
+ init() {
62
+ const editor = this.editor;
63
+ const options = editor.config.get( 'heading.options' );
64
+
65
+ const modelElements = [];
66
+
67
+ for ( const option of options ) {
68
+ // Skip paragraph - it is defined in required Paragraph feature.
69
+ if ( option.model !== defaultModelElement && option.model !== 'ingress' ) {
70
+ // Schema.
71
+ editor.model.schema.register( option.model, {
72
+ allowIn: '$root',
73
+ inheritAllFrom: '$block'
74
+ } );
75
+
76
+ editor.conversion.elementToElement( option );
77
+
78
+ modelElements.push( option.model );
79
+ }
80
+ }
81
+
82
+ this._addClassToAllHeading( editor );
83
+
84
+ // Register the heading command for this option.
85
+ editor.commands.add( 'heading', new HeadingCommand( editor, modelElements ) );
86
+ }
87
+
88
+ /**
89
+ * @inheritDoc
90
+ */
91
+ afterInit() {
92
+ // If the enter command is added to the editor, alter its behavior.
93
+ // Enter at the end of a heading element should create a paragraph.
94
+ const editor = this.editor;
95
+ const enterCommand = editor.commands.get( 'enter' );
96
+ const options = editor.config.get( 'heading.options' );
97
+
98
+ if ( enterCommand ) {
99
+ this.listenTo( enterCommand, 'afterExecute', ( evt, data ) => {
100
+ const positionParent = editor.model.document.selection.getFirstPosition().parent;
101
+ const isHeading = options.some( option => positionParent.is( 'element', option.model ) );
102
+
103
+ if ( isHeading && (!positionParent.is( 'element', defaultModelElement ) && !positionParent.is( 'element', 'ingress' )) && positionParent.childCount === 0 ) {
104
+ data.writer.rename( positionParent, defaultModelElement );
105
+ }
106
+ } );
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Adds default conversion for `h1` -> `heading1` with a low priority.
112
+ *
113
+ * @private
114
+ * @param {module:core/editor/editor~Editor} editor Editor instance on which to add the `h1` conversion.
115
+ */
116
+ _addDefaultH1Conversion( editor ) {
117
+ editor.conversion.for( 'upcast' ).elementToElement( {
118
+ model: 'heading1',
119
+ view: 'h1',
120
+ // With a `low` priority, `paragraph` plugin autoparagraphing mechanism is executed. Make sure
121
+ // this listener is called before it. If not, `h1` will be transformed into a paragraph.
122
+ converterPriority: priorities.get( 'low' ) + 1
123
+ } )
124
+ }
125
+
126
+ /**
127
+ * This plugin brings customization to the downcast pipeline of the editor.
128
+ *
129
+ * @private
130
+ * @param {module:core/editor/editor~Editor} editor
131
+ */
132
+ _addClassToAllHeading( editor ) {
133
+ // Both the data and the editing pipelines are affected by this conversion.
134
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
135
+ // Headings are represented in the model as a "heading1" element.
136
+ // Use the "low" listener priority to apply the changes after the headings feature.
137
+ dispatcher.on( 'insert:heading1', ( evt, data, conversionApi ) => {
138
+ const viewWriter = conversionApi.writer;
139
+
140
+ viewWriter.addClass( 'radEdH1', conversionApi.mapper.toViewElement( data.item ) );
141
+ }, { priority: 'low' } );
142
+ } );
143
+
144
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
145
+ // Headings are represented in the model as a "heading2" element.
146
+ // Use the "low" listener priority to apply the changes after the headings feature.
147
+ dispatcher.on( 'insert:heading2', ( evt, data, conversionApi ) => {
148
+ const viewWriter = conversionApi.writer;
149
+
150
+ viewWriter.addClass( 'radEdH2', conversionApi.mapper.toViewElement( data.item ) );
151
+ }, { priority: 'low' } );
152
+ } );
153
+
154
+ editor.conversion.for( 'downcast' ).add( dispatcher => {
155
+ // Headings are represented in the model as a "heading3" element.
156
+ // Use the "low" listener priority to apply the changes after the headings feature.
157
+ dispatcher.on( 'insert:heading3', ( evt, data, conversionApi ) => {
158
+ const viewWriter = conversionApi.writer;
159
+
160
+ viewWriter.addClass( 'radEdH3', conversionApi.mapper.toViewElement( data.item ) );
161
+ }, { priority: 'low' } );
162
+ } );
163
+ }
164
+
165
+ }