我们正在使用编辑器(https://imperavi.com/redactor/ https://imperavi.com/redactor/)版本 10.1.1 并且由于对项目的大量依赖而未迁移到 Redactor II。
最近,我们在 Chrome 版本 58 中遇到了一个非常奇怪的问题。问题是:
-- 无法为所选文本设置粗体、斜体、下划线、sup、sub 等格式
请告诉我们是否有解决此问题的方法。任何形式的帮助将不胜感激。
根据已接受的解决方案进行更新:
// Provided solution is tested for Redactor version 10.1.1
createMarkers: function()
{
this.selection.get();
var node1 = this.selection.getMarker(1);
this.selection.setMarker(this.range, node1, true);
if (this.range.collapsed === false) {
var node2 = this.selection.getMarker(2);
this.selection.setMarker(this.range, node2, false);
// Fix for Chrome58 Issues
if (this.utils.browser('chrome')) {
this.caret.set(node1, 0, node2, 0);
}
// End Chrome58 Issues
}
this.savedSel = this.$editor.html();
},
我想我可能已经找到了解决方案:当我们调用时,Chrome 58(有时)似乎会重置选择Range.insertNode
.
我建议的解决方案是在编辑器添加选择标记时恢复选择:createMarkers
功能,设置后立即node2
标记,您可以添加此函数调用:this.caret.set(node1, 0, node2, 0);
Here's https://github.com/concrete5/concrete5/pull/5425该解决方案应该修复混凝土5的Redactor(但它也应该适用于其他项目)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)