This commit is contained in:
Vanessa 2023-08-08 22:14:34 +08:00
parent c01ba53c9b
commit 86f658b352
2 changed files with 10 additions and 10 deletions

View file

@ -43,8 +43,8 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) =
return true;
}
// https://github.com/siyuan-note/siyuan/issues/8935
const wbrElement = document.createElement("wbr")
range.insertNode(wbrElement)
const wbrElement = document.createElement("wbr");
range.insertNode(wbrElement);
const html = listItemElement.parentElement.outerHTML;
wbrElement.remove();
let newElement = genListItemElement(listItemElement, -1, true);

View file

@ -1553,19 +1553,19 @@ export class WYSIWYG {
if ((event.key === "ArrowLeft" || event.key === "ArrowRight" ||
event.key === "Alt" || event.key === "Shift") && // 选中后 alt+shift+arrowRight 会导致光标和选中块不一致
nodeElement && !nodeElement.classList.contains("protyle-wysiwyg--select")) {
const selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))
let containRange = false
const selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
let containRange = false;
selectElements.find(item => {
if (item.contains(range.startContainer)) {
containRange = true
return true
containRange = true;
return true;
}
})
});
if (!containRange && selectElements.length > 0) {
selectElements.forEach(item => {
item.classList.remove("protyle-wysiwyg--select")
})
nodeElement.classList.add("protyle-wysiwyg--select")
item.classList.remove("protyle-wysiwyg--select");
});
nodeElement.classList.add("protyle-wysiwyg--select");
}
}
});