mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix preserving original sourceId after running script notes, fixes #2224
This commit is contained in:
parent
1cdd644b8f
commit
6738f2cd24
6
package-lock.json
generated
6
package-lock.json
generated
@ -1344,9 +1344,9 @@
|
|||||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.22.0",
|
"version": "0.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.23.0.tgz",
|
||||||
"integrity": "sha512-Z0U3uhqQeg1oNcihswf4ZD57O3NrR1+ZXhxaROaWpDmsDTx7T2HNBV2ulBtie2hwJptu8UvgnJoK+BIqdzh/1w==",
|
"integrity": "sha512-NmvAE4i0YAv5cKq8zlDoPd1VLKAqX5oLuZKs8xkJa4qi6RGn0uhCYFjWtHHC9EM/MwOwYWOs53W+V0aqEXq1sg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "^1.14.4"
|
"follow-redirects": "^1.14.4"
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,12 @@ function executeBundle(bundle, apiParams = {}) {
|
|||||||
apiParams.startNote = bundle.note;
|
apiParams.startNote = bundle.note;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const originalSourceId = cls.get('sourceId');
|
||||||
|
|
||||||
cls.set('sourceId', 'script');
|
cls.set('sourceId', 'script');
|
||||||
|
|
||||||
// last \r\n is necessary if script contains line comment on its last line
|
// last \r\n is necessary if script contains line comment on its last line
|
||||||
const script = "function() {\r\n" + bundle.script + "\r\n}";
|
const script = "function() {\r\n" + bundle.script + "\r\n}";
|
||||||
|
|
||||||
const ctx = new ScriptContext(bundle.allNotes, apiParams);
|
const ctx = new ScriptContext(bundle.allNotes, apiParams);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -45,6 +46,9 @@ function executeBundle(bundle, apiParams = {}) {
|
|||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
cls.set('sourceId', originalSourceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user