ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

How to stop the label tag behavior on switch new line after the successful run of method?

Open mohdsakib opened this issue 1 year ago • 2 comments

Hi Team, We have added some static html using the method below.

let source = "<label contenteditable=\"true\"><span style =\"color: green;\" contenteditable=\"false\" id =\"populationStart\" populationid =\"" + populationId + "\" data-haspopulation = \"custom-population\">"+ startPop +" class=\"prevent-select\"</span> <span style=\"color: green;\" contenteditable=\"false\" id =\"populationEnd\" populationid =\"" + populationId + "\" data-haspopulation = \"custom-population\"  class=\"prevent-select\">"+ endPop + "</span>&nbsp;</label>";
this.editorEvent.model.change(writer => {
                    const htmlDP = this.editorEvent.data.processor;
                    const viewFragment = htmlDP.toView(source);
                    const modelFragment = this.editorEvent.data.toModel(viewFragment);
                    this.editorEvent.model.insertContent(modelFragment, this.editorEvent.model.document.selection);
                  });

It works fine but when we switch to the new line the label tag again comes in the p tag like this. image

<p><label contenteditable="true">new line</label></p>

image

Please assist how to control this behavior.

Thanks

mohdsakib avatar Apr 08 '24 07:04 mohdsakib

@CKEditorBot

mohdsakib avatar Apr 08 '24 07:04 mohdsakib

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 06 '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 07 '25 23:07 CKEditorBot