Vanessa 2024-04-23 22:18:00 +08:00
parent 51455b16a8
commit 7e4dcebde2
2 changed files with 5 additions and 3 deletions

View file

@ -56,8 +56,8 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
if (event && event.inputType === "deleteContentForward") {
const wbrNextElement = hasNextSibling(wbrElement) as HTMLElement;
if (wbrNextElement && wbrNextElement.nodeType === 1 && !wbrNextElement.textContent.startsWith(Constants.ZWSP)) {
const type = wbrNextElement.getAttribute("data-type").split(" ");
if (type.includes("code") || type.includes("kbd") || type.includes("tag")) {
const nextType = (wbrNextElement.getAttribute("data-type") || "").split(" ");
if (nextType.includes("code") || nextType.includes("kbd") || nextType.includes("tag")) {
wbrNextElement.insertAdjacentElement("afterbegin", wbrElement);
}
}

View file

@ -774,7 +774,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range);
if (event.key === "Delete" || matchHotKey("⌃D", event)) {
// 段末反向删除 https://github.com/siyuan-note/insider/issues/274
if (position.end === editElement.textContent.length) {
if (position.end === editElement.textContent.length ||
// 软换行后删除 https://github.com/siyuan-note/siyuan/issues/11118
(position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n"))) {
const nextElement = getNextBlock(getTopAloneElement(nodeElement));
if (nextElement) {
const nextRange = focusBlock(nextElement);