Skip to content

Build your personal knowledge base with Trilium Notes

note actions now work again

zadam9a97fe09ee8e
diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js
index c342402542..7e5f31c984 100644
--- a/src/public/javascripts/desktop.js
+++ b/src/public/javascripts/desktop.js
@@ -126,7 +126,9 @@ if (utils.isElectron()) {
});
}
-$("#export-note-button").click(function () {
+const $noteTabContainer = $("#note-tab-container");
+
+$noteTabContainer.on("click", ".export-note-button", function () {
if ($(this).hasClass("disabled")) {
return;
}
@@ -134,12 +136,12 @@ $("#export-note-button").click(function () {
exportDialog.showDialog('single');
});
+$noteTabContainer.on("click", ".import-files-button", importDialog.showDialog);
+
$('[data-toggle="tooltip"]').tooltip({
html: true
});
-$("#import-files-button").click(importDialog.showDialog);
-
macInit.init();
searchNotesService.init(); // should be in front of treeService since that one manipulates address bar hash
diff --git a/src/public/javascripts/dialogs/import.js b/src/public/javascripts/dialogs/import.js
index 2402ca2979..0f08a07039 100644
--- a/src/public/javascripts/dialogs/import.js
+++ b/src/public/javascripts/dialogs/import.js
@@ -7,7 +7,7 @@ import messagingService from "../services/messaging.js";
const $dialog = $("#import-dialog");
const $form = $("#import-form");
-const $noteTitle = $dialog.find(".note-title");
+const $noteTitle = $dialog.find(".import-note-title");
const $fileUploadInput = $("#import-file-upload-input");
const $importProgressCountWrapper = $("#import-progress-count-wrapper");
const $importProgressCount = $("#import-progress-count");
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index e63e98bc5b..a169981a50 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -28,7 +28,21 @@ function registerEntrypoints() {
$("#jump-to-note-dialog-button").click(jumpToNoteDialog.showDialog);
utils.bindShortcut('ctrl+j', jumpToNoteDialog.showDialog);
- $("#show-note-revisions-button").click(function() {
+ $("#recent-changes-button").click(recentChangesDialog.showDialog);
+
+ $("#enter-protected-session-button").click(protectedSessionService.enterProtectedSession);
+ $("#leave-protected-session-button").click(protectedSessionService.leaveProtectedSession);
+
+ $("#toggle-search-button").click(searchNotesService.toggleSearch);
+ utils.bindShortcut('ctrl+s', searchNotesService.toggleSearch);
+
+ const $noteTabContainer = $("#note-tab-container");
+ $noteTabContainer.on("click", ".show-attributes-button", attributesDialog.showDialog);
+ utils.bindShortcut('alt+a', attributesDialog.showDialog);
+
+ $noteTabContainer.on("click", ".show-note-info-button", noteInfoDialog.showDialog);
+
+ $noteTabContainer.on("click", ".show-note-revisions-button", function() {
if ($(this).hasClass("disabled")) {
return;
}
@@ -36,7 +50,7 @@ function registerEntrypoints() {
noteRevisionsDialog.showCurrentNoteRevisions();
});
- $("#show-source-button").click(function() {
+ $noteTabContainer.on("click", ".show-source-button", function() {
if ($(this).hasClass("disabled")) {
return;
}
@@ -44,17 +58,6 @@ function registerEntrypoints() {
noteSourceDialog.showDialog();
});
- $("#recent-changes-button").click(recentChangesDialog.showDialog);
-
- $("#enter-protected-session-button").click(protectedSessionService.enterProtectedSession);
- $("#leave-protected-session-button").click(protectedSessionService.leaveProtectedSession);
-
- $("#toggle-search-button").click(searchNotesService.toggleSearch);
- utils.bindShortcut('ctrl+s', searchNotesService.toggleSearch);
-
- $(".show-attributes-button").click(attributesDialog.showDialog);
- utils.bindShortcut('alt+a', attributesDialog.showDialog);
-
$("#options-button").click(optionsDialog.showDialog);
$("#show-help-button").click(helpDialog.showDialog);
@@ -63,8 +66,6 @@ function registerEntrypoints() {
$("#open-sql-console-button").click(sqlConsoleDialog.showDialog);
utils.bindShortcut('alt+o', sqlConsoleDialog.showDialog);
- $("#show-note-info-button").click(noteInfoDialog.showDialog);
-
$("#show-about-dialog-button").click(aboutDialog.showDialog);
if (utils.isElectron()) {
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js
index beccf47d56..cd7be2094f 100644
--- a/src/public/javascripts/services/note_detail.js
+++ b/src/public/javascripts/services/note_detail.js
@@ -148,13 +148,11 @@ async function loadNoteDetail(noteId, newTab = false) {
if (utils.isDesktop()) {
// needs to happen after loading the note itself because it references active noteId
- // FIXME
- //attributeService.refreshAttributes();
+ ctx.attributes.refreshAttributes();
}
else {
// mobile usually doesn't need attributes so we just invalidate
- // FIXME
- //attributeService.invalidateAttributes();
+ ctx.attributes.invalidateAttributes();
}
ctx.updateNoteView();
diff --git a/src/public/javascripts/services/note_detail_protected_session.js b/src/public/javascripts/services/note_detail_protected_session.js
new file mode 100644
index 0000000000..d0335e9689
--- /dev/null
+++ b/src/public/javascripts/services/note_detail_protected_session.js
@@ -0,0 +1,18 @@
+class NoteDetailImage {
+ /**
+ * @param {NoteContext} ctx
+ */
+ constructor(ctx) {
+ this.ctx = ctx;
+ this.$component = ctx.$noteTabContent.find(".protected-session-password-component");
+ const $passwordForms = ctx.$noteTabContent.find(".protected-session-password-form");
+ const $passwordInputs = ctx.$noteTabContent.find(".protected-session-password");
+ const $passwordInModal = ctx.$noteTabContent.find(".protected-session-password-in-modal");
+ const $protectButton = ctx.$noteTabContent.find(".protect-button");
+ const $unprotectButton = ctx.$noteTabContent.find(".unprotect-button");
+ }
+
+ show() {
+ this.$component.show();
+ }
+}
\ No newline at end of file
diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.js
index dab19612a8..1319fbb68d 100644
--- a/src/public/javascripts/services/protected_session.js
+++ b/src/public/javascripts/services/protected_session.js
@@ -10,7 +10,7 @@ const $component = $("#protected-session-password-component");
const $passwordForms = $(".protected-session-password-form");
const $passwordInputs = $(".protected-session-password");
const $passwordInModal = $("#protected-session-password-in-modal");
-const $tabContent = $(".note-tab-content"); // FIXME TAB
+const $tabContent = $(".note-tab-content");
const $protectButton = $("#protect-button");
const $unprotectButton = $("#unprotect-button");
const $enterProtectedSessionButton = $("#enter-protected-session-button");
diff --git a/src/public/stylesheets/desktop.css b/src/public/stylesheets/desktop.css
index c09f21d4c1..dbaf4477d8 100644
--- a/src/public/stylesheets/desktop.css
+++ b/src/public/stylesheets/desktop.css
@@ -147,7 +147,7 @@ li.dropdown-submenu:hover > ul.dropdown-menu {
border: 1px solid var(--main-border-color);
}
-.note-info-table td, .note-info-table th {
+#note-info-table td, #note-info-table th {
padding: 15px;
}
diff --git a/src/views/dialogs/import.ejs b/src/views/dialogs/import.ejs
index 28be7aa3e3..6c908e57f5 100644
--- a/src/views/dialogs/import.ejs
+++ b/src/views/dialogs/import.ejs
@@ -18,7 +18,7 @@
<input type="file" id="import-file-upload-input" class="form-control-file" multiple />
- <p>Content of the file will be imported as child note(s) into <strong class="note-title"></strong>.
+ <p>Content of the file will be imported as child note(s) into <strong class="import-note-title"></strong>.
</div>
<div class="form-group">