@ckeditor/ckeditor5-html-support 37.1.0 → 38.0.0-rc.1
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/build/html-support.js +1 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/bg.po +1 -1
- package/lang/translations/bn.po +1 -1
- package/lang/translations/ca.po +1 -1
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +1 -1
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/jv.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/ms.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/ur.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +34 -33
- package/src/converters.js +1 -1
- package/src/datafilter.d.ts +5 -1
- package/src/datafilter.js +38 -33
- package/src/dataschema.d.ts +12 -2
- package/src/dataschema.js +47 -23
- package/src/generalhtmlsupport.d.ts +5 -6
- package/src/generalhtmlsupport.js +13 -54
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/customelement.js +1 -1
- package/src/integrations/documentlist.js +1 -1
- package/src/integrations/heading.d.ts +10 -1
- package/src/integrations/heading.js +24 -4
- package/src/integrations/image.js +1 -1
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/table.js +38 -3
- package/src/schemadefinitions.js +82 -24
- package/src/{conversionutils.d.ts → utils.d.ts} +21 -2
- package/src/{conversionutils.js → utils.js} +43 -0
package/lang/translations/lv.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Latvian (https://
|
|
15
|
+
"Language-Team: Latvian (https://app.transifex.com/ckeditor/teams/11143/lv/)\n"
|
|
16
16
|
"Language: lv\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
|
|
18
18
|
|
package/lang/translations/ms.po
CHANGED
package/lang/translations/nl.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Dutch (https://
|
|
15
|
+
"Language-Team: Dutch (https://app.transifex.com/ckeditor/teams/11143/nl/)\n"
|
|
16
16
|
"Language: nl\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
18
18
|
|
package/lang/translations/no.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Norwegian (https://
|
|
15
|
+
"Language-Team: Norwegian (https://app.transifex.com/ckeditor/teams/11143/no/)\n"
|
|
16
16
|
"Language: no\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
18
18
|
|
package/lang/translations/pl.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Polish (https://
|
|
15
|
+
"Language-Team: Polish (https://app.transifex.com/ckeditor/teams/11143/pl/)\n"
|
|
16
16
|
"Language: pl\n"
|
|
17
17
|
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Portuguese (Brazil) (https://
|
|
15
|
+
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/ckeditor/teams/11143/pt_BR/)\n"
|
|
16
16
|
"Language: pt_BR\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
|
|
18
18
|
|
package/lang/translations/pt.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Portuguese (https://
|
|
15
|
+
"Language-Team: Portuguese (https://app.transifex.com/ckeditor/teams/11143/pt/)\n"
|
|
16
16
|
"Language: pt\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"
|
|
18
18
|
|
package/lang/translations/ro.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Romanian (https://
|
|
15
|
+
"Language-Team: Romanian (https://app.transifex.com/ckeditor/teams/11143/ro/)\n"
|
|
16
16
|
"Language: ro\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
|
|
18
18
|
|
package/lang/translations/ru.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Russian (https://
|
|
15
|
+
"Language-Team: Russian (https://app.transifex.com/ckeditor/teams/11143/ru/)\n"
|
|
16
16
|
"Language: ru\n"
|
|
17
17
|
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
|
|
18
18
|
|
package/lang/translations/sk.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Slovak (https://
|
|
15
|
+
"Language-Team: Slovak (https://app.transifex.com/ckeditor/teams/11143/sk/)\n"
|
|
16
16
|
"Language: sk\n"
|
|
17
17
|
"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\n"
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Serbian (Latin) (https://
|
|
15
|
+
"Language-Team: Serbian (Latin) (https://app.transifex.com/ckeditor/teams/11143/sr@latin/)\n"
|
|
16
16
|
"Language: sr@latin\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
|
18
18
|
|
package/lang/translations/sr.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Serbian (https://
|
|
15
|
+
"Language-Team: Serbian (https://app.transifex.com/ckeditor/teams/11143/sr/)\n"
|
|
16
16
|
"Language: sr\n"
|
|
17
17
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
|
18
18
|
|
package/lang/translations/sv.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Swedish (https://
|
|
15
|
+
"Language-Team: Swedish (https://app.transifex.com/ckeditor/teams/11143/sv/)\n"
|
|
16
16
|
"Language: sv\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
18
18
|
|
package/lang/translations/th.po
CHANGED
package/lang/translations/tr.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Turkish (https://
|
|
15
|
+
"Language-Team: Turkish (https://app.transifex.com/ckeditor/teams/11143/tr/)\n"
|
|
16
16
|
"Language: tr\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
|
18
18
|
|
package/lang/translations/uk.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Ukrainian (https://
|
|
15
|
+
"Language-Team: Ukrainian (https://app.transifex.com/ckeditor/teams/11143/uk/)\n"
|
|
16
16
|
"Language: uk\n"
|
|
17
17
|
"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
|
|
18
18
|
|
package/lang/translations/ur.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Urdu (https://
|
|
15
|
+
"Language-Team: Urdu (https://app.transifex.com/ckeditor/teams/11143/ur/)\n"
|
|
16
16
|
"Language: ur\n"
|
|
17
17
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
18
18
|
|
package/lang/translations/vi.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Vietnamese (https://
|
|
15
|
+
"Language-Team: Vietnamese (https://app.transifex.com/ckeditor/teams/11143/vi/)\n"
|
|
16
16
|
"Language: vi\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Chinese (China) (https://
|
|
15
|
+
"Language-Team: Chinese (China) (https://app.transifex.com/ckeditor/teams/11143/zh_CN/)\n"
|
|
16
16
|
"Language: zh_CN\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
|
package/lang/translations/zh.po
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
msgid ""
|
|
14
14
|
msgstr ""
|
|
15
|
-
"Language-Team: Chinese (Taiwan) (https://
|
|
15
|
+
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
|
|
16
16
|
"Language: zh_TW\n"
|
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-html-support",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.0-rc.1",
|
|
4
4
|
"description": "HTML Support feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -16,42 +16,43 @@
|
|
|
16
16
|
],
|
|
17
17
|
"main": "src/index.js",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"ckeditor5": "^
|
|
19
|
+
"ckeditor5": "^38.0.0-rc.1",
|
|
20
20
|
"lodash-es": "^4.17.15"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@ckeditor/ckeditor5-alignment": "^
|
|
24
|
-
"@ckeditor/ckeditor5-basic-styles": "^
|
|
25
|
-
"@ckeditor/ckeditor5-block-quote": "^
|
|
26
|
-
"@ckeditor/ckeditor5-clipboard": "^
|
|
27
|
-
"@ckeditor/ckeditor5-cloud-services": "^
|
|
28
|
-
"@ckeditor/ckeditor5-code-block": "^
|
|
29
|
-
"@ckeditor/ckeditor5-core": "^
|
|
23
|
+
"@ckeditor/ckeditor5-alignment": "^38.0.0-rc.1",
|
|
24
|
+
"@ckeditor/ckeditor5-basic-styles": "^38.0.0-rc.1",
|
|
25
|
+
"@ckeditor/ckeditor5-block-quote": "^38.0.0-rc.1",
|
|
26
|
+
"@ckeditor/ckeditor5-clipboard": "^38.0.0-rc.1",
|
|
27
|
+
"@ckeditor/ckeditor5-cloud-services": "^38.0.0-rc.1",
|
|
28
|
+
"@ckeditor/ckeditor5-code-block": "^38.0.0-rc.1",
|
|
29
|
+
"@ckeditor/ckeditor5-core": "^38.0.0-rc.1",
|
|
30
30
|
"@ckeditor/ckeditor5-dev-utils": "^37.0.0",
|
|
31
|
-
"@ckeditor/ckeditor5-easy-image": "^
|
|
32
|
-
"@ckeditor/ckeditor5-editor-classic": "^
|
|
33
|
-
"@ckeditor/ckeditor5-engine": "^
|
|
34
|
-
"@ckeditor/ckeditor5-enter": "^
|
|
35
|
-
"@ckeditor/ckeditor5-essentials": "^
|
|
36
|
-
"@ckeditor/ckeditor5-font": "^
|
|
37
|
-
"@ckeditor/ckeditor5-heading": "^
|
|
38
|
-
"@ckeditor/ckeditor5-highlight": "^
|
|
39
|
-
"@ckeditor/ckeditor5-horizontal-line": "^
|
|
40
|
-
"@ckeditor/ckeditor5-html-embed": "^
|
|
41
|
-
"@ckeditor/ckeditor5-image": "^
|
|
42
|
-
"@ckeditor/ckeditor5-indent": "^
|
|
43
|
-
"@ckeditor/ckeditor5-link": "^
|
|
44
|
-
"@ckeditor/ckeditor5-list": "^
|
|
45
|
-
"@ckeditor/ckeditor5-media-embed": "^
|
|
46
|
-
"@ckeditor/ckeditor5-page-break": "^
|
|
47
|
-
"@ckeditor/ckeditor5-paragraph": "^
|
|
48
|
-
"@ckeditor/ckeditor5-paste-from-office": "^
|
|
49
|
-
"@ckeditor/ckeditor5-remove-format": "^
|
|
50
|
-
"@ckeditor/ckeditor5-source-editing": "^
|
|
51
|
-
"@ckeditor/ckeditor5-table": "^
|
|
52
|
-
"@ckeditor/ckeditor5-theme-lark": "^
|
|
53
|
-
"@ckeditor/ckeditor5-
|
|
54
|
-
"@ckeditor/ckeditor5-
|
|
31
|
+
"@ckeditor/ckeditor5-easy-image": "^38.0.0-rc.1",
|
|
32
|
+
"@ckeditor/ckeditor5-editor-classic": "^38.0.0-rc.1",
|
|
33
|
+
"@ckeditor/ckeditor5-engine": "^38.0.0-rc.1",
|
|
34
|
+
"@ckeditor/ckeditor5-enter": "^38.0.0-rc.1",
|
|
35
|
+
"@ckeditor/ckeditor5-essentials": "^38.0.0-rc.1",
|
|
36
|
+
"@ckeditor/ckeditor5-font": "^38.0.0-rc.1",
|
|
37
|
+
"@ckeditor/ckeditor5-heading": "^38.0.0-rc.1",
|
|
38
|
+
"@ckeditor/ckeditor5-highlight": "^38.0.0-rc.1",
|
|
39
|
+
"@ckeditor/ckeditor5-horizontal-line": "^38.0.0-rc.1",
|
|
40
|
+
"@ckeditor/ckeditor5-html-embed": "^38.0.0-rc.1",
|
|
41
|
+
"@ckeditor/ckeditor5-image": "^38.0.0-rc.1",
|
|
42
|
+
"@ckeditor/ckeditor5-indent": "^38.0.0-rc.1",
|
|
43
|
+
"@ckeditor/ckeditor5-link": "^38.0.0-rc.1",
|
|
44
|
+
"@ckeditor/ckeditor5-list": "^38.0.0-rc.1",
|
|
45
|
+
"@ckeditor/ckeditor5-media-embed": "^38.0.0-rc.1",
|
|
46
|
+
"@ckeditor/ckeditor5-page-break": "^38.0.0-rc.1",
|
|
47
|
+
"@ckeditor/ckeditor5-paragraph": "^38.0.0-rc.1",
|
|
48
|
+
"@ckeditor/ckeditor5-paste-from-office": "^38.0.0-rc.1",
|
|
49
|
+
"@ckeditor/ckeditor5-remove-format": "^38.0.0-rc.1",
|
|
50
|
+
"@ckeditor/ckeditor5-source-editing": "^38.0.0-rc.1",
|
|
51
|
+
"@ckeditor/ckeditor5-table": "^38.0.0-rc.1",
|
|
52
|
+
"@ckeditor/ckeditor5-theme-lark": "^38.0.0-rc.1",
|
|
53
|
+
"@ckeditor/ckeditor5-typing": "^38.0.0-rc.1",
|
|
54
|
+
"@ckeditor/ckeditor5-utils": "^38.0.0-rc.1",
|
|
55
|
+
"@ckeditor/ckeditor5-widget": "^38.0.0-rc.1",
|
|
55
56
|
"typescript": "^4.8.4",
|
|
56
57
|
"webpack": "^5.58.1",
|
|
57
58
|
"webpack-cli": "^4.9.0"
|
package/src/converters.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
import { toWidget } from 'ckeditor5/src/widget';
|
|
6
|
-
import { setViewAttributes, mergeViewElementAttributes, updateViewAttributes } from './
|
|
6
|
+
import { setViewAttributes, mergeViewElementAttributes, updateViewAttributes } from './utils';
|
|
7
7
|
/**
|
|
8
8
|
* View-to-model conversion helper for object elements.
|
|
9
9
|
*
|
package/src/datafilter.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
|
9
9
|
import { type MatcherPattern, type UpcastConversionApi, type ViewElement } from 'ckeditor5/src/engine';
|
|
10
10
|
import { Widget } from 'ckeditor5/src/widget';
|
|
11
11
|
import { default as DataSchema, type DataSchemaDefinition } from './dataschema';
|
|
12
|
-
import type { GHSViewAttributes } from './
|
|
12
|
+
import type { GHSViewAttributes } from './utils';
|
|
13
13
|
import '../theme/datafilter.css';
|
|
14
14
|
/**
|
|
15
15
|
* Allows to validate elements and element attributes registered by {@link module:html-support/dataschema~DataSchema}.
|
|
@@ -159,6 +159,10 @@ export default class DataFilter extends Plugin {
|
|
|
159
159
|
* - classes Set with matched class names.
|
|
160
160
|
*/
|
|
161
161
|
processViewAttributes(viewElement: ViewElement, conversionApi: UpcastConversionApi): GHSViewAttributes | null;
|
|
162
|
+
/**
|
|
163
|
+
* Adds allowed element definition and fires registration event.
|
|
164
|
+
*/
|
|
165
|
+
private _addAllowedElement;
|
|
162
166
|
/**
|
|
163
167
|
* Registers elements allowed by {@link module:html-support/datafilter~DataFilter#allowElement} method
|
|
164
168
|
* once {@link module:engine/controller/datacontroller~DataController editor's data controller} is initialized.
|
package/src/datafilter.js
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module html-support/datafilter
|
|
7
7
|
*/
|
|
8
|
-
/* globals document */
|
|
9
8
|
import { Plugin } from 'ckeditor5/src/core';
|
|
10
9
|
import { Matcher } from 'ckeditor5/src/engine';
|
|
11
|
-
import { priorities,
|
|
10
|
+
import { CKEditorError, priorities, isValidAttributeName } from 'ckeditor5/src/utils';
|
|
12
11
|
import { Widget } from 'ckeditor5/src/widget';
|
|
13
12
|
import { viewToModelObjectConverter, toObjectWidgetConverter, createObjectView, viewToAttributeInlineConverter, attributeToViewInlineConverter, viewToModelBlockAttributeConverter, modelToViewBlockAttributeConverter } from './converters';
|
|
14
13
|
import { default as DataSchema } from './dataschema';
|
|
@@ -123,25 +122,7 @@ export default class DataFilter extends Plugin {
|
|
|
123
122
|
*/
|
|
124
123
|
allowElement(viewName) {
|
|
125
124
|
for (const definition of this._dataSchema.getDefinitionsForView(viewName, true)) {
|
|
126
|
-
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
this._allowedElements.add(definition);
|
|
130
|
-
// We need to wait for all features to be initialized before we can register
|
|
131
|
-
// element, so we can access existing features model schemas.
|
|
132
|
-
// If the data has not been initialized yet, _registerElementsAfterInit() method will take care of
|
|
133
|
-
// registering elements.
|
|
134
|
-
if (this._dataInitialized) {
|
|
135
|
-
// Defer registration to the next data pipeline data set so any disallow rules could be applied
|
|
136
|
-
// even if added after allow rule (disallowElement).
|
|
137
|
-
this.editor.data.once('set', () => {
|
|
138
|
-
this._fireRegisterEvent(definition);
|
|
139
|
-
}, {
|
|
140
|
-
// With the highest priority listener we are able to register elements right before
|
|
141
|
-
// running data conversion.
|
|
142
|
-
priority: priorities.get('highest') + 1
|
|
143
|
-
});
|
|
144
|
-
}
|
|
125
|
+
this._addAllowedElement(definition);
|
|
145
126
|
// Reset cached map to recalculate it on the next usage.
|
|
146
127
|
this._coupledAttributes = null;
|
|
147
128
|
}
|
|
@@ -206,6 +187,38 @@ export default class DataFilter extends Plugin {
|
|
|
206
187
|
consumeAttributes(viewElement, conversionApi, this._disallowedAttributes);
|
|
207
188
|
return consumeAttributes(viewElement, conversionApi, this._allowedAttributes);
|
|
208
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Adds allowed element definition and fires registration event.
|
|
192
|
+
*/
|
|
193
|
+
_addAllowedElement(definition) {
|
|
194
|
+
if (this._allowedElements.has(definition)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this._allowedElements.add(definition);
|
|
198
|
+
// For attribute based integrations (table figure, document lists, etc.) register related element definitions.
|
|
199
|
+
if ('appliesToBlock' in definition && typeof definition.appliesToBlock == 'string') {
|
|
200
|
+
for (const relatedDefinition of this._dataSchema.getDefinitionsForModel(definition.appliesToBlock)) {
|
|
201
|
+
if (relatedDefinition.isBlock) {
|
|
202
|
+
this._addAllowedElement(relatedDefinition);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// We need to wait for all features to be initialized before we can register
|
|
207
|
+
// element, so we can access existing features model schemas.
|
|
208
|
+
// If the data has not been initialized yet, _registerElementsAfterInit() method will take care of
|
|
209
|
+
// registering elements.
|
|
210
|
+
if (this._dataInitialized) {
|
|
211
|
+
// Defer registration to the next data pipeline data set so any disallow rules could be applied
|
|
212
|
+
// even if added after allow rule (disallowElement).
|
|
213
|
+
this.editor.data.once('set', () => {
|
|
214
|
+
this._fireRegisterEvent(definition);
|
|
215
|
+
}, {
|
|
216
|
+
// With the highest priority listener we are able to register elements right before
|
|
217
|
+
// running data conversion.
|
|
218
|
+
priority: priorities.get('highest') + 1
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
209
222
|
/**
|
|
210
223
|
* Registers elements allowed by {@link module:html-support/datafilter~DataFilter#allowElement} method
|
|
211
224
|
* once {@link module:engine/controller/datacontroller~DataController editor's data controller} is initialized.
|
|
@@ -433,6 +446,10 @@ export default class DataFilter extends Plugin {
|
|
|
433
446
|
const schema = editor.model.schema;
|
|
434
447
|
const conversion = editor.conversion;
|
|
435
448
|
const attributeKey = definition.model;
|
|
449
|
+
// This element is stored in the model as an attribute on a block element, for example DocumentLists.
|
|
450
|
+
if (definition.appliesToBlock) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
436
453
|
schema.extend('$text', {
|
|
437
454
|
allowAttributes: attributeKey
|
|
438
455
|
});
|
|
@@ -589,15 +606,3 @@ function splitRules(rules) {
|
|
|
589
606
|
}
|
|
590
607
|
return splittedRules;
|
|
591
608
|
}
|
|
592
|
-
/**
|
|
593
|
-
* Returns true if name is valid for a DOM attribute name.
|
|
594
|
-
*/
|
|
595
|
-
function isValidAttributeName(name) {
|
|
596
|
-
try {
|
|
597
|
-
document.createAttribute(name);
|
|
598
|
-
}
|
|
599
|
-
catch (error) {
|
|
600
|
-
return false;
|
|
601
|
-
}
|
|
602
|
-
return true;
|
|
603
|
-
}
|
package/src/dataschema.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module html-support/dataschema
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
9
9
|
import type { AttributeProperties, SchemaItemDefinition } from 'ckeditor5/src/engine';
|
|
10
10
|
/**
|
|
11
11
|
* Holds representation of the extended HTML document type definitions to be used by the
|
|
@@ -44,7 +44,6 @@ export default class DataSchema extends Plugin {
|
|
|
44
44
|
* A map of registered data schema definitions.
|
|
45
45
|
*/
|
|
46
46
|
private readonly _definitions;
|
|
47
|
-
constructor(editor: Editor);
|
|
48
47
|
/**
|
|
49
48
|
* @inheritDoc
|
|
50
49
|
*/
|
|
@@ -85,6 +84,10 @@ export default class DataSchema extends Plugin {
|
|
|
85
84
|
* @param includeReferences Indicates if this method should also include definitions of referenced models.
|
|
86
85
|
*/
|
|
87
86
|
getDefinitionsForView(viewName: string | RegExp, includeReferences?: boolean): Set<DataSchemaDefinition>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns definitions matching the given model name.
|
|
89
|
+
*/
|
|
90
|
+
getDefinitionsForModel(modelName: string): Array<DataSchemaDefinition>;
|
|
88
91
|
/**
|
|
89
92
|
* Returns definitions matching the given view name.
|
|
90
93
|
*/
|
|
@@ -166,4 +169,11 @@ export interface DataSchemaInlineElementDefinition extends DataSchemaDefinition
|
|
|
166
169
|
* {@link module:html-support/datafilter~DataFilter#_registerModelPostFixer GHS post-fixer} for more details.
|
|
167
170
|
*/
|
|
168
171
|
coupledAttribute?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Indicates that element should not be converted as a model text attribute.
|
|
174
|
+
* It is used to map view elements that do not have a separate model element but their data is stored in a model attribute.
|
|
175
|
+
* For example `<tbody>` element does not have a dedicated model element and GHS stores attributes of `<tbody>`
|
|
176
|
+
* in the `htmlTbodyAttributes` model attribute of the `table` model element.
|
|
177
|
+
*/
|
|
178
|
+
appliesToBlock?: boolean | string;
|
|
169
179
|
}
|
package/src/dataschema.js
CHANGED
|
@@ -42,9 +42,12 @@ import { mergeWith } from 'lodash-es';
|
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
44
|
export default class DataSchema extends Plugin {
|
|
45
|
-
constructor(
|
|
46
|
-
super(
|
|
47
|
-
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
/**
|
|
48
|
+
* A map of registered data schema definitions.
|
|
49
|
+
*/
|
|
50
|
+
this._definitions = [];
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
53
|
* @inheritDoc
|
|
@@ -67,13 +70,13 @@ export default class DataSchema extends Plugin {
|
|
|
67
70
|
* Add new data schema definition describing block element.
|
|
68
71
|
*/
|
|
69
72
|
registerBlockElement(definition) {
|
|
70
|
-
this._definitions.
|
|
73
|
+
this._definitions.push({ ...definition, isBlock: true });
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Add new data schema definition describing inline element.
|
|
74
77
|
*/
|
|
75
78
|
registerInlineElement(definition) {
|
|
76
|
-
this._definitions.
|
|
79
|
+
this._definitions.push({ ...definition, isInline: true });
|
|
77
80
|
}
|
|
78
81
|
/**
|
|
79
82
|
* Updates schema definition describing block element with new properties.
|
|
@@ -114,12 +117,17 @@ export default class DataSchema extends Plugin {
|
|
|
114
117
|
}
|
|
115
118
|
return definitions;
|
|
116
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Returns definitions matching the given model name.
|
|
122
|
+
*/
|
|
123
|
+
getDefinitionsForModel(modelName) {
|
|
124
|
+
return this._definitions.filter(definition => definition.model == modelName);
|
|
125
|
+
}
|
|
117
126
|
/**
|
|
118
127
|
* Returns definitions matching the given view name.
|
|
119
128
|
*/
|
|
120
129
|
_getMatchingViewDefinitions(viewName) {
|
|
121
|
-
return
|
|
122
|
-
.filter(def => def.view && testViewName(viewName, def.view));
|
|
130
|
+
return this._definitions.filter(def => def.view && testViewName(viewName, def.view));
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* Resolves all definition references registered for the given data schema definition.
|
|
@@ -127,17 +135,27 @@ export default class DataSchema extends Plugin {
|
|
|
127
135
|
* @param modelName Data schema model name.
|
|
128
136
|
*/
|
|
129
137
|
*_getReferences(modelName) {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
const inheritProperties = [
|
|
139
|
+
'inheritAllFrom',
|
|
140
|
+
'inheritTypesFrom',
|
|
141
|
+
'allowWhere',
|
|
142
|
+
'allowContentOf',
|
|
143
|
+
'allowAttributesOf'
|
|
144
|
+
];
|
|
145
|
+
const definitions = this._definitions.filter(definition => definition.model == modelName);
|
|
146
|
+
for (const { modelSchema } of definitions) {
|
|
147
|
+
if (!modelSchema) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
for (const property of inheritProperties) {
|
|
151
|
+
for (const referenceName of toArray(modelSchema[property] || [])) {
|
|
152
|
+
const definitions = this._definitions.filter(definition => definition.model == referenceName);
|
|
153
|
+
for (const definition of definitions) {
|
|
154
|
+
if (referenceName !== modelName) {
|
|
155
|
+
yield* this._getReferences(definition.model);
|
|
156
|
+
yield definition;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
141
159
|
}
|
|
142
160
|
}
|
|
143
161
|
}
|
|
@@ -151,11 +169,17 @@ export default class DataSchema extends Plugin {
|
|
|
151
169
|
* @param definition Definition update.
|
|
152
170
|
*/
|
|
153
171
|
_extendDefinition(definition) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
172
|
+
const currentDefinitions = Array.from(this._definitions.entries())
|
|
173
|
+
.filter(([, currentDefinition]) => currentDefinition.model == definition.model);
|
|
174
|
+
if (currentDefinitions.length == 0) {
|
|
175
|
+
this._definitions.push(definition);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
for (const [idx, currentDefinition] of currentDefinitions) {
|
|
179
|
+
this._definitions[idx] = mergeWith({}, currentDefinition, definition, (target, source) => {
|
|
180
|
+
return Array.isArray(target) ? target.concat(source) : undefined;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
159
183
|
}
|
|
160
184
|
}
|
|
161
185
|
/**
|
|
@@ -18,8 +18,7 @@ import TableElementSupport from './integrations/table';
|
|
|
18
18
|
import StyleElementSupport from './integrations/style';
|
|
19
19
|
import DocumentListElementSupport from './integrations/documentlist';
|
|
20
20
|
import CustomElementSupport from './integrations/customelement';
|
|
21
|
-
import type {
|
|
22
|
-
type LimitedSelectable = Exclude<Selectable, Iterable<Range> | null>;
|
|
21
|
+
import type { Selectable } from 'ckeditor5/src/engine';
|
|
23
22
|
/**
|
|
24
23
|
* The General HTML Support feature.
|
|
25
24
|
*
|
|
@@ -42,9 +41,10 @@ export default class GeneralHtmlSupport extends Plugin {
|
|
|
42
41
|
/**
|
|
43
42
|
* Returns a GHS model attribute name related to a given view element name.
|
|
44
43
|
*
|
|
44
|
+
* @internal
|
|
45
45
|
* @param viewElementName A view element name.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
getGhsAttributeNameForElement(viewElementName: string): string;
|
|
48
48
|
/**
|
|
49
49
|
* Updates GHS model attribute for a specified view element name, so it includes the given class name.
|
|
50
50
|
*
|
|
@@ -53,7 +53,7 @@ export default class GeneralHtmlSupport extends Plugin {
|
|
|
53
53
|
* @param className The css class to add.
|
|
54
54
|
* @param selectable The selection or element to update.
|
|
55
55
|
*/
|
|
56
|
-
addModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable:
|
|
56
|
+
addModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: Selectable): void;
|
|
57
57
|
/**
|
|
58
58
|
* Updates GHS model attribute for a specified view element name, so it does not include the given class name.
|
|
59
59
|
*
|
|
@@ -62,7 +62,7 @@ export default class GeneralHtmlSupport extends Plugin {
|
|
|
62
62
|
* @param className The css class to remove.
|
|
63
63
|
* @param selectable The selection or element to update.
|
|
64
64
|
*/
|
|
65
|
-
removeModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable:
|
|
65
|
+
removeModelHtmlClass(viewElementName: string, className: ArrayOrItem<string>, selectable: Selectable): void;
|
|
66
66
|
/**
|
|
67
67
|
* Updates GHS model attribute for a specified view element name, so it includes the given attribute.
|
|
68
68
|
*
|
|
@@ -96,4 +96,3 @@ export default class GeneralHtmlSupport extends Plugin {
|
|
|
96
96
|
*/
|
|
97
97
|
private removeModelHtmlStyles;
|
|
98
98
|
}
|
|
99
|
-
export {};
|