简体   繁体   中英

SetContent in tiptap removes styles

I want to put some html into a tiptap editor, as I want edit what I have saved earlier. But if I have some inline styles inside, tiptap deletes it. Does anybody know what I can do with it?

this.editor.setContent('<p style="text-align: center">fffff</p>')

If you have TextAlignExtension @tiptap/extension-text-align , the text-align will keep.

You can verify here https://wode.vercel.app/tiptap

在此处输入图像描述

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