@ckeditor/ckeditor5-html-support 40.0.0 → 40.1.0
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.
- package/LICENSE.md +4 -4
- package/build/html-support.js +1 -1
- package/package.json +2 -2
- package/src/augmentation.d.ts +33 -33
- package/src/augmentation.js +5 -5
- package/src/converters.d.ts +60 -60
- package/src/converters.js +180 -180
- package/src/datafilter.d.ts +304 -304
- package/src/datafilter.js +720 -720
- package/src/dataschema.d.ts +183 -183
- package/src/dataschema.js +196 -196
- package/src/fullpage.d.ts +21 -21
- package/src/fullpage.js +80 -80
- package/src/generalhtmlsupport.d.ts +98 -98
- package/src/generalhtmlsupport.js +240 -240
- package/src/generalhtmlsupportconfig.d.ts +77 -77
- package/src/generalhtmlsupportconfig.js +5 -5
- package/src/htmlcomment.d.ts +71 -71
- package/src/htmlcomment.js +218 -218
- package/src/htmlpagedataprocessor.d.ts +22 -22
- package/src/htmlpagedataprocessor.js +67 -67
- package/src/index.d.ts +25 -25
- package/src/index.js +14 -14
- package/src/integrations/codeblock.d.ts +23 -23
- package/src/integrations/codeblock.js +101 -101
- package/src/integrations/customelement.d.ts +27 -27
- package/src/integrations/customelement.js +146 -146
- package/src/integrations/documentlist.d.ts +27 -27
- package/src/integrations/documentlist.js +178 -178
- package/src/integrations/dualcontent.d.ts +45 -45
- package/src/integrations/dualcontent.js +119 -119
- package/src/integrations/heading.d.ts +31 -31
- package/src/integrations/heading.js +60 -60
- package/src/integrations/image.d.ts +26 -26
- package/src/integrations/image.js +189 -189
- package/src/integrations/integrationutils.d.ts +15 -15
- package/src/integrations/integrationutils.js +21 -21
- package/src/integrations/mediaembed.d.ts +26 -26
- package/src/integrations/mediaembed.js +119 -119
- package/src/integrations/script.d.ts +26 -26
- package/src/integrations/script.js +59 -59
- package/src/integrations/style.d.ts +26 -26
- package/src/integrations/style.js +59 -59
- package/src/integrations/table.d.ts +23 -23
- package/src/integrations/table.js +163 -163
- package/src/schemadefinitions.d.ts +13 -13
- package/src/schemadefinitions.js +953 -956
- package/src/utils.d.ts +72 -72
- package/src/utils.js +139 -139
- package/build/html-support.js.map +0 -1
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module html-support/integrations/mediaembed
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import DataFilter from '../datafilter';
|
|
10
|
-
import DataSchema from '../dataschema';
|
|
11
|
-
import { updateViewAttributes, getHtmlAttributeName } from '../utils';
|
|
12
|
-
import { getDescendantElement } from './integrationutils';
|
|
13
|
-
/**
|
|
14
|
-
* Provides the General HTML Support integration with {@link module:media-embed/mediaembed~MediaEmbed Media Embed} feature.
|
|
15
|
-
*/
|
|
16
|
-
export default class MediaEmbedElementSupport extends Plugin {
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
static get requires() {
|
|
21
|
-
return [DataFilter];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
static get pluginName() {
|
|
27
|
-
return 'MediaEmbedElementSupport';
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
init() {
|
|
33
|
-
const editor = this.editor;
|
|
34
|
-
// Stop here if MediaEmbed plugin is not provided or the integrator wants to output markup with previews as
|
|
35
|
-
// we do not support filtering previews.
|
|
36
|
-
if (!editor.plugins.has('MediaEmbed') || editor.config.get('mediaEmbed.previewsInData')) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const schema = editor.model.schema;
|
|
40
|
-
const conversion = editor.conversion;
|
|
41
|
-
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
42
|
-
const dataSchema = this.editor.plugins.get(DataSchema);
|
|
43
|
-
const mediaElementName = editor.config.get('mediaEmbed.elementName');
|
|
44
|
-
// Overwrite GHS schema definition for a given elementName.
|
|
45
|
-
dataSchema.registerBlockElement({
|
|
46
|
-
model: 'media',
|
|
47
|
-
view: mediaElementName
|
|
48
|
-
});
|
|
49
|
-
dataFilter.on('register:figure', () => {
|
|
50
|
-
conversion.for('upcast').add(viewToModelFigureAttributesConverter(dataFilter));
|
|
51
|
-
});
|
|
52
|
-
dataFilter.on(`register:${mediaElementName}`, (evt, definition) => {
|
|
53
|
-
if (definition.model !== 'media') {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
schema.extend('media', {
|
|
57
|
-
allowAttributes: [
|
|
58
|
-
getHtmlAttributeName(mediaElementName),
|
|
59
|
-
'htmlFigureAttributes'
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
conversion.for('upcast').add(viewToModelMediaAttributesConverter(dataFilter, mediaElementName));
|
|
63
|
-
conversion.for('dataDowncast').add(modelToViewMediaAttributeConverter(mediaElementName));
|
|
64
|
-
evt.stop();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function viewToModelMediaAttributesConverter(dataFilter, mediaElementName) {
|
|
69
|
-
const upcastMedia = (evt, data, conversionApi) => {
|
|
70
|
-
const viewMediaElement = data.viewItem;
|
|
71
|
-
preserveElementAttributes(viewMediaElement, getHtmlAttributeName(mediaElementName));
|
|
72
|
-
function preserveElementAttributes(viewElement, attributeName) {
|
|
73
|
-
const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);
|
|
74
|
-
if (viewAttributes) {
|
|
75
|
-
conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
return (dispatcher) => {
|
|
80
|
-
dispatcher.on(`element:${mediaElementName}`, upcastMedia, { priority: 'low' });
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* View-to-model conversion helper preserving allowed attributes on {@link module:media-embed/mediaembed~MediaEmbed MediaEmbed}
|
|
85
|
-
* feature model element from figure view element.
|
|
86
|
-
*
|
|
87
|
-
* @returns Returns a conversion callback.
|
|
88
|
-
*/
|
|
89
|
-
function viewToModelFigureAttributesConverter(dataFilter) {
|
|
90
|
-
return (dispatcher) => {
|
|
91
|
-
dispatcher.on('element:figure', (evt, data, conversionApi) => {
|
|
92
|
-
const viewFigureElement = data.viewItem;
|
|
93
|
-
if (!data.modelRange || !viewFigureElement.hasClass('media')) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);
|
|
97
|
-
if (viewAttributes) {
|
|
98
|
-
conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);
|
|
99
|
-
}
|
|
100
|
-
}, { priority: 'low' });
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function modelToViewMediaAttributeConverter(mediaElementName) {
|
|
104
|
-
return (dispatcher) => {
|
|
105
|
-
addAttributeConversionDispatcherHandler(mediaElementName, getHtmlAttributeName(mediaElementName));
|
|
106
|
-
addAttributeConversionDispatcherHandler('figure', 'htmlFigureAttributes');
|
|
107
|
-
function addAttributeConversionDispatcherHandler(elementName, attributeName) {
|
|
108
|
-
dispatcher.on(`attribute:${attributeName}:media`, (evt, data, conversionApi) => {
|
|
109
|
-
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const { attributeOldValue, attributeNewValue } = data;
|
|
113
|
-
const containerElement = conversionApi.mapper.toViewElement(data.item);
|
|
114
|
-
const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);
|
|
115
|
-
updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module html-support/integrations/mediaembed
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import DataFilter from '../datafilter';
|
|
10
|
+
import DataSchema from '../dataschema';
|
|
11
|
+
import { updateViewAttributes, getHtmlAttributeName } from '../utils';
|
|
12
|
+
import { getDescendantElement } from './integrationutils';
|
|
13
|
+
/**
|
|
14
|
+
* Provides the General HTML Support integration with {@link module:media-embed/mediaembed~MediaEmbed Media Embed} feature.
|
|
15
|
+
*/
|
|
16
|
+
export default class MediaEmbedElementSupport extends Plugin {
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
static get requires() {
|
|
21
|
+
return [DataFilter];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get pluginName() {
|
|
27
|
+
return 'MediaEmbedElementSupport';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
init() {
|
|
33
|
+
const editor = this.editor;
|
|
34
|
+
// Stop here if MediaEmbed plugin is not provided or the integrator wants to output markup with previews as
|
|
35
|
+
// we do not support filtering previews.
|
|
36
|
+
if (!editor.plugins.has('MediaEmbed') || editor.config.get('mediaEmbed.previewsInData')) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const schema = editor.model.schema;
|
|
40
|
+
const conversion = editor.conversion;
|
|
41
|
+
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
42
|
+
const dataSchema = this.editor.plugins.get(DataSchema);
|
|
43
|
+
const mediaElementName = editor.config.get('mediaEmbed.elementName');
|
|
44
|
+
// Overwrite GHS schema definition for a given elementName.
|
|
45
|
+
dataSchema.registerBlockElement({
|
|
46
|
+
model: 'media',
|
|
47
|
+
view: mediaElementName
|
|
48
|
+
});
|
|
49
|
+
dataFilter.on('register:figure', () => {
|
|
50
|
+
conversion.for('upcast').add(viewToModelFigureAttributesConverter(dataFilter));
|
|
51
|
+
});
|
|
52
|
+
dataFilter.on(`register:${mediaElementName}`, (evt, definition) => {
|
|
53
|
+
if (definition.model !== 'media') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
schema.extend('media', {
|
|
57
|
+
allowAttributes: [
|
|
58
|
+
getHtmlAttributeName(mediaElementName),
|
|
59
|
+
'htmlFigureAttributes'
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
conversion.for('upcast').add(viewToModelMediaAttributesConverter(dataFilter, mediaElementName));
|
|
63
|
+
conversion.for('dataDowncast').add(modelToViewMediaAttributeConverter(mediaElementName));
|
|
64
|
+
evt.stop();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function viewToModelMediaAttributesConverter(dataFilter, mediaElementName) {
|
|
69
|
+
const upcastMedia = (evt, data, conversionApi) => {
|
|
70
|
+
const viewMediaElement = data.viewItem;
|
|
71
|
+
preserveElementAttributes(viewMediaElement, getHtmlAttributeName(mediaElementName));
|
|
72
|
+
function preserveElementAttributes(viewElement, attributeName) {
|
|
73
|
+
const viewAttributes = dataFilter.processViewAttributes(viewElement, conversionApi);
|
|
74
|
+
if (viewAttributes) {
|
|
75
|
+
conversionApi.writer.setAttribute(attributeName, viewAttributes, data.modelRange);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (dispatcher) => {
|
|
80
|
+
dispatcher.on(`element:${mediaElementName}`, upcastMedia, { priority: 'low' });
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* View-to-model conversion helper preserving allowed attributes on {@link module:media-embed/mediaembed~MediaEmbed MediaEmbed}
|
|
85
|
+
* feature model element from figure view element.
|
|
86
|
+
*
|
|
87
|
+
* @returns Returns a conversion callback.
|
|
88
|
+
*/
|
|
89
|
+
function viewToModelFigureAttributesConverter(dataFilter) {
|
|
90
|
+
return (dispatcher) => {
|
|
91
|
+
dispatcher.on('element:figure', (evt, data, conversionApi) => {
|
|
92
|
+
const viewFigureElement = data.viewItem;
|
|
93
|
+
if (!data.modelRange || !viewFigureElement.hasClass('media')) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const viewAttributes = dataFilter.processViewAttributes(viewFigureElement, conversionApi);
|
|
97
|
+
if (viewAttributes) {
|
|
98
|
+
conversionApi.writer.setAttribute('htmlFigureAttributes', viewAttributes, data.modelRange);
|
|
99
|
+
}
|
|
100
|
+
}, { priority: 'low' });
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function modelToViewMediaAttributeConverter(mediaElementName) {
|
|
104
|
+
return (dispatcher) => {
|
|
105
|
+
addAttributeConversionDispatcherHandler(mediaElementName, getHtmlAttributeName(mediaElementName));
|
|
106
|
+
addAttributeConversionDispatcherHandler('figure', 'htmlFigureAttributes');
|
|
107
|
+
function addAttributeConversionDispatcherHandler(elementName, attributeName) {
|
|
108
|
+
dispatcher.on(`attribute:${attributeName}:media`, (evt, data, conversionApi) => {
|
|
109
|
+
if (!conversionApi.consumable.consume(data.item, evt.name)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const { attributeOldValue, attributeNewValue } = data;
|
|
113
|
+
const containerElement = conversionApi.mapper.toViewElement(data.item);
|
|
114
|
+
const viewElement = getDescendantElement(conversionApi.writer, containerElement, elementName);
|
|
115
|
+
updateViewAttributes(conversionApi.writer, attributeOldValue, attributeNewValue, viewElement);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module html-support/integrations/script
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import DataFilter from '../datafilter';
|
|
10
|
-
/**
|
|
11
|
-
* Provides the General HTML Support for `script` elements.
|
|
12
|
-
*/
|
|
13
|
-
export default class ScriptElementSupport extends Plugin {
|
|
14
|
-
/**
|
|
15
|
-
* @inheritDoc
|
|
16
|
-
*/
|
|
17
|
-
static get requires(): readonly [typeof DataFilter];
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get pluginName(): "ScriptElementSupport";
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
init(): void;
|
|
26
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module html-support/integrations/script
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import DataFilter from '../datafilter';
|
|
10
|
+
/**
|
|
11
|
+
* Provides the General HTML Support for `script` elements.
|
|
12
|
+
*/
|
|
13
|
+
export default class ScriptElementSupport extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get requires(): readonly [typeof DataFilter];
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "ScriptElementSupport";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init(): void;
|
|
26
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module html-support/integrations/script
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters';
|
|
10
|
-
import DataFilter from '../datafilter';
|
|
11
|
-
/**
|
|
12
|
-
* Provides the General HTML Support for `script` elements.
|
|
13
|
-
*/
|
|
14
|
-
export default class ScriptElementSupport extends Plugin {
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static get requires() {
|
|
19
|
-
return [DataFilter];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get pluginName() {
|
|
25
|
-
return 'ScriptElementSupport';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
init() {
|
|
31
|
-
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
32
|
-
dataFilter.on('register:script', (evt, definition) => {
|
|
33
|
-
const editor = this.editor;
|
|
34
|
-
const schema = editor.model.schema;
|
|
35
|
-
const conversion = editor.conversion;
|
|
36
|
-
schema.register('htmlScript', definition.modelSchema);
|
|
37
|
-
schema.extend('htmlScript', {
|
|
38
|
-
allowAttributes: ['htmlScriptAttributes', 'htmlContent'],
|
|
39
|
-
isContent: true
|
|
40
|
-
});
|
|
41
|
-
editor.data.registerRawContentMatcher({
|
|
42
|
-
name: 'script'
|
|
43
|
-
});
|
|
44
|
-
conversion.for('upcast').elementToElement({
|
|
45
|
-
view: 'script',
|
|
46
|
-
model: viewToModelObjectConverter(definition)
|
|
47
|
-
});
|
|
48
|
-
conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));
|
|
49
|
-
conversion.for('downcast').elementToElement({
|
|
50
|
-
model: 'htmlScript',
|
|
51
|
-
view: (modelElement, { writer }) => {
|
|
52
|
-
return createObjectView('script', modelElement, writer);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));
|
|
56
|
-
evt.stop();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module html-support/integrations/script
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters';
|
|
10
|
+
import DataFilter from '../datafilter';
|
|
11
|
+
/**
|
|
12
|
+
* Provides the General HTML Support for `script` elements.
|
|
13
|
+
*/
|
|
14
|
+
export default class ScriptElementSupport extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get requires() {
|
|
19
|
+
return [DataFilter];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName() {
|
|
25
|
+
return 'ScriptElementSupport';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
init() {
|
|
31
|
+
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
32
|
+
dataFilter.on('register:script', (evt, definition) => {
|
|
33
|
+
const editor = this.editor;
|
|
34
|
+
const schema = editor.model.schema;
|
|
35
|
+
const conversion = editor.conversion;
|
|
36
|
+
schema.register('htmlScript', definition.modelSchema);
|
|
37
|
+
schema.extend('htmlScript', {
|
|
38
|
+
allowAttributes: ['htmlScriptAttributes', 'htmlContent'],
|
|
39
|
+
isContent: true
|
|
40
|
+
});
|
|
41
|
+
editor.data.registerRawContentMatcher({
|
|
42
|
+
name: 'script'
|
|
43
|
+
});
|
|
44
|
+
conversion.for('upcast').elementToElement({
|
|
45
|
+
view: 'script',
|
|
46
|
+
model: viewToModelObjectConverter(definition)
|
|
47
|
+
});
|
|
48
|
+
conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));
|
|
49
|
+
conversion.for('downcast').elementToElement({
|
|
50
|
+
model: 'htmlScript',
|
|
51
|
+
view: (modelElement, { writer }) => {
|
|
52
|
+
return createObjectView('script', modelElement, writer);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));
|
|
56
|
+
evt.stop();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module html-support/integrations/style
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import DataFilter from '../datafilter';
|
|
10
|
-
/**
|
|
11
|
-
* Provides the General HTML Support for `style` elements.
|
|
12
|
-
*/
|
|
13
|
-
export default class StyleElementSupport extends Plugin {
|
|
14
|
-
/**
|
|
15
|
-
* @inheritDoc
|
|
16
|
-
*/
|
|
17
|
-
static get requires(): readonly [typeof DataFilter];
|
|
18
|
-
/**
|
|
19
|
-
* @inheritDoc
|
|
20
|
-
*/
|
|
21
|
-
static get pluginName(): "StyleElementSupport";
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
init(): void;
|
|
26
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module html-support/integrations/style
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import DataFilter from '../datafilter';
|
|
10
|
+
/**
|
|
11
|
+
* Provides the General HTML Support for `style` elements.
|
|
12
|
+
*/
|
|
13
|
+
export default class StyleElementSupport extends Plugin {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
static get requires(): readonly [typeof DataFilter];
|
|
18
|
+
/**
|
|
19
|
+
* @inheritDoc
|
|
20
|
+
*/
|
|
21
|
+
static get pluginName(): "StyleElementSupport";
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
init(): void;
|
|
26
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module html-support/integrations/style
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
-
import { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters';
|
|
10
|
-
import DataFilter from '../datafilter';
|
|
11
|
-
/**
|
|
12
|
-
* Provides the General HTML Support for `style` elements.
|
|
13
|
-
*/
|
|
14
|
-
export default class StyleElementSupport extends Plugin {
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static get requires() {
|
|
19
|
-
return [DataFilter];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get pluginName() {
|
|
25
|
-
return 'StyleElementSupport';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
init() {
|
|
31
|
-
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
32
|
-
dataFilter.on('register:style', (evt, definition) => {
|
|
33
|
-
const editor = this.editor;
|
|
34
|
-
const schema = editor.model.schema;
|
|
35
|
-
const conversion = editor.conversion;
|
|
36
|
-
schema.register('htmlStyle', definition.modelSchema);
|
|
37
|
-
schema.extend('htmlStyle', {
|
|
38
|
-
allowAttributes: ['htmlStyleAttributes', 'htmlContent'],
|
|
39
|
-
isContent: true
|
|
40
|
-
});
|
|
41
|
-
editor.data.registerRawContentMatcher({
|
|
42
|
-
name: 'style'
|
|
43
|
-
});
|
|
44
|
-
conversion.for('upcast').elementToElement({
|
|
45
|
-
view: 'style',
|
|
46
|
-
model: viewToModelObjectConverter(definition)
|
|
47
|
-
});
|
|
48
|
-
conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));
|
|
49
|
-
conversion.for('downcast').elementToElement({
|
|
50
|
-
model: 'htmlStyle',
|
|
51
|
-
view: (modelElement, { writer }) => {
|
|
52
|
-
return createObjectView('style', modelElement, writer);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));
|
|
56
|
-
evt.stop();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module html-support/integrations/style
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
|
+
import { createObjectView, modelToViewBlockAttributeConverter, viewToModelBlockAttributeConverter, viewToModelObjectConverter } from '../converters';
|
|
10
|
+
import DataFilter from '../datafilter';
|
|
11
|
+
/**
|
|
12
|
+
* Provides the General HTML Support for `style` elements.
|
|
13
|
+
*/
|
|
14
|
+
export default class StyleElementSupport extends Plugin {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get requires() {
|
|
19
|
+
return [DataFilter];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get pluginName() {
|
|
25
|
+
return 'StyleElementSupport';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
init() {
|
|
31
|
+
const dataFilter = this.editor.plugins.get(DataFilter);
|
|
32
|
+
dataFilter.on('register:style', (evt, definition) => {
|
|
33
|
+
const editor = this.editor;
|
|
34
|
+
const schema = editor.model.schema;
|
|
35
|
+
const conversion = editor.conversion;
|
|
36
|
+
schema.register('htmlStyle', definition.modelSchema);
|
|
37
|
+
schema.extend('htmlStyle', {
|
|
38
|
+
allowAttributes: ['htmlStyleAttributes', 'htmlContent'],
|
|
39
|
+
isContent: true
|
|
40
|
+
});
|
|
41
|
+
editor.data.registerRawContentMatcher({
|
|
42
|
+
name: 'style'
|
|
43
|
+
});
|
|
44
|
+
conversion.for('upcast').elementToElement({
|
|
45
|
+
view: 'style',
|
|
46
|
+
model: viewToModelObjectConverter(definition)
|
|
47
|
+
});
|
|
48
|
+
conversion.for('upcast').add(viewToModelBlockAttributeConverter(definition, dataFilter));
|
|
49
|
+
conversion.for('downcast').elementToElement({
|
|
50
|
+
model: 'htmlStyle',
|
|
51
|
+
view: (modelElement, { writer }) => {
|
|
52
|
+
return createObjectView('style', modelElement, writer);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
conversion.for('downcast').add(modelToViewBlockAttributeConverter(definition));
|
|
56
|
+
evt.stop();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import DataFilter from '../datafilter';
|
|
7
|
-
/**
|
|
8
|
-
* Provides the General HTML Support integration with {@link module:table/table~Table Table} feature.
|
|
9
|
-
*/
|
|
10
|
-
export default class TableElementSupport extends Plugin {
|
|
11
|
-
/**
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
*/
|
|
14
|
-
static get requires(): readonly [typeof DataFilter];
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static get pluginName(): "TableElementSupport";
|
|
19
|
-
/**
|
|
20
|
-
* @inheritDoc
|
|
21
|
-
*/
|
|
22
|
-
init(): void;
|
|
23
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
+
import DataFilter from '../datafilter';
|
|
7
|
+
/**
|
|
8
|
+
* Provides the General HTML Support integration with {@link module:table/table~Table Table} feature.
|
|
9
|
+
*/
|
|
10
|
+
export default class TableElementSupport extends Plugin {
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
static get requires(): readonly [typeof DataFilter];
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
static get pluginName(): "TableElementSupport";
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
init(): void;
|
|
23
|
+
}
|