We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在sethtml方法中 大空格在有样式的文本中会转化为小空格
正确显示大空格
"@wangeditor-next/editor": "^5.6.10", "@wangeditor-next/editor-for-vue": "^5.1.14",
能
代码如下
<p>测试大空格</p> <p>1.111  222</p> <p>2.<span style="font-family: MS-Mincho;">111 222</span></p> <p>3.<span style="font-family: MS-Mincho;">111</span> <span>222</span></p>
第一个正常 第二个会失败,会转化为小空格。 第三个额外分开标签。会识别成功 ,但是需要单独处理
The text was updated successfully, but these errors were encountered:
针对第二种 先简单的做了一个小方法来改善 第二种大空格错误的问题
function splitSpanOnEmsp(inputStr) { const flag = '\u2003' // 使用正则表达式查找包含 style 的 <span> 标签,并检查内容 return inputStr.replace(/<span([^>]*)>(.*?)<\/span>/g, (match, attrs, content) => { // 检查 <span> 是否含有 style 属性,且内容包含   if (attrs.includes('style') && content.includes(flag)) { const parts = content.split(flag); let newSpans = []; // 遍历分割的内容,将每段内容封装成新的 <span> 元素并保留样式 parts.forEach((part, index) => { if (part || index === 0 || index === parts.length - 1) { // 保留空白符位置 newSpans.push(`<span${attrs}>${part}</span>`); } if (index < parts.length - 1) { // 添加   作为分隔符 newSpans.push(flag); } }); return newSpans.join(''); } return match; // 没有  ,保持原样 }); }
Sorry, something went wrong.
cycleccc
When branches are created from issues, their pull requests are automatically linked.
bug 描述
在sethtml方法中 大空格在有样式的文本中会转化为小空格
你预期的样子是?
正确显示大空格
系统和浏览器及版本号
wangEditor-next 版本
"@wangeditor-next/editor": "^5.6.10",
"@wangeditor-next/editor-for-vue": "^5.1.14",
demo 能否复现该 bug ?
能
最小成本的复现步骤
代码如下
第一个正常
第二个会失败,会转化为小空格。
第三个额外分开标签。会识别成功 ,但是需要单独处理
The text was updated successfully, but these errors were encountered: