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
Firefox 在点击按钮上传图片时,光标会偏移致使图片位置错乱 #1136
Comments
这个问题我也有,每次图片都插到最开头去了。我还以为设置有问题呢。而且图片回车也有问题,一大片空白还删不掉。 |
这个问题我这边也发现了,最初以为是document.execCommand("insertHTML", false, succFileText)执行结果为false,查询mdn文档发现该指令已被废弃,但是后来发现是因为失去焦点光标造成的,啥时候解决了,求告知。 |
最近比较忙,兼容性问题可能要等一等,如果着急的可以先 PR。 |
@Vanessa219 期待官方更好的修复。这边目前的策略是针对Firefox浏览器进行覆盖的方式进行处理,但是这种方式仅适用于在结尾处插入图片的情况。that.contentEditor.setValue(that.contentEditor.getValue() + succFileText) |
@Vanessa219 尝试了另一种光标定位,很不理想。 |
@Vanessa219 that.contentEditor.focus()编辑器这个焦点Google中与Firefox中结果不一致,top存在差异。 |
兼容性问题是比较麻烦的。 |
@Vanessa219 给点思路,怎么处理手动更新focus焦点,尝试了range,但是完全不对。 |
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range); |
编辑模式
wysiwyg
所见即所得模式描述问题
光标位置会偏移造成图片位置错乱
比如下图所示,光标在文章地下,但是点击按钮上传图片,图片会跑到文章开头
下图是会跑到已输入的内容(文字123)的前面去
期待的结果
修正光标位置,上传图片的位置在光标所处位置
截屏或录像
版本信息
其他信息
The text was updated successfully, but these errors were encountered: