mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-20 14:04:06 +01:00
This commit is contained in:
parent
42dc3712c1
commit
ddfaf6bdba
5 changed files with 27 additions and 4 deletions
11
app/src/window/global/positionPDF.ts
Normal file
11
app/src/window/global/positionPDF.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import {getAllTabs} from "../../layout/getAll";
|
||||
import {Asset} from "../../asset";
|
||||
|
||||
export const positionPDF = (pathStr: string, page: string | number) => {
|
||||
getAllTabs().forEach((tab) => {
|
||||
if (tab.model instanceof Asset && tab.model.pdfObject && tab.model.path === pathStr) {
|
||||
tab.parent.switchTab(tab.headElement);
|
||||
tab.model.goToPage(page);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ import {initMessage} from "../dialog/message";
|
|||
import {getAllTabs} from "../layout/getAll";
|
||||
import {getLocalStorage} from "../protyle/util/compatibility";
|
||||
import {init} from "../window/init";
|
||||
import {positionPDF} from "./global/positionPDF";
|
||||
|
||||
class App {
|
||||
constructor() {
|
||||
|
|
@ -141,3 +142,8 @@ class App {
|
|||
}
|
||||
|
||||
new App();
|
||||
|
||||
// 再次点击新窗口已打开的 PDF 时,需进行定位
|
||||
window.newWindow = {
|
||||
positionPDF: positionPDF
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue