This commit is contained in:
Vanessa 2023-12-07 23:41:26 +08:00
parent b166fd87cd
commit 6bafc1b050

View file

@ -1008,7 +1008,7 @@ export class WYSIWYG {
if (range.toString() === "" || if (range.toString() === "" ||
window.siyuan.shiftIsPressed // https://ld246.com/article/1650096678723 window.siyuan.shiftIsPressed // https://ld246.com/article/1650096678723
) { ) {
if (event.detail === 3) { if (event.detail > 2) {
// table 前或最后一个 cell 三击状态不对 // table 前或最后一个 cell 三击状态不对
let cursorElement = hasClosestBlock(range.startContainer) as Element; let cursorElement = hasClosestBlock(range.startContainer) as Element;
if (cursorElement) { if (cursorElement) {
@ -1031,7 +1031,7 @@ export class WYSIWYG {
} }
const startBlockElement = hasClosestBlock(range.startContainer); const startBlockElement = hasClosestBlock(range.startContainer);
let endBlockElement: false | HTMLElement; let endBlockElement: false | HTMLElement;
if (mouseUpEvent.detail === 3 && range.endContainer.nodeType !== 3 && (range.endContainer as HTMLElement).tagName === "DIV" && range.endOffset === 0) { if (mouseUpEvent.detail > 2 && range.endContainer.nodeType !== 3 && (range.endContainer as HTMLElement).tagName === "DIV" && range.endOffset === 0) {
// 三击选中段落块时rangeEnd 会在下一个块 // 三击选中段落块时rangeEnd 会在下一个块
if ((range.endContainer as HTMLElement).classList.contains("protyle-attr") && startBlockElement) { if ((range.endContainer as HTMLElement).classList.contains("protyle-attr") && startBlockElement) {
// 三击在悬浮层中会选择到 attr https://github.com/siyuan-note/siyuan/issues/4636 // 三击在悬浮层中会选择到 attr https://github.com/siyuan-note/siyuan/issues/4636
@ -1376,7 +1376,11 @@ export class WYSIWYG {
} else { } else {
nodeElement.removeAttribute("data-render"); nodeElement.removeAttribute("data-render");
avRender(nodeElement, protyle, () => { avRender(nodeElement, protyle, () => {
openViewMenu({protyle, blockElement: nodeElement, element: nodeElement.querySelector(".item.item--focus")}); openViewMenu({
protyle,
blockElement: nodeElement,
element: nodeElement.querySelector(".item.item--focus")
});
}, avTabHeaderElement.dataset.id); }, avTabHeaderElement.dataset.id);
} }
event.stopPropagation(); event.stopPropagation();