Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/15580

Vanessa4ec53db20312
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 46c6ef14b3..c4006ade7f 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -871,7 +871,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
if (!target.classList.contains("av__gallery-item--select")) {
blockElement.querySelectorAll(".av__gallery-item--select").forEach(item => {
item.classList.remove("av__gallery-item--select");
- })
+ });
target.classList.add("av__gallery-item--select");
}
const ghostElement = document.createElement("div");
@@ -1102,7 +1102,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
const items = item.split("@");
const id = items[0];
const groupID = items[1] || "";
- const undoPreviousId = blockElement.querySelector(`.av__body${groupID ? `[data-group-id="${groupID}"]` : ""} .av__row[data-id="${id}"]`).previousElementSibling.getAttribute("data-id") || "";
+ const undoPreviousId = blockElement.querySelector(`.av__body${groupID ? `[data-group-id="${groupID}"]` : ""} .av__row[data-id="${id}"]`).previousElementSibling?.getAttribute("data-id") || "";
if (previousID !== id && undoPreviousId !== previousID || (
(undoPreviousId === "" && previousID === "" && targetGroupID !== groupID)
)) {
@@ -1181,7 +1181,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
const items = item.split("@");
const id = items[0];
const groupID = items[1] || "";
- const undoPreviousId = blockElement.querySelector(`.av__body[data-group-id="${groupID}"] .av__gallery-item[data-id="${id}"]`).previousElementSibling.getAttribute("data-id") || "";
+ const undoPreviousId = blockElement.querySelector(`.av__body[data-group-id="${groupID}"] .av__gallery-item[data-id="${id}"]`).previousElementSibling?.getAttribute("data-id") || "";
if (previousID !== item && undoPreviousId !== previousID || (
(undoPreviousId === "" && previousID === "" && targetGroupID !== groupID)
)) {