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/10692

Vanessa8a8ac2f45d93
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 931ceeff9c..70b0c36fbd 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -3,7 +3,15 @@ import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../
import {transaction} from "../../wysiwyg/transaction";
import {openEditorTab} from "../../../menus/util";
import {copySubMenu} from "../../../menus/commonMenuItem";
-import {getCellText, getTypeByCellElement, popTextCell, renderCell, renderCellAttr, updateHeaderCell} from "./cell";
+import {
+ addDragFill,
+ getCellText,
+ getTypeByCellElement,
+ popTextCell,
+ renderCell,
+ renderCellAttr,
+ updateHeaderCell
+} from "./cell";
import {getColIconByType, showColMenu} from "./col";
import {deleteRow, insertRows, setPageSize, updateHeader} from "./row";
import {emitOpenMenu} from "../../../plugin/EventBus";
@@ -450,7 +458,11 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAV
if (headerValue) {
updateHeaderCell(cellElement, headerValue);
} else {
+ const hasDragFill = cellElement.querySelector(".av__drag-fill");
cellElement.innerHTML = renderCell(value);
+ if (hasDragFill) {
+ addDragFill(cellElement);
+ }
renderCellAttr(cellElement, value);
}
};
diff --git a/app/src/util/backForward.ts b/app/src/util/backForward.ts
index 4e86246e59..c84fd9cd1d 100644
--- a/app/src/util/backForward.ts
+++ b/app/src/util/backForward.ts
@@ -2,7 +2,7 @@ import {hasClosestBlock, hasClosestByAttribute} from "../protyle/util/hasClosest
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";
import {hideElements} from "../protyle/ui/hideElements";
-import {fetchSyncPost} from "./fetch";
+import {fetchPost, fetchSyncPost} from "./fetch";
import {Constants} from "../constants";
import {Wnd} from "../layout/Wnd";
import {getInstanceById, getWndByLayout} from "../layout/util";
@@ -14,6 +14,7 @@ import {showMessage} from "../dialog/message";
import {saveScroll} from "../protyle/scroll/saveScroll";
import {getAllModels} from "../layout/getAll";
import {App} from "../index";
+import {onGet} from "../protyle/util/onGet";
let forwardStack: IBackStack[] = [];
let previousIsBack = false;
@@ -143,7 +144,6 @@ const focusStack = async (app: App, stack: IBackStack) => {
});
return true;
}
- // 缩放
if (stack.protyle.element.parentElement) {
const response = await fetchSyncPost("/api/block/checkBlockExist", {id: stack.id});
if (!response.data) {
@@ -153,6 +153,40 @@ const focusStack = async (app: App, stack: IBackStack) => {
}
return false;
}
+ // 动态加载导致内容移除 https://github.com/siyuan-note/siyuan/issues/10692
+ if (!blockElement && !stack.zoomId && !stack.protyle.scroll.element.classList.contains("fn__none")) {
+ fetchPost("/api/filetree/getDoc", {
+ id: stack.id,
+ mode: 3,
+ size: window.siyuan.config.editor.dynamicLoadBlocks,
+ }, getResponse => {
+ onGet({
+ data: getResponse,
+ protyle: stack.protyle,
+ action: [Constants.CB_GET_FOCUS],
+ afterCB() {
+ Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find((item: HTMLElement) => {
+ if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
+ blockElement = item;
+ return true;
+ }
+ });
+ if (!blockElement) {
+ return;
+ }
+ getAllModels().outline.forEach(item => {
+ if (item.blockId === stack.protyle.block.rootID) {
+ item.setCurrent(blockElement);
+ }
+ });
+ focusByOffset(getContenteditableElement(blockElement), stack.position.start, stack.position.end);
+ }
+ });
+ });
+ return true;
+ }
+
+ // 缩放
zoomOut({
protyle: stack.protyle,
id: stack.zoomId || stack.protyle.block.rootID,