我已经使用pdf2htmlEX将pdf格式转换为html格式。选择多行时,当光标在两行之间移动时,选择会向上跳跃。谁来帮我把这个修一下。


这个问题已经在这里提出了,https://github.com/coolwanglu/pdf2htmlEX/issues/62,但是解决方案并没有解决这个问题。
发布于 2020-07-22 16:59:13
作为解决方法,我创建了以下样式:
.t {
/* making selection to behave nicer when selecting text between multiple text lines (to avoid element gaps which can cause weird selection behavior) */
padding-bottom: 100px;
margin-bottom: -25px;
/* making selection to behave nicer when selecting text between multiple columns (useful for pages with 2 or more text columns) */
padding-right: 2000px;
}问题是所有的文本元素都是绝对定位的,只要鼠标(在选择过程中)离开文本元素,它就会在页面元素上触发鼠标事件(这会导致选择从页面开始到起始点的文本),直到到达其他文本元素。
这种样式/变通方法“填充”了这些空白,因此鼠标永远不会到达页面元素。
文档看起来应该是一样的。
编辑:请注意,此解决方案依赖于正确的DOM结构(文本元素是有序的)。在某些情况下,文本可能变得不可选(例如,当页面包含2个文本列并且第一个文本块实际上被放置为DOM中的最后一个子级时)。
如果遇到这样的问题,请尝试调整值以适合您的文档,如下所示:
.t {
/* making selection to behave nicer when selecting text between multiple text lines (to avoid element gaps which can cause weird selection behavior) */
padding-bottom: 40px;
margin-bottom: -10px;
/* making selection to behave nicer when selecting text between multiple columns (useful for pages with 2 or more text columns) */
padding-right: 0px;
}选择可能会到处跳转(同样取决于文档结构和使用的值),但与原始状态相比,它仍然要好得多。
https://stackoverflow.com/questions/39632115
复制相似问题