mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-20 23:36:10 +01:00
This commit is contained in:
parent
11d4157b52
commit
fe3ff881b9
3 changed files with 25 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ import {Constants} from "../constants";
|
|||
import {openNewWindowById} from "../window/openNewWindow";
|
||||
import {MenuItem} from "./Menu";
|
||||
import {App} from "../index";
|
||||
import {isInAndroid, openByMobile, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {exportByMobile, isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {checkFold} from "../util/noRelyPCFunction";
|
||||
|
||||
export const exportAsset = (src: string) => {
|
||||
|
|
@ -19,7 +19,7 @@ export const exportAsset = (src: string) => {
|
|||
icon: "iconUpload",
|
||||
async click() {
|
||||
/// #if BROWSER
|
||||
openByMobile(src);
|
||||
exportByMobile(src);
|
||||
/// #else
|
||||
const result = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
|
||||
cmd: "showSaveDialog",
|
||||
|
|
|
|||
|
|
@ -30,6 +30,21 @@ export const openByMobile = (uri: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const exportByMobile = (uri: string) => {
|
||||
if (!uri) {
|
||||
return;
|
||||
}
|
||||
if (isInIOS()) {
|
||||
openByMobile(uri);
|
||||
} else if (isInAndroid()) {
|
||||
window.JSAndroid.exportByDefault(uri);
|
||||
} else if (isInHarmony()) {
|
||||
window.JSHarmony.exportByDefault(uri);
|
||||
} else {
|
||||
window.open(uri);
|
||||
}
|
||||
};
|
||||
|
||||
export const readText = () => {
|
||||
if (isInAndroid()) {
|
||||
return window.JSAndroid.readClipboard();
|
||||
|
|
|
|||
9
app/src/types/index.d.ts
vendored
9
app/src/types/index.d.ts
vendored
|
|
@ -178,7 +178,14 @@ interface Window {
|
|||
dataLayer: any[]
|
||||
|
||||
siyuan: ISiyuan
|
||||
webkit: any
|
||||
webkit: {
|
||||
messageHandlers: {
|
||||
openLink:{postMessage: (url: string) => void}
|
||||
startKernelFast:{postMessage: (url: string) => void}
|
||||
changeStatusBar:{postMessage: (url: string) => void}
|
||||
setClipboard:{postMessage: (url: string) => void}
|
||||
}
|
||||
}
|
||||
html2canvas: (element: Element, opitons: {
|
||||
useCORS: boolean,
|
||||
scale?: number
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue