Skip to content

Commit

Permalink
fix: 选中图片插入链接,页面卡死
Browse files Browse the repository at this point in the history
  • Loading branch information
TGuoW committed Apr 17, 2021
1 parent 5496965 commit df3f464
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/menus/link/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ function makeHtmlString(node: Node, content: string): string {
*/
function createPartHtml(topText: string, node: Node, startPos: number, endPost?: number): string {
let selectionContent = node.textContent?.substring(startPos, endPost)
let pointerNode = node
let pointerNode: Node | null = node
let content = ''
do {
content = makeHtmlString(pointerNode, selectionContent ?? '')
selectionContent = content
if (pointerNode.parentElement) pointerNode = pointerNode?.parentElement
} while (pointerNode.textContent !== topText)
pointerNode = pointerNode?.parentElement
} while (pointerNode && pointerNode.textContent !== topText)

return content
}
Expand Down

2 comments on commit df3f464

@baozi-wei
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

页面是不卡死了,但是图片成了空白框

@duanliang920
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哈哈哈哈,修复一个bug,又产生了一个bug

Please sign in to comment.