-
-
Notifications
You must be signed in to change notification settings - Fork 896
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
所见即所得模式加入划词评论 #721
Comments
88250
added a commit
to 88250/lute
that referenced
this issue
Aug 21, 2020
【实验性质】所见即所得模式加入批注 Vanessa219/vditor#721
88250
added a commit
to 88250/lute
that referenced
this issue
Oct 29, 2020
88250
added a commit
to 88250/lute
that referenced
this issue
Oct 29, 2020
88250
added a commit
to 88250/lute
that referenced
this issue
Oct 29, 2020
88250
added a commit
to 88250/lute
that referenced
this issue
Oct 29, 2020
88250
added a commit
to 88250/lute
that referenced
this issue
Nov 5, 2020
88250
added a commit
to 88250/lute
that referenced
this issue
Nov 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
需求
options.comment.enable
options.comment.add: (id: string, text: string) => void
options.comment.add: (id: string, text: string) => void
vditor.hlCommentIds(ids: string[])
和vditor.unHlCommentIds(ids: string[])
vditor.removeCommentIds(removeIds: string[]) => void
图1 评论界面参考:
图2 评论完成后界面参考:
图3 评论回复界面参考:
options.comment.remove: (ids: string[]) => void
vditor.getCommentIds() => string[]
实现
划词后生成
<span class="vditor-comment" data-cmtids="20201110111203-yt2ywdm">foo</span>
包裹重复/交叉划词时对已有元素进行拆分:
重复:
<span class="vditor-comment" data-cmtids="20201110111203-yt2ywdm 20201110114407-nw2kukz">fo</span><span class="vditor-comment" data-cmtids="20201110114407-nw2kukz">o</span>
,开头的 fo 被重复划词交叉:
<span class="vditor-comment" data-cmtids="20201110111203-yt2ywdm">f</span><span class="vditor-comment" data-cmtids="20201110111203-yt2ywdm 20201110114407-nw2kukz">o</span><span class="vditor-comment" data-cmtids="20201110114407-nw2kukz">o</span>
,中间的 o 被交叉划词重复是交叉的一种特殊情况,只需处理好交叉即可。
Lute 渲染行级 HTML 元素时如果遇到
<span class="vditor-comment" data-cmtids="
则以原始文本渲染输出The text was updated successfully, but these errors were encountered: