-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
拿到带有font-family的html字符串 使用BraftEditor.createEditorState(html)后 字体样式丢失 #775
Comments
同样遇到了 有没有解决方案呢 |
蹲一个解决方案 |
看了下源码,我是这样解决的: const fontFamilies = [
{ name: '思源黑体', family: '思源黑体' },
{ name: '隶书', family: '隶书' },
{ name: '楷体', family: '楷体,sans-serif' },
]
// 需要把你自定义的字体作为options传入进去
BraftEditor.createEditorState(ele.innerHtml, { fontFamilies: fontFamilies }) |
ok,我后面这么试出来了
非常感谢
…------------------ 原始邮件 ------------------
发件人: "itibbers"<[email protected]>;
发送时间: 2020年9月1日(星期二) 中午12:15
收件人: "margox/braft-editor"<[email protected]>;
抄送: "悲痛莫名"<[email protected]>; "Comment"<[email protected]>;
主题: Re: [margox/braft-editor] 拿到带有font-family的html字符串 使用BraftEditor.createEditorState(html)后 字体样式丢失 (#775)
看了下源码,我是这样解决的:
const fontFamilies = [ { name: '思源黑体', family: '思源黑体' }, { name: '隶书', family: '隶书' }, { name: '楷体', family: '楷体,sans-serif' }, ] // 需要把你自定义的字体作为options传入进去 BraftEditor.createEditorState(ele.innerHtml, { fontFamilies: fontFamilies })
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
哇,谢谢大佬,困扰很久,终于解决 |
同一行文字在输入时切换字体顶部显示的字体不会变但是内容的字体是改变了的 |
有没有解决办法呢,我也遇到了同样的问题。不仅是字体,字号也会出现同样的问题 |
没解决,作者好久都不更新了,建议换插件用吧 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
拿到带有font-family的html字符串 使用BraftEditor.createEditorState(html)后 字体样式丢失
例如:
<p><span style="font-family:STKaiti,KaiTi,sans-serif"><span style="font-size:40px">这里应该是楷体</span></span></p>
渲染到编辑器框里 丢失了楷体这个字体
The text was updated successfully, but these errors were encountered: