Skip to content

Commit

Permalink
fix: 图片添加链接直接删除防止报错
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokyo committed Aug 14, 2021
1 parent d9aa945 commit 2ce2639
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/menus/link/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ function insertHtml(selection: Selection, topNode: Node): string {
if (pointerNode)
middleContent = middleContent + makeHtmlString(pointerNode, htmlString ?? '')
}
pointerNode = pointerNode?.nextSibling ?? pointerNode
// 解决文字和图片同一行时会触发无限循环, 到不了endNode === pointerNode条件
const nextPointNode = pointerNode?.nextSibling ?? pointerNode
if (nextPointNode === pointerNode) break
pointerNode = nextPointNode
}

content = `${startContent}${middleContent}${endContent}`
Expand Down

0 comments on commit 2ce2639

Please sign in to comment.