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

Vanessae465fe5f9775
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index a9134386fa..cb1f97bd8b 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -45,7 +45,7 @@ export const openFileById = async (options: {
keepCursor?: boolean
zoomIn?: boolean
removeCurrentTab?: boolean
- afterOpen?: (model:Model) => void
+ afterOpen?: (model: Model) => void
}) => {
const response = await fetchSyncPost("/api/block/getBlockInfo", {id: options.id});
if (response.code === -1) {
@@ -575,6 +575,9 @@ export const isCurrentEditor = (blockId: string) => {
export const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => {
models.outline.find(item => {
+ if (protyle && item.blockId === protyle.block.rootID && item.type === "pin") {
+ item.isPreview = !protyle.preview.element.classList.contains("fn__none");
+ }
if (reload || (item.type === "pin" && (!protyle || item.blockId !== protyle.block?.rootID))) {
let blockId = "";
if (protyle && protyle.block) {
@@ -583,17 +586,12 @@ export const updateOutline = (models: IModels, protyle: IProtyle, reload = false
if (blockId === item.blockId && !reload) {
return;
}
- if (protyle && !protyle.preview.element.classList.contains("fn__none")) {
- protyle.preview.render(protyle);
- return;
- }
fetchPost("/api/outline/getDocOutline", {
id: blockId,
}, response => {
if (!reload && (!isCurrentEditor(blockId) || item.blockId === blockId)) {
return;
}
- item.isPreview = false;
item.update(response, blockId);
if (protyle) {
item.updateDocTitle(protyle.background.ial);
diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts
index d6198c0874..63e533cd18 100644
--- a/app/src/layout/dock/Outline.ts
+++ b/app/src/layout/dock/Outline.ts
@@ -182,9 +182,13 @@ export class Outline extends Model {
openFileById({
app: options.app,
id: this.blockId,
- afterOpen(model: Editor) {
+ afterOpen: (model: Editor) =>{
if (model) {
- goHome(model.editor.protyle);
+ if (this.isPreview) {
+ model.editor.protyle.preview.element.querySelector(".b3-typography").scrollTop = 0;
+ } else {
+ goHome(model.editor.protyle);
+ }
}
}
});