This commit is contained in:
Vanessa 2023-11-15 11:00:40 +08:00
parent 99b3c7e192
commit dc7f763054
2 changed files with 8 additions and 1 deletions

View file

@ -47,7 +47,8 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
if (mathElement.tagName === "DIV") {
renderElement.firstElementChild.setAttribute("contenteditable", "false");
if (renderElement.childElementCount < 2) {
renderElement.insertAdjacentHTML("beforeend", `<span contenteditable="false" style="position: absolute">${Constants.ZWSP}</span>`);
// 不能使用 contenteditable="false",否则光标无法移动到该块
renderElement.insertAdjacentHTML("beforeend", `<span style="position: absolute;right: 0;top: 0;">${Constants.ZWSP}</span>`);
}
// https://github.com/siyuan-note/siyuan/issues/3541
const baseElements = renderElement.querySelectorAll(".base");

View file

@ -1477,6 +1477,12 @@ export class WYSIWYG {
event.stopPropagation();
return;
}
const blockElement = hasClosestBlock(event.target)
if (blockElement && !getContenteditableElement(blockElement)) {
event.stopPropagation();
event.preventDefault();
return;
}
paste(protyle, event);
});