mirror of
https://github.com/zadam/trilium.git
synced 2025-12-30 03:04:29 +01:00
feat(client/pdf): filter out view config by fingerprint
This commit is contained in:
parent
ebf725c949
commit
84425e86e9
@ -2,10 +2,16 @@ export default function interceptViewHistory() {
|
||||
const originalSetItem = Storage.prototype.setItem;
|
||||
Storage.prototype.setItem = function (key: string, value: string) {
|
||||
if (key === "pdfjs.history") {
|
||||
console.log(`Intercepted setting view history: ${key} = ${value}`);
|
||||
// Parse the history and remove entries that are not relevant.
|
||||
const history = JSON.parse(value);
|
||||
const fingerprint = window.PDFViewerApplication?.pdfDocument?.fingerprints?.[0];
|
||||
if (fingerprint) {
|
||||
history.files = history.files.filter((file: any) => file.fingerprint === fingerprint);
|
||||
}
|
||||
|
||||
window.parent.postMessage({
|
||||
type: "pdfjs-viewer-save-view-history",
|
||||
data: value
|
||||
data: JSON.stringify(history)
|
||||
}, "*");
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user