This commit is contained in:
Vanessa 2023-11-22 17:14:27 +08:00
parent 72752f441a
commit 22a1339079

View file

@ -1030,9 +1030,10 @@ export class WYSIWYG {
let endBlockElement: false | HTMLElement;
if (mouseUpEvent.detail === 3 && range.endContainer.nodeType !== 3 && (range.endContainer as HTMLElement).tagName === "DIV" && range.endOffset === 0) {
// 三击选中段落块时rangeEnd 会在下一个块
if ((range.endContainer as HTMLElement).classList.contains("protyle-attr")) {
if ((range.endContainer as HTMLElement).classList.contains("protyle-attr") && startBlockElement) {
// 三击在悬浮层中会选择到 attr https://github.com/siyuan-note/siyuan/issues/4636
setLastNodeRange((range.endContainer as HTMLElement).previousElementSibling, range, false);
// 需要获取可编辑元素,使用 previousElementSibling 的话会 https://github.com/siyuan-note/siyuan/issues/9714
setLastNodeRange(getContenteditableElement(startBlockElement), range, false);
}
} else {
endBlockElement = hasClosestBlock(range.endContainer);