This commit is contained in:
Vanessa 2023-02-09 12:53:58 +08:00
parent b376bf938c
commit 9044438108

View file

@ -13,6 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import {setStorageVal} from "../../protyle/util/compatibility";
const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
/** /**
@ -62,14 +64,17 @@ class ViewHistory {
sessionStorage.setItem("pdfjs.history", databaseStr); sessionStorage.setItem("pdfjs.history", databaseStr);
return; return;
} }
localStorage.setItem("pdfjs.history", databaseStr); // NOTE
window.siyuan.storage["pdfjs.history"] = databaseStr
setStorageVal("pdfjs.history", databaseStr)
} }
async _readFromStorage() { async _readFromStorage() {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
return sessionStorage.getItem("pdfjs.history"); return sessionStorage.getItem("pdfjs.history");
} }
return localStorage.getItem("pdfjs.history"); // NOTE
return window.siyuan.storage["pdfjs.history"];
} }
async set(name, val) { async set(name, val) {