Skip to content

Build your personal knowledge base with Trilium Notes

feat(mobile): add note revisions dialog

Elian Doran626191ad2f44
diff --git a/docs/Release Notes/Release Notes/v0.92.8-beta.md b/docs/Release Notes/Release Notes/v0.92.8-beta.md
index 7e579f00e6..803a2bfd0f 100644
--- a/docs/Release Notes/Release Notes/v0.92.8-beta.md
+++ b/docs/Release Notes/Release Notes/v0.92.8-beta.md
@@ -20,7 +20,7 @@
* Document structure is now precalculated, so start-up time should be slightly increased.
* Optimized the content in order to reduce the size on disk.
* Mobile improvements:
- * The following dialogs are now accessible: bulk actions, branch prefix, include note, add link, sort child notes, note type selector, move/clone to, import/export, markdown import
+ * The following dialogs are now accessible: bulk actions, branch prefix, include note, add link, sort child notes, note type selector, move/clone to, import/export, markdown import, note revisions
* Modals now have a safe margin on their bottom and are scrollable.
## 🌍 Internationalization
diff --git a/src/public/app/layouts/desktop_layout.ts b/src/public/app/layouts/desktop_layout.ts
index 6268a5c902..3113d3bfa5 100644
--- a/src/public/app/layouts/desktop_layout.ts
+++ b/src/public/app/layouts/desktop_layout.ts
@@ -256,7 +256,6 @@ export default class DesktopLayout {
.child(new PasswordNoteSetDialog())
.child(new UploadAttachmentsDialog())
- .child(new RevisionsDialog())
.child(new DeleteNotesDialog())
.child(new InfoDialog())
diff --git a/src/public/app/layouts/layout_commons.ts b/src/public/app/layouts/layout_commons.ts
index c21ac09a91..d34c847a9c 100644
--- a/src/public/app/layouts/layout_commons.ts
+++ b/src/public/app/layouts/layout_commons.ts
@@ -18,6 +18,7 @@ import ExportDialog from "../widgets/dialogs/export.js";
import MarkdownImportDialog from "../widgets/dialogs/markdown_import.js";
import ProtectedSessionPasswordDialog from "../widgets/dialogs/protected_session_password.js";
import ConfirmDialog from "../widgets/dialogs/confirm.js";
+import RevisionsDialog from "../widgets/dialogs/revisions.js";
export function applyModals(rootContainer: RootContainer) {
rootContainer
@@ -37,7 +38,7 @@ export function applyModals(rootContainer: RootContainer) {
.child(new ExportDialog())
.child(new MarkdownImportDialog())
.child(new ProtectedSessionPasswordDialog())
- // .child(new RevisionsDialog())
+ .child(new RevisionsDialog())
// .child(new DeleteNotesDialog())
// .child(new InfoDialog())
.child(new ConfirmDialog())
diff --git a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts
index 1a72e5a425..434737641a 100644
--- a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts
+++ b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.ts
@@ -24,12 +24,14 @@ class MobileDetailMenuWidget extends BasicWidget {
this.$widget.on("click", async (e) => {
const note = appContext.tabManager.getActiveContextNote();
- contextMenu.show({
+ contextMenu.show<"insertChildNote" | "delete" | "showRevisions">({
x: e.pageX,
y: e.pageY,
items: [
{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus", enabled: note?.type !== "search" },
- { title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash", enabled: note?.noteId !== "root" }
+ { title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash", enabled: note?.noteId !== "root" },
+ { title: "----" },
+ { title: "Note revisions", command: "showRevisions", uiIcon: "bx bx-history" }
],
selectMenuItemHandler: async ({ command }) => {
if (command === "insertChildNote") {
@@ -49,8 +51,8 @@ class MobileDetailMenuWidget extends BasicWidget {
if (await branchService.deleteNotes([branchId])) {
this.triggerCommand("setActiveScreen", { screen: "tree" });
}
- } else {
- throw new Error(t("mobile_detail_menu.error_unrecognized_command", { command }));
+ } else if (command) {
+ this.triggerCommand(command);
}
},
forcePositionOnMobile: true
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index f9c6bdec59..daaf9cf381 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -1430,6 +1430,34 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {
position: static !important;
border: 0 !important;
border-radius: 0 !important;
+ font-size: 1rem !important;
+ }
+
+ body.mobile .revisions-dialog .modal-dialog {
+ height: 95vh;
+ }
+
+ body.mobile .revisions-dialog .modal-body {
+ height: 100% !important;
+ flex-direction: column;
+ padding: 0;
+ }
+
+ body.mobile .revisions-dialog .revision-list {
+ height: unset;
+ max-height: 20vh;
+ border-bottom: 1px solid var(--main-border-color) !important;
+ padding: 0 1em;
+ }
+
+ body.mobile .revisions-dialog .modal-body > .revision-content-wrapper {
+ flex-grow: 1;
+ height: 100%;
+ overflow: auto;
+ }
+
+ body.mobile .revisions-dialog .modal-body > .revision-content-wrapper > div:first-of-type {
+ flex-direction: column;
}
}