Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/5547

Vanessa3c5a4043dea9
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 5579bcd80a..f3e5a627b2 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -669,6 +669,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
const selectText = range.toString();
// 删除
if (!event.altKey && !event.shiftKey && !isCtrl(event) && (event.key === "Backspace" || event.key === "Delete")) {
+ // https://github.com/siyuan-note/siyuan/issues/5547
+ const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement
+ if (range.startOffset === 1 && range.startContainer.textContent === Constants.ZWSP &&
+ previousSibling && previousSibling.nodeType !== 3 && previousSibling.classList.contains("img")) {
+ previousSibling.classList.add("img--select");
+ }
const imgSelectElement = protyle.wysiwyg.element.querySelector(".img--select");
if (protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select")) {
removeBlock(protyle, nodeElement, range);