@ckeditor/ckeditor5-html-support 48.1.0 → 48.2.0-alpha.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.
@@ -173,7 +173,7 @@ export interface GHSFullPageConfig {
173
173
  *
174
174
  * ```ts
175
175
  * ClassicEditor
176
- * .create( editorElement, {
176
+ * .create( {
177
177
  * htmlSupport: {
178
178
  * fullPage: {
179
179
  * allowRenderStylesFromHead: true,
package/dist/index.js CHANGED
@@ -714,17 +714,14 @@ function modifyGhsAttribute(writer, item, ghsAttributeName, subject, callback) {
714
714
  view: 'form',
715
715
  modelSchema: {
716
716
  inheritAllFrom: '$container',
717
- isBlock: true
717
+ isBlock: false
718
718
  }
719
719
  },
720
720
  {
721
721
  model: 'htmlHgroup',
722
722
  view: 'hgroup',
723
723
  modelSchema: {
724
- allowIn: [
725
- '$root',
726
- '$container'
727
- ],
724
+ allowWhere: '$container',
728
725
  allowChildren: [
729
726
  'paragraph',
730
727
  'htmlP',
@@ -4022,9 +4019,16 @@ const STYLE_ATTRIBUTES_TO_PROPAGATE = [
4022
4019
  const editor = this.editor;
4023
4020
  const loadedCommentsContent = new Map();
4024
4021
  editor.data.processor.skipComments = false;
4025
- // Allow storing comment's content as the $root attribute with the name `$comment:<unique id>`.
4022
+ // Declare the `$comment` attribute on `$root`. Custom roots that opt into the `$root`
4023
+ // attribute chain via `allowAttributesOf: '$root'` get comment support automatically.
4024
+ editor.model.schema.extend('$root', {
4025
+ allowAttributes: '$comment'
4026
+ });
4027
+ // Allow storing comment's content as a root attribute with the name `$comment:<unique id>`.
4028
+ // Gate the per-comment attribute on the root already allowing the generic `$comment` attribute
4029
+ // so the rule works for any root name.
4026
4030
  editor.model.schema.addAttributeCheck((context, attributeName)=>{
4027
- if (context.endsWith('$root') && attributeName.startsWith('$comment')) {
4031
+ if (attributeName.startsWith('$comment:') && editor.model.schema.checkAttribute(context, '$comment')) {
4028
4032
  return true;
4029
4033
  }
4030
4034
  });