Skip to content

Build your personal knowledge base with Trilium Notes

awaiting on triggered events/commands in the frontend API, fixes #3799

zadamc44be5367339
diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.js
index c985d89973..98d4e84601 100644
--- a/src/public/app/services/frontend_script_api.js
+++ b/src/public/app/services/frontend_script_api.js
@@ -65,7 +65,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveContext().setNote(notePath);
- appContext.triggerEvent('focusAndSelectTitle');
+ await appContext.triggerEvent('focusAndSelectTitle');
};
/**
@@ -82,7 +82,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
await appContext.tabManager.openContextWithNote(notePath, { activate });
if (activate) {
- appContext.triggerEvent('focusAndSelectTitle');
+ await appContext.triggerEvent('focusAndSelectTitle');
}
};
@@ -100,10 +100,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
const subContexts = appContext.tabManager.getActiveContext().getSubContexts();
const {ntxId} = subContexts[subContexts.length - 1];
- appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath});
+ await appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath});
if (activate) {
- appContext.triggerEvent('focusAndSelectTitle');
+ await appContext.triggerEvent('focusAndSelectTitle');
}
};