diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index f464ae182..a6b3044b7 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -1635,7 +1635,7 @@
Source:
@@ -1772,7 +1772,7 @@
Source:
@@ -1911,7 +1911,7 @@
Source:
@@ -2067,7 +2067,7 @@
Source:
@@ -2427,7 +2427,7 @@
Source:
@@ -2560,7 +2560,7 @@
Source:
@@ -2670,7 +2670,7 @@
Source:
@@ -2776,7 +2776,7 @@
Source:
@@ -2882,7 +2882,7 @@
Source:
@@ -2992,7 +2992,7 @@
Source:
@@ -3103,7 +3103,7 @@ implementation of actual widget type.
Source:
@@ -3207,7 +3207,7 @@ implementation of actual widget type.
Source:
@@ -3315,7 +3315,7 @@ implementation of actual widget type.
Source:
@@ -3483,7 +3483,7 @@ implementation of actual widget type.
Source:
@@ -3620,7 +3620,7 @@ implementation of actual widget type.
Source:
@@ -3777,7 +3777,7 @@ implementation of actual widget type.
Source:
@@ -3932,7 +3932,7 @@ implementation of actual widget type.
Source:
@@ -4039,7 +4039,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4194,7 +4194,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4350,7 +4350,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -4551,7 +4551,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4657,7 +4657,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4812,7 +4812,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4967,7 +4967,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5021,6 +5021,184 @@ otherwise (by e.g. createNoteLink()) +

openSplitWithNote(notePath, activate) → {Promise.<void>}

+ + + + + + +
+ Open a note in a new split. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
notePath + + +string + + + + (or noteId)
activate + + +boolean + + + + set to true to activate the new split, false to stay on the current split
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<void> + + +
+
+ + + + + + + + + + + + +

openTabWithNote(notePath, activate) → {Promise.<void>}

@@ -5296,7 +5474,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5404,7 +5582,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5560,7 +5738,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5716,7 +5894,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5853,7 +6031,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6007,7 +6185,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6093,7 +6271,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6230,7 +6408,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -6391,7 +6569,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6499,7 +6677,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6637,7 +6815,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6793,7 +6971,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6948,7 +7126,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7099,7 +7277,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7236,7 +7414,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7373,7 +7551,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7533,7 +7711,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7693,7 +7871,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -7785,7 +7963,7 @@ Typical use case is when new note has been created, we should wait until it is s
Source:
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html index e3bb5cbf0..8879721e8 100644 --- a/docs/frontend_api/global.html +++ b/docs/frontend_api/global.html @@ -395,7 +395,7 @@
Source:
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 0bb38dc24..da00296e1 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -129,6 +129,26 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain } }; + /** + * Open a note in a new split. + * + * @param {string} notePath (or noteId) + * @param {boolean} activate - set to true to activate the new split, false to stay on the current split + * @return {Promise<void>} + */ + this.openSplitWithNote = async (notePath, activate) => { + await ws.waitForMaxKnownEntityChangeId(); + + const subContexts = appContext.tabManager.getActiveContext().getSubContexts(); + const {ntxId} = subContexts[subContexts.length - 1]; + + appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath}); + + if (activate) { + appContext.triggerEvent('focusAndSelectTitle'); + } + }; + /** * @typedef {Object} ToolbarButtonOptions * @property {string} title diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.js index b2eabdc13..5ae0eaa05 100644 --- a/src/public/app/services/frontend_script_api.js +++ b/src/public/app/services/frontend_script_api.js @@ -101,6 +101,26 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain } }; + /** + * Open a note in a new split. + * + * @param {string} notePath (or noteId) + * @param {boolean} activate - set to true to activate the new split, false to stay on the current split + * @return {Promise} + */ + this.openSplitWithNote = async (notePath, activate) => { + await ws.waitForMaxKnownEntityChangeId(); + + const subContexts = appContext.tabManager.getActiveContext().getSubContexts(); + const {ntxId} = subContexts[subContexts.length - 1]; + + appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath}); + + if (activate) { + appContext.triggerEvent('focusAndSelectTitle'); + } + }; + /** * @typedef {Object} ToolbarButtonOptions * @property {string} title