mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 10:46:09 +01:00
This commit is contained in:
parent
a02c36e91b
commit
a61e861503
3 changed files with 12 additions and 4 deletions
|
|
@ -128,6 +128,9 @@ export const goBack = () => {
|
|||
} else if (document.getElementById("model").style.transform === "translateY(0px)") {
|
||||
document.getElementById("model").style.transform = "";
|
||||
return;
|
||||
} else if (window.siyuan.viewer && !window.siyuan.viewer.destroyed) {
|
||||
window.siyuan.viewer.destroy();
|
||||
return;
|
||||
} else if (document.getElementById("menu").style.transform === "translateX(0px)" ||
|
||||
document.getElementById("sidebar").style.transform === "translateX(0px)") {
|
||||
closePanel();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const previewImage = (src: string, id: string) => {
|
|||
});
|
||||
imagesElement.innerHTML = html;
|
||||
// @ts-ignore
|
||||
const viewer = new Viewer(imagesElement, {
|
||||
window.siyuan.viewer = new Viewer(imagesElement, {
|
||||
title: [1, (image: HTMLImageElement, imageData: IObject) => {
|
||||
let name = image.alt;
|
||||
if (!name) {
|
||||
|
|
@ -31,7 +31,7 @@ export const previewImage = (src: string, id: string) => {
|
|||
initialViewIndex,
|
||||
transition: false,
|
||||
hidden: function () {
|
||||
viewer.destroy();
|
||||
window.siyuan.viewer.destroy();
|
||||
},
|
||||
toolbar: {
|
||||
zoomIn: true,
|
||||
|
|
@ -46,11 +46,11 @@ export const previewImage = (src: string, id: string) => {
|
|||
flipHorizontal: true,
|
||||
flipVertical: true,
|
||||
close: function () {
|
||||
viewer.destroy();
|
||||
window.siyuan.viewer.destroy();
|
||||
},
|
||||
},
|
||||
});
|
||||
viewer.show();
|
||||
window.siyuan.viewer.show();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
5
app/src/types/index.d.ts
vendored
5
app/src/types/index.d.ts
vendored
|
|
@ -235,6 +235,11 @@ interface ISiyuan {
|
|||
bookmarkLabel?: string[]
|
||||
blockPanels: import("../block/Panel").BlockPanel[],
|
||||
dialogs: import("../dialog").Dialog[],
|
||||
viewer?: {
|
||||
destroyed: boolean,
|
||||
show: () => void,
|
||||
destroy: () => void,
|
||||
}
|
||||
}
|
||||
|
||||
interface IScrollAttr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue