@ckeditor/ckeditor5-html-support 32.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.
@@ -0,0 +1 @@
1
+ !function(i){const n=i.el=i.el||{};n.dictionary=Object.assign(n.dictionary||{},{"HTML object":"Αντικείμενο HTML"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Greek (https://www.transifex.com/ckeditor/teams/11143/el/)\n"
16
+ "Language: el\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+
19
+ msgctxt "A label describing an HTML object widget."
20
+ msgid "HTML object"
21
+ msgstr "Αντικείμενο HTML"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-html-support",
3
- "version": "32.0.0",
3
+ "version": "33.0.0",
4
4
  "description": "HTML Support feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -16,39 +16,39 @@
16
16
  ],
17
17
  "main": "src/index.js",
18
18
  "dependencies": {
19
- "ckeditor5": "^32.0.0",
19
+ "ckeditor5": "^33.0.0",
20
20
  "lodash-es": "^4.17.15"
21
21
  },
22
22
  "devDependencies": {
23
- "@ckeditor/ckeditor5-alignment": "^32.0.0",
24
- "@ckeditor/ckeditor5-basic-styles": "^32.0.0",
25
- "@ckeditor/ckeditor5-block-quote": "^32.0.0",
26
- "@ckeditor/ckeditor5-cloud-services": "^32.0.0",
27
- "@ckeditor/ckeditor5-code-block": "^32.0.0",
28
- "@ckeditor/ckeditor5-core": "^32.0.0",
29
- "@ckeditor/ckeditor5-dev-utils": "^27.1.0",
30
- "@ckeditor/ckeditor5-easy-image": "^32.0.0",
31
- "@ckeditor/ckeditor5-editor-classic": "^32.0.0",
32
- "@ckeditor/ckeditor5-engine": "^32.0.0",
33
- "@ckeditor/ckeditor5-enter": "^32.0.0",
34
- "@ckeditor/ckeditor5-essentials": "^32.0.0",
35
- "@ckeditor/ckeditor5-font": "^32.0.0",
36
- "@ckeditor/ckeditor5-heading": "^32.0.0",
37
- "@ckeditor/ckeditor5-highlight": "^32.0.0",
38
- "@ckeditor/ckeditor5-horizontal-line": "^32.0.0",
39
- "@ckeditor/ckeditor5-html-embed": "^32.0.0",
40
- "@ckeditor/ckeditor5-image": "^32.0.0",
41
- "@ckeditor/ckeditor5-indent": "^32.0.0",
42
- "@ckeditor/ckeditor5-link": "^32.0.0",
43
- "@ckeditor/ckeditor5-list": "^32.0.0",
44
- "@ckeditor/ckeditor5-media-embed": "^32.0.0",
45
- "@ckeditor/ckeditor5-page-break": "^32.0.0",
46
- "@ckeditor/ckeditor5-paragraph": "^32.0.0",
47
- "@ckeditor/ckeditor5-paste-from-office": "^32.0.0",
48
- "@ckeditor/ckeditor5-source-editing": "^32.0.0",
49
- "@ckeditor/ckeditor5-table": "^32.0.0",
50
- "@ckeditor/ckeditor5-theme-lark": "^32.0.0",
51
- "@ckeditor/ckeditor5-utils": "^32.0.0",
23
+ "@ckeditor/ckeditor5-alignment": "^33.0.0",
24
+ "@ckeditor/ckeditor5-basic-styles": "^33.0.0",
25
+ "@ckeditor/ckeditor5-block-quote": "^33.0.0",
26
+ "@ckeditor/ckeditor5-cloud-services": "^33.0.0",
27
+ "@ckeditor/ckeditor5-code-block": "^33.0.0",
28
+ "@ckeditor/ckeditor5-core": "^33.0.0",
29
+ "@ckeditor/ckeditor5-dev-utils": "^28.0.1",
30
+ "@ckeditor/ckeditor5-easy-image": "^33.0.0",
31
+ "@ckeditor/ckeditor5-editor-classic": "^33.0.0",
32
+ "@ckeditor/ckeditor5-engine": "^33.0.0",
33
+ "@ckeditor/ckeditor5-enter": "^33.0.0",
34
+ "@ckeditor/ckeditor5-essentials": "^33.0.0",
35
+ "@ckeditor/ckeditor5-font": "^33.0.0",
36
+ "@ckeditor/ckeditor5-heading": "^33.0.0",
37
+ "@ckeditor/ckeditor5-highlight": "^33.0.0",
38
+ "@ckeditor/ckeditor5-horizontal-line": "^33.0.0",
39
+ "@ckeditor/ckeditor5-html-embed": "^33.0.0",
40
+ "@ckeditor/ckeditor5-image": "^33.0.0",
41
+ "@ckeditor/ckeditor5-indent": "^33.0.0",
42
+ "@ckeditor/ckeditor5-link": "^33.0.0",
43
+ "@ckeditor/ckeditor5-list": "^33.0.0",
44
+ "@ckeditor/ckeditor5-media-embed": "^33.0.0",
45
+ "@ckeditor/ckeditor5-page-break": "^33.0.0",
46
+ "@ckeditor/ckeditor5-paragraph": "^33.0.0",
47
+ "@ckeditor/ckeditor5-paste-from-office": "^33.0.0",
48
+ "@ckeditor/ckeditor5-source-editing": "^33.0.0",
49
+ "@ckeditor/ckeditor5-table": "^33.0.0",
50
+ "@ckeditor/ckeditor5-theme-lark": "^33.0.0",
51
+ "@ckeditor/ckeditor5-utils": "^33.0.0",
52
52
  "webpack": "^5.58.1",
53
53
  "webpack-cli": "^4.9.0"
54
54
  },
package/src/converters.js CHANGED
@@ -40,15 +40,6 @@ export function toObjectWidgetConverter( editor, { view: viewName, isInline } )
40
40
  return ( modelElement, { writer, consumable } ) => {
41
41
  const widgetLabel = t( 'HTML object' );
42
42
 
43
- // Widget cannot be a raw element because the widget system would not be able
44
- // to add its UI to it. Thus, we need separate view container.
45
- const viewContainer = writer.createContainerElement( isInline ? 'span' : 'div', {
46
- class: 'html-object-embed',
47
- 'data-html-object-embed-label': widgetLabel
48
- }, {
49
- isAllowedInsideAttributeElement: isInline
50
- } );
51
-
52
43
  const viewElement = createObjectView( viewName, modelElement, writer );
53
44
  writer.addClass( 'html-object-embed__content', viewElement );
54
45
 
@@ -57,7 +48,18 @@ export function toObjectWidgetConverter( editor, { view: viewName, isInline } )
57
48
  setViewAttributes( writer, viewAttributes, viewElement );
58
49
  }
59
50
 
60
- writer.insert( writer.createPositionAt( viewContainer, 0 ), viewElement );
51
+ // Widget cannot be a raw element because the widget system would not be able
52
+ // to add its UI to it. Thus, we need separate view container.
53
+ const viewContainer = writer.createContainerElement( isInline ? 'span' : 'div',
54
+ {
55
+ class: 'html-object-embed',
56
+ 'data-html-object-embed-label': widgetLabel
57
+ },
58
+ viewElement,
59
+ {
60
+ isAllowedInsideAttributeElement: isInline
61
+ }
62
+ );
61
63
 
62
64
  return toWidget( viewContainer, writer, { widgetLabel } );
63
65
  };
package/src/datafilter.js CHANGED
@@ -240,10 +240,14 @@ export default class DataFilter extends Plugin {
240
240
  this._fireRegisterEvent( definition );
241
241
  }
242
242
  }, {
243
- // With high priority listener we are able to register elements right before
244
- // running data conversion. Make also sure that priority is higher than the one
245
- // used by `RealTimeCollaborationClient`, as RTC is stopping event propagation.
246
- priority: priorities.get( 'high' ) + 1
243
+ // With highest priority listener we are able to register elements right before
244
+ // running data conversion. Also:
245
+ // * Make sure that priority is higher than the one used by `RealTimeCollaborationClient`,
246
+ // as RTC is stopping event propagation.
247
+ // * Make sure no other features hook into this event before GHS because otherwise the
248
+ // downcast conversion (for these features) could run before GHS registered its converters
249
+ // (https://github.com/ckeditor/ckeditor5/issues/11356).
250
+ priority: priorities.get( 'highest' ) + 1
247
251
  } );
248
252
  }
249
253
 
@@ -331,7 +335,7 @@ export default class DataFilter extends Plugin {
331
335
  } );
332
336
  conversion.for( 'upcast' ).add( viewToModelBlockAttributeConverter( definition, this ) );
333
337
 
334
- conversion.for( 'editingDowncast' ).elementToElement( {
338
+ conversion.for( 'editingDowncast' ).elementToStructure( {
335
339
  model: modelName,
336
340
  view: toObjectWidgetConverter( editor, definition )
337
341
  } );
@@ -17,6 +17,7 @@ import ImageElementSupport from './integrations/image';
17
17
  import MediaEmbedElementSupport from './integrations/mediaembed';
18
18
  import ScriptElementSupport from './integrations/script';
19
19
  import TableElementSupport from './integrations/table';
20
+ import StyleElementSupport from './integrations/style';
20
21
 
21
22
  /**
22
23
  * The General HTML Support feature.
@@ -46,7 +47,8 @@ export default class GeneralHtmlSupport extends Plugin {
46
47
  ImageElementSupport,
47
48
  MediaEmbedElementSupport,
48
49
  ScriptElementSupport,
49
- TableElementSupport
50
+ TableElementSupport,
51
+ StyleElementSupport
50
52
  ];
51
53
  }
52
54
 
@@ -44,7 +44,8 @@ export default class ScriptElementSupport extends Plugin {
44
44
  schema.register( 'htmlScript', definition.modelSchema );
45
45
 
46
46
  schema.extend( 'htmlScript', {
47
- allowAttributes: [ 'htmlAttributes', 'htmlContent' ]
47
+ allowAttributes: [ 'htmlAttributes', 'htmlContent' ],
48
+ isContent: true
48
49
  } );
49
50
 
50
51
  editor.data.registerRawContentMatcher( {
@@ -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
+ }
@@ -822,7 +822,7 @@ export default {
822
822
  inheritAllFrom: '$htmlObjectInline'
823
823
  }
824
824
  },
825
- // TODO it could be probably represented as non-object element, although it has grafical representation,
825
+ // TODO it could be probably represented as non-object element, although it has graphical representation,
826
826
  // so probably makes more sense to keep it as an object.
827
827
  {
828
828
  model: 'htmlProgress',
@@ -839,6 +839,14 @@ export default {
839
839
  allowWhere: [ '$text', '$block' ],
840
840
  isInline: true
841
841
  }
842
+ },
843
+ {
844
+ model: 'htmlStyle',
845
+ view: 'style',
846
+ modelSchema: {
847
+ allowWhere: [ '$text', '$block' ],
848
+ isInline: true
849
+ }
842
850
  }
843
851
  ]
844
852
  };