mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 07:38:53 +02:00
refactor(mobile): use shared modal configuration with desktop
This commit is contained in:
parent
a8f1abb77f
commit
bbd76069c1
@ -93,6 +93,7 @@ import SwitchSplitOrientationButton from "../widgets/floating_buttons/switch_lay
|
|||||||
import ToggleReadOnlyButton from "../widgets/floating_buttons/toggle_read_only_button.js";
|
import ToggleReadOnlyButton from "../widgets/floating_buttons/toggle_read_only_button.js";
|
||||||
import PngExportButton from "../widgets/floating_buttons/png_export_button.js";
|
import PngExportButton from "../widgets/floating_buttons/png_export_button.js";
|
||||||
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
|
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
|
||||||
|
import { applyModals } from "./layout_commons.js";
|
||||||
|
|
||||||
export default class DesktopLayout {
|
export default class DesktopLayout {
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ export default class DesktopLayout {
|
|||||||
const fullWidthTabBar = launcherPaneIsHorizontal || (isElectron && !hasNativeTitleBar && isMac);
|
const fullWidthTabBar = launcherPaneIsHorizontal || (isElectron && !hasNativeTitleBar && isMac);
|
||||||
const customTitleBarButtons = !hasNativeTitleBar && !isMac && !isWindows;
|
const customTitleBarButtons = !hasNativeTitleBar && !isMac && !isWindows;
|
||||||
|
|
||||||
return new RootContainer(true)
|
const rootContainer = new RootContainer(true)
|
||||||
.setParent(appContext)
|
.setParent(appContext)
|
||||||
.optChild(
|
.optChild(
|
||||||
fullWidthTabBar,
|
fullWidthTabBar,
|
||||||
@ -251,17 +252,11 @@ export default class DesktopLayout {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.child(new BulkActionsDialog())
|
// Remove once modals are all merged
|
||||||
.child(new AboutDialog())
|
|
||||||
.child(new HelpDialog())
|
|
||||||
.child(new RecentChangesDialog())
|
|
||||||
.child(new BranchPrefixDialog())
|
.child(new BranchPrefixDialog())
|
||||||
.child(new SortChildNotesDialog())
|
.child(new SortChildNotesDialog())
|
||||||
.child(new PasswordNoteSetDialog())
|
.child(new PasswordNoteSetDialog())
|
||||||
.child(new IncludeNoteDialog())
|
|
||||||
.child(new NoteTypeChooserDialog())
|
.child(new NoteTypeChooserDialog())
|
||||||
.child(new JumpToNoteDialog())
|
|
||||||
.child(new AddLinkDialog())
|
|
||||||
.child(new CloneToDialog())
|
.child(new CloneToDialog())
|
||||||
.child(new MoveToDialog())
|
.child(new MoveToDialog())
|
||||||
.child(new ImportDialog())
|
.child(new ImportDialog())
|
||||||
@ -273,8 +268,11 @@ export default class DesktopLayout {
|
|||||||
.child(new DeleteNotesDialog())
|
.child(new DeleteNotesDialog())
|
||||||
.child(new InfoDialog())
|
.child(new InfoDialog())
|
||||||
.child(new ConfirmDialog())
|
.child(new ConfirmDialog())
|
||||||
.child(new PromptDialog())
|
|
||||||
.child(new CloseZenButton());
|
.child(new CloseZenButton());
|
||||||
|
|
||||||
|
applyModals(rootContainer);
|
||||||
|
return rootContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#buildLauncherPane(isHorizontal: boolean) {
|
#buildLauncherPane(isHorizontal: boolean) {
|
||||||
|
37
src/public/app/layouts/layout_commons.ts
Normal file
37
src/public/app/layouts/layout_commons.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import type RootContainer from "../widgets/containers/root_container.js";
|
||||||
|
|
||||||
|
import AboutDialog from "../widgets/dialogs/about.js";
|
||||||
|
import HelpDialog from "../widgets/dialogs/help.js";
|
||||||
|
import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";
|
||||||
|
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
|
||||||
|
import PromptDialog from "../widgets/dialogs/prompt.js";
|
||||||
|
import AddLinkDialog from "../widgets/dialogs/add_link.js";
|
||||||
|
import IncludeNoteDialog from "../widgets/dialogs/include_note.js";
|
||||||
|
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
|
||||||
|
|
||||||
|
export function applyModals(rootContainer: RootContainer) {
|
||||||
|
rootContainer
|
||||||
|
.child(new BulkActionsDialog())
|
||||||
|
.child(new AboutDialog())
|
||||||
|
.child(new HelpDialog())
|
||||||
|
.child(new RecentChangesDialog())
|
||||||
|
// .child(new BranchPrefixDialog())
|
||||||
|
// .child(new SortChildNotesDialog())
|
||||||
|
// .child(new PasswordNoteSetDialog())
|
||||||
|
.child(new IncludeNoteDialog())
|
||||||
|
// .child(new NoteTypeChooserDialog())
|
||||||
|
.child(new JumpToNoteDialog())
|
||||||
|
.child(new AddLinkDialog())
|
||||||
|
// .child(new CloneToDialog())
|
||||||
|
// .child(new MoveToDialog())
|
||||||
|
// .child(new ImportDialog())
|
||||||
|
// .child(new ExportDialog())
|
||||||
|
// .child(new UploadAttachmentsDialog())
|
||||||
|
// .child(new MarkdownImportDialog())
|
||||||
|
// .child(new ProtectedSessionPasswordDialog())
|
||||||
|
// .child(new RevisionsDialog())
|
||||||
|
// .child(new DeleteNotesDialog())
|
||||||
|
// .child(new InfoDialog())
|
||||||
|
// .child(new ConfirmDialog())
|
||||||
|
.child(new PromptDialog())
|
||||||
|
}
|
@ -23,18 +23,11 @@ import RootContainer from "../widgets/containers/root_container.js";
|
|||||||
import SharedInfoWidget from "../widgets/shared_info.js";
|
import SharedInfoWidget from "../widgets/shared_info.js";
|
||||||
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
|
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
|
||||||
import SidebarContainer from "../widgets/mobile_widgets/sidebar_container.js";
|
import SidebarContainer from "../widgets/mobile_widgets/sidebar_container.js";
|
||||||
import AboutDialog from "../widgets/dialogs/about.js";
|
|
||||||
import HelpDialog from "../widgets/dialogs/help.js";
|
|
||||||
import type AppContext from "../components/app_context.js";
|
import type AppContext from "../components/app_context.js";
|
||||||
import TabRowWidget from "../widgets/tab_row.js";
|
import TabRowWidget from "../widgets/tab_row.js";
|
||||||
import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";
|
|
||||||
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
|
|
||||||
import PromptDialog from "../widgets/dialogs/prompt.js";
|
|
||||||
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
|
import RefreshButton from "../widgets/floating_buttons/refresh_button.js";
|
||||||
import MobileEditorToolbar from "../widgets/ribbon_widgets/mobile_editor_toolbar.js";
|
import MobileEditorToolbar from "../widgets/ribbon_widgets/mobile_editor_toolbar.js";
|
||||||
import AddLinkDialog from "../widgets/dialogs/add_link.js";
|
import { applyModals } from "./layout_commons.js";
|
||||||
import IncludeNoteDialog from "../widgets/dialogs/include_note.js";
|
|
||||||
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
|
|
||||||
|
|
||||||
const MOBILE_CSS = `
|
const MOBILE_CSS = `
|
||||||
<style>
|
<style>
|
||||||
@ -123,7 +116,7 @@ span.fancytree-expander {
|
|||||||
|
|
||||||
export default class MobileLayout {
|
export default class MobileLayout {
|
||||||
getRootWidget(appContext: typeof AppContext) {
|
getRootWidget(appContext: typeof AppContext) {
|
||||||
return new RootContainer(true)
|
const rootContainer = new RootContainer(true)
|
||||||
.setParent(appContext)
|
.setParent(appContext)
|
||||||
.cssBlock(MOBILE_CSS)
|
.cssBlock(MOBILE_CSS)
|
||||||
.child(new FlexContainer("column").id("mobile-sidebar-container"))
|
.child(new FlexContainer("column").id("mobile-sidebar-container"))
|
||||||
@ -184,14 +177,8 @@ export default class MobileLayout {
|
|||||||
.id("mobile-bottom-bar")
|
.id("mobile-bottom-bar")
|
||||||
.child(new TabRowWidget().css("height", "40px"))
|
.child(new TabRowWidget().css("height", "40px"))
|
||||||
.child(new FlexContainer("row").class("horizontal").css("height", "53px").child(new LauncherContainer(true)).child(new GlobalMenuWidget(true)).id("launcher-pane"))
|
.child(new FlexContainer("row").class("horizontal").css("height", "53px").child(new LauncherContainer(true)).child(new GlobalMenuWidget(true)).id("launcher-pane"))
|
||||||
)
|
);
|
||||||
.child(new BulkActionsDialog())
|
applyModals(rootContainer);
|
||||||
.child(new AboutDialog())
|
return rootContainer;
|
||||||
.child(new HelpDialog())
|
|
||||||
.child(new RecentChangesDialog())
|
|
||||||
.child(new JumpToNoteDialog())
|
|
||||||
.child(new PromptDialog())
|
|
||||||
.child(new IncludeNoteDialog())
|
|
||||||
.child(new AddLinkDialog());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user