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

Vanessa215bf39e0a44
diff --git a/app/src/asset/pdf/app.js b/app/src/asset/pdf/app.js
index 03769240be..4bd975a4ab 100644
--- a/app/src/asset/pdf/app.js
+++ b/app/src/asset/pdf/app.js
@@ -155,7 +155,8 @@ class PDFViewerApplication {
this.annotationEditorParams = null
this.isInitialViewSet = false
this.downloadComplete = false
- this.isViewerEmbedded = window.parent !== window
+ // NOTE 不使用 initialBookmark
+ this.isViewerEmbedded = true
this.url = ""
this.baseUrl = ""
this._downloadUrl = ""
@@ -757,7 +758,7 @@ class PDFViewerApplication {
}
const editorIndicator =
this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;
- // NOTE document.title = `${editorIndicator ? "* " : ""}${title}`;
+ document.title = `${editorIndicator ? "* " : ""}${title}`;
}
get _docFilename() {
@@ -1182,7 +1183,8 @@ class PDFViewerApplication {
let sidebarView = AppOptions.get("sidebarViewOnLoad");
let scrollMode = AppOptions.get("scrollModeOnLoad");
let spreadMode = AppOptions.get("spreadModeOnLoad");
-
+ // NOTE
+ stored.page = this.pdfId || stored.page;
if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) {
hash =
`page=${stored.page}&zoom=${zoom || stored.zoom},` +
@@ -1200,6 +1202,10 @@ class PDFViewerApplication {
spreadMode = stored.spreadMode | 0;
}
}
+ // NOTE 定位分页,最后通过 showHighlight 进行高亮
+ if (hash.indexOf("page=") === -1 && this.pdfId) {
+ hash += `&page=${this.pdfId}`;
+ }
// NOTE: Ignore the pageMode/pageLayout in GeckoView since there's no
// sidebar available, nor any UI for changing the Scroll/Spread modes.
if (
@@ -1248,11 +1254,6 @@ class PDFViewerApplication {
setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);
}),
]);
- // NOTE 通过引用打开
- if (this.annoId && this.pdfId) {
- webViewerPageNumberChanged(
- {value: this.pdfId, pdfInstance: this, id: this.annoId})
- }
if (!initialBookmark && !hash) {
return;
}
diff --git a/app/src/asset/pdf/text_layer_builder.js b/app/src/asset/pdf/text_layer_builder.js
index 5bd286ba54..94940e6fae 100644
--- a/app/src/asset/pdf/text_layer_builder.js
+++ b/app/src/asset/pdf/text_layer_builder.js
@@ -71,9 +71,6 @@ class TextLayerBuilder {
this.div.append(endOfContent);
this.#bindMouse();
-
- // NOTE
- getHighlight(this.div)
}
get numTextDivs() {
@@ -131,6 +128,8 @@ class TextLayerBuilder {
this.#scale = scale;
this.#rotation = rotation;
this.show();
+ // NOTE
+ getHighlight(this.div)
this.accessibilityManager?.enable();
}