web-highlighter icon indicating copy to clipboard operation
web-highlighter copied to clipboard

这个还原不会高亮显示

Open 316335930 opened this issue 3 years ago • 4 comments

highlighter.fromStore(hs.startMeta, hs.endMeta, hs.text, hs.id, hs.extra) 这个还原不会高亮显示

316335930 avatar Apr 13 '21 04:04 316335930

需要提供更多的报错信息,或者可复现的 demo

alienzhou avatar Jun 19 '21 08:06 alienzhou

我也遇见同样的问题了。

Highlighter.event.CREATE hook 中调用 isHighlightSource 静态方法 传入source对象,返回结果竟然是false。

ddddderek avatar Jan 19 '22 02:01 ddddderek

highlighter.fromStore(hs.startMeta, hs.endMeta, hs.text, hs.id, hs.extra) 这个还原不会高亮显示

你是不是把这个写在生命周期mounted里面的?如果你的页面存在异步加载文件,他会无法成功还原高亮,你需要自己解决时序问题

Neo-Chaos avatar Mar 01 '22 02:03 Neo-Chaos

create钩子中回传的内容是一个对象,{sources, type}你需要自己结构一下拿出sources才可以使用isHighlightSource函数进行判断

Neo-Chaos avatar Mar 01 '22 02:03 Neo-Chaos