简体   繁体   中英

Why is the p (paragraph) tag removed when all text is removed from the field?

I have multiple "CKEditor" editors on the same page. And now I observe strange behavior.

For example, I am initializing CKEditor to the p tag. And this works:

在此处输入图片说明

That is, I delete the text, but the first p tag of this kind is always kept:

<p data-placeholder="Type some text...">...</p>

But the documentation always contains this example:

<div id="editor"></div>

I change the p tag to div and I get this:

在此处输入图片说明

Above, when deleting text, this code is removed:

<p data-placeholder="Type some text...">...</p>

But if remove the focus from the field, then the tag p appears again:

在此处输入图片说明

Has anyone encountered similar behavior?

I'm using Vue. And I used v-html to render the original values. That was the problem. I fixed the problem using the setData method from CKEditor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM