feat(mobile): add note revisions dialog

This commit is contained in:
Elian Doran 2025-04-12 10:31:53 +03:00
parent 69a5c90ada
commit 626191ad2f
No known key found for this signature in database
5 changed files with 37 additions and 7 deletions

View File

@ -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

View File

@ -256,7 +256,6 @@ export default class DesktopLayout {
.child(new PasswordNoteSetDialog())
.child(new UploadAttachmentsDialog())
.child(new RevisionsDialog())
.child(new DeleteNotesDialog())
.child(new InfoDialog())

View File

@ -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())

View File

@ -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

View File

@ -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;
}
}