Skip to content

Commit

Permalink
fix: 同一行多个img所见即所得编辑时无法选中正确的图片
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed May 31, 2023
1 parent baf592f commit f64430d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/toolbars/PreviewerBubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,14 @@ export default class PreviewerBubble {
return true;
}
testIndex += 1;
}
line += targetString.match(/\n/g)?.length ?? 0;
if (/\n/.test(targetString)) {
// 如果有换行,则开始位置的字符计数从最后一个换行开始计数
beginCh = targetString.replace(/^[\w\W]*\n([^\n]*)$/, '$1').length;
} else {
line += targetString.match(/\n/g)?.length ?? 0;
if (/\n/.test(targetString)) {
// 如果有换行,则开始位置的字符计数从最后一个换行开始计数
beginCh = targetString.replace(/^[\w\W]*\n([^\n]*)$/, '$1').length;
} else {
// 如果没有换行,则继续按上次的beginCh为起始开始计数
beginCh += targetString.length;
}
// 如果没有换行,则继续按上次的beginCh为起始开始计数
beginCh += targetString.length;
}
}
}
Expand Down

0 comments on commit f64430d

Please sign in to comment.