diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html
index cbe5cd3ef..9b6acb3a0 100644
--- a/docs/backend_api/entities_note.js.html
+++ b/docs/backend_api/entities_note.js.html
@@ -959,6 +959,7 @@ class Note extends Entity {
delete pojo.isContentAvailable;
delete pojo.__attributeCache;
+ delete pojo.__ownedAttributeCache;
delete pojo.content;
/** zero references to contentHash, probably can be removed */
delete pojo.contentHash;
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index dc8fc5a64..e71c0b407 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -4975,6 +4975,90 @@ Internally this serializes the anonymous function into string and sends it to ba
+
+
+
+
+
+
+
waitUntilSynced()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/frontend_api/entities_branch.js.html b/docs/frontend_api/entities_branch.js.html
index bf5d06879..27e633a2b 100644
--- a/docs/frontend_api/entities_branch.js.html
+++ b/docs/frontend_api/entities_branch.js.html
@@ -47,7 +47,7 @@ class Branch {
/** @returns {NoteShort} */
async getNote() {
- return await this.treeCache.getNote(this.noteId);
+ return this.treeCache.getNote(this.noteId);
}
/** @returns {boolean} true if it's top level, meaning its parent is root note */
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index e76325720..6d22768bb 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -410,6 +410,11 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
* @param {function} handler
*/
this.bindGlobalShortcut = utils.bindGlobalShortcut;
+
+ /**
+ * @method
+ */
+ this.waitUntilSynced = ws.waitForMaxKnownSyncId;
}
export default FrontendScriptApi;
diff --git a/src/public/javascripts/dialogs/markdown_import.js b/src/public/javascripts/dialogs/markdown_import.js
index 56c78d879..02465e34a 100644
--- a/src/public/javascripts/dialogs/markdown_import.js
+++ b/src/public/javascripts/dialogs/markdown_import.js
@@ -26,6 +26,10 @@ async function convertMarkdownToHtml(text) {
}
export async function importMarkdownInline() {
+ if (noteDetailService.getActiveTabNoteType() !== 'text') {
+ return;
+ }
+
if (utils.isElectron()) {
const {clipboard} = require('electron');
const text = clipboard.readText();
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index d3d0604b2..b8f4aa1bf 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -132,6 +132,12 @@ function registerEntrypoints() {
$("#open-dev-tools-button").toggle(utils.isElectron());
+ keyboardActionService.setGlobalActionHandler("PasteMarkdownIntoText", async () => {
+ const dialog = await import("../dialogs/markdown_import.js");
+
+ dialog.importMarkdownInline();
+ });
+
if (utils.isElectron()) {
const openDevTools = () => {
require('electron').remote.getCurrentWindow().toggleDevTools();
diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js
index 7d1711bda..d17ad38d3 100644
--- a/src/public/javascripts/services/frontend_script_api.js
+++ b/src/public/javascripts/services/frontend_script_api.js
@@ -384,6 +384,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
this.bindGlobalShortcut = utils.bindGlobalShortcut;
/**
+ * Trilium runs in backend and frontend process, when something is changed on the backend from script,
+ * frontend will get asynchronously synchronized.
+ *
+ * This method returns a promise which resolves once all the backend -> frontend synchronization is finished.
+ * Typical use case is when new note has been created, we should wait until it is synced into frontend and only then activate it.
+ *
* @method
*/
this.waitUntilSynced = ws.waitForMaxKnownSyncId;
diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js
index 862e82589..31d7e9dee 100644
--- a/src/services/keyboard_actions.js
+++ b/src/services/keyboard_actions.js
@@ -250,6 +250,11 @@ const DEFAULT_KEYBOARD_ACTIONS = [
actionName: "InsertDateTimeToText",
defaultShortcuts: ["Alt+T"]
},
+ {
+ actionName: "PasteMarkdownIntoText",
+ defaultShortcuts: [],
+ description: "Pastes Markdown from clipboard into text note"
+ },
{
separator: "Other"