This commit is contained in:
Vanessa 2023-07-30 14:15:27 +08:00
parent e3ec694f9a
commit ca747f58a4

View file

@ -217,7 +217,13 @@ export const getLocalStorage = (cb: () => void) => {
Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI, Constants.LOCAL_PLUGINTOPUNPIN].forEach((key) => {
if (typeof response.data[key] === "string") {
try {
window.siyuan.storage[key] = Object.assign(defaultStorage[key], JSON.parse(response.data[key]));
const parseData = JSON.parse(response.data[key]);
if (typeof parseData === "number") {
// https://github.com/siyuan-note/siyuan/issues/8852 Object.assign 会导致 number to Number
window.siyuan.storage[key] = parseData;
} else {
window.siyuan.storage[key] = Object.assign(defaultStorage[key], parseData);
}
} catch (e) {
window.siyuan.storage[key] = defaultStorage[key];
}