@ckeditor/ckeditor5-html-support 31.0.0 → 33.0.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 +2 -2
- package/build/html-support.js +3 -3
- package/build/html-support.js.map +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/zh.js +1 -0
- package/lang/translations/cs.po +21 -0
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +21 -0
- package/lang/translations/en.po +1 -1
- package/lang/translations/es.po +21 -0
- package/lang/translations/gl.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/id.po +21 -0
- package/lang/translations/it.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +21 -0
- package/lang/translations/ru.po +1 -1
- package/lang/translations/sk.po +21 -0
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/zh.po +21 -0
- package/package.json +34 -34
- package/src/conversionutils.js +1 -1
- package/src/converters.js +13 -11
- package/src/datafilter.js +10 -6
- package/src/dataschema.js +1 -1
- package/src/generalhtmlsupport.js +6 -2
- package/src/htmlcomment.js +1 -1
- package/src/index.js +1 -1
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/dualcontent.js +1 -1
- package/src/integrations/heading.js +1 -1
- package/src/integrations/image.js +1 -1
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/script.js +74 -0
- package/src/integrations/style.js +74 -0
- package/src/integrations/table.js +1 -1
- package/src/schemadefinitions.js +18 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2022, 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
|
+
/**
|
|
7
|
+
* @module html-support/integrations/style
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
11
|
+
import {
|
|
12
|
+
createObjectView,
|
|
13
|
+
modelToViewBlockAttributeConverter,
|
|
14
|
+
viewToModelBlockAttributeConverter,
|
|
15
|
+
viewToModelObjectConverter
|
|
16
|
+
} from '../converters.js';
|
|
17
|
+
|
|
18
|
+
import DataFilter from '../datafilter';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Provides the General HTML Support for `style` elements.
|
|
22
|
+
*
|
|
23
|
+
* @extends module:core/plugin~Plugin
|
|
24
|
+
*/
|
|
25
|
+
export default class StyleElementSupport extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get requires() {
|
|
30
|
+
return [ DataFilter ];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
init() {
|
|
37
|
+
const dataFilter = this.editor.plugins.get( DataFilter );
|
|
38
|
+
|
|
39
|
+
dataFilter.on( 'register:style', ( evt, definition ) => {
|
|
40
|
+
const editor = this.editor;
|
|
41
|
+
const schema = editor.model.schema;
|
|
42
|
+
const conversion = editor.conversion;
|
|
43
|
+
|
|
44
|
+
schema.register( 'htmlStyle', definition.modelSchema );
|
|
45
|
+
|
|
46
|
+
schema.extend( 'htmlStyle', {
|
|
47
|
+
allowAttributes: [ 'htmlAttributes', 'htmlContent' ],
|
|
48
|
+
isContent: true
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
editor.data.registerRawContentMatcher( {
|
|
52
|
+
name: 'style'
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
conversion.for( 'upcast' ).elementToElement( {
|
|
56
|
+
view: 'style',
|
|
57
|
+
model: viewToModelObjectConverter( definition )
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
conversion.for( 'upcast' ).add( viewToModelBlockAttributeConverter( definition, dataFilter ) );
|
|
61
|
+
|
|
62
|
+
conversion.for( 'downcast' ).elementToElement( {
|
|
63
|
+
model: 'htmlStyle',
|
|
64
|
+
view: ( modelElement, { writer } ) => {
|
|
65
|
+
return createObjectView( 'style', modelElement, writer );
|
|
66
|
+
}
|
|
67
|
+
} );
|
|
68
|
+
|
|
69
|
+
conversion.for( 'downcast' ).add( modelToViewBlockAttributeConverter( definition ) );
|
|
70
|
+
|
|
71
|
+
evt.stop();
|
|
72
|
+
} );
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
package/src/schemadefinitions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
//
|
|
47
47
|
// Skipped hidden elements:
|
|
48
48
|
// noscript
|
|
49
|
-
// script
|
|
50
49
|
|
|
51
50
|
export default {
|
|
52
51
|
block: [
|
|
@@ -823,7 +822,7 @@ export default {
|
|
|
823
822
|
inheritAllFrom: '$htmlObjectInline'
|
|
824
823
|
}
|
|
825
824
|
},
|
|
826
|
-
// TODO it could be probably represented as non-object element, although it has
|
|
825
|
+
// TODO it could be probably represented as non-object element, although it has graphical representation,
|
|
827
826
|
// so probably makes more sense to keep it as an object.
|
|
828
827
|
{
|
|
829
828
|
model: 'htmlProgress',
|
|
@@ -832,6 +831,22 @@ export default {
|
|
|
832
831
|
modelSchema: {
|
|
833
832
|
inheritAllFrom: '$htmlObjectInline'
|
|
834
833
|
}
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
model: 'htmlScript',
|
|
837
|
+
view: 'script',
|
|
838
|
+
modelSchema: {
|
|
839
|
+
allowWhere: [ '$text', '$block' ],
|
|
840
|
+
isInline: true
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
model: 'htmlStyle',
|
|
845
|
+
view: 'style',
|
|
846
|
+
modelSchema: {
|
|
847
|
+
allowWhere: [ '$text', '$block' ],
|
|
848
|
+
isInline: true
|
|
849
|
+
}
|
|
835
850
|
}
|
|
836
851
|
]
|
|
837
852
|
};
|