Vanessa 2022-10-30 09:51:07 +08:00
parent 33fa1700f8
commit 18415517bb
4 changed files with 26 additions and 11 deletions

View file

@ -1,4 +1,5 @@
import {focusByRange} from "./selection";
import {fetchPost} from "../../util/fetch";
export const openByMobile = (uri: string) => {
if (!uri) {
@ -13,7 +14,7 @@ export const openByMobile = (uri: string) => {
}
};
export const readText = async () => {
export const readText = async () => {
if ("android" === window.siyuan.config.system.container && window.JSAndroid) {
return window.JSAndroid.readClipboard();
}
@ -133,9 +134,15 @@ export const hotKey2Electron = (key: string) => {
};
export const setLocalStorage = () => {
fetchPost("/api/system/getLocalStorage", undefined, (response) => {
Object.keys(response.data).forEach(item => {
window.localStorage.setItem(item, response.data[item]);
})
});
}
export const exportLocalStorage = () => {
export const exportLocalStorage = (cb: () => void) => {
fetchPost("/api/system/setLocalStorage", {val: JSON.stringify(localStorage)}, (response) => {
cb();
});
}