ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Custom tag is not rendering while we edit the page

Open mohdsakib opened this issue 1 year ago • 1 comments

Hi team, I have created a custom tag by register in the schema of editor. Tag is generating fine while we create the page but when we open same page in edit mode than tag is not generating in html.

// Register the blockquote element in the schema
    editor.model.schema.register("ah:expr", {
      allowWhere: "$block",
      allowContentOf: ["$block"],
      allowAttributes: ['id', 'class', 'assettype'],
      renderUnsafeAttributes: ['assettype'],
      isBlock: true,
    });
    
      // Define upcast converter
    editor.conversion.for("upcast").elementToElement({
      model: "ah:expr",
      view: {
        name: "populationAccordion",
        classes: "custom-populationSection exprSelector",
      },
    });

    // Define data downcast converter
    editor.conversion.for("dataDowncast").elementToElement({
      model: "ah:expr",
      view: {
        name: "populationAccordion",
        classes: "custom-populationSection exprSelector",
      },
    });

    // Define editing downcast converter
    editor.conversion.for("editingDowncast").elementToElement({
      model: "ah:expr",
      view: (modelElement, { writer: viewWriter }) => {
        const blockquote = viewWriter.createContainerElement("ah:expr", {
          class: "custom-populationSection exprSelector",
          renderUnsafeAttributes: 'assettype',
          isBlock: true,
          contentEditable: false
        });
        return toWidget(blockquote, viewWriter, { label: "ah:expr" });
      },
    });

image

in edit

image

For rendering the tag in create we add some configuration as well to allow the tag in configuration array. this.config = { htmlSupport: { allow: [ { name: ["ah:expr",'/.*/'], attributes: true, classes: true, styles: true, }, ], }, }

if we remove this configuration then the ah:expr tag is not rendering in the HTML . image

Can any one help to resolve the query why tag is not renders in edit.

@CKEditor5DevopsBot , @CKEditorBot

Thanks!

mohdsakib avatar Jun 13 '24 12:06 mohdsakib

Hi Team, please assist if possible. @CKEditorBot

Thanks

sakib8382 avatar Jun 22 '24 15:06 sakib8382

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

CKEditorBot avatar Jun 22 '25 23:06 CKEditorBot

We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

CKEditorBot avatar Jul 23 '25 23:07 CKEditorBot