Notes/src/public/app/layouts/desktop_layout.js

231 lines
14 KiB
JavaScript
Raw Normal View History

import FlexContainer from "../widgets/containers/flex_container.js";
2021-05-24 22:29:49 +02:00
import GlobalMenuWidget from "../widgets/buttons/global_menu.js";
2020-04-25 23:52:13 +02:00
import TabRowWidget from "../widgets/tab_row.js";
import TitleBarButtonsWidget from "../widgets/title_bar_buttons.js";
import LeftPaneContainer from "../widgets/containers/left_pane_container.js";
2020-04-25 23:52:13 +02:00
import NoteTreeWidget from "../widgets/note_tree.js";
import NoteTitleWidget from "../widgets/note_title.js";
import OwnedAttributeListWidget from "../widgets/ribbon_widgets/owned_attribute_list.js";
2021-05-24 22:29:49 +02:00
import NoteActionsWidget from "../widgets/buttons/note_actions.js";
2020-04-25 23:52:13 +02:00
import NoteDetailWidget from "../widgets/note_detail.js";
import RibbonContainer from "../widgets/containers/ribbon_container.js";
import PromotedAttributesWidget from "../widgets/ribbon_widgets/promoted_attributes.js";
import InheritedAttributesWidget from "../widgets/ribbon_widgets/inherited_attribute_list.js";
import NoteListWidget from "../widgets/note_list.js";
import SearchDefinitionWidget from "../widgets/ribbon_widgets/search_definition.js";
import SqlResultWidget from "../widgets/sql_result.js";
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
import FilePropertiesWidget from "../widgets/ribbon_widgets/file_properties.js";
import ImagePropertiesWidget from "../widgets/ribbon_widgets/image_properties.js";
import NotePropertiesWidget from "../widgets/ribbon_widgets/note_properties.js";
2021-02-13 20:07:08 +01:00
import NoteIconWidget from "../widgets/note_icon.js";
import SearchResultWidget from "../widgets/search_result.js";
import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import RootContainer from "../widgets/containers/root_container.js";
2023-05-03 10:23:20 +02:00
import WatchedFileUpdateStatusWidget from "../widgets/watched_file_update_status.js";
2021-05-17 21:46:18 +02:00
import SpacerWidget from "../widgets/spacer.js";
import QuickSearchWidget from "../widgets/quick_search.js";
import SplitNoteContainer from "../widgets/containers/split_note_container.js";
import LeftPaneToggleWidget from "../widgets/buttons/left_pane_toggle.js";
2021-05-24 22:29:49 +02:00
import CreatePaneButton from "../widgets/buttons/create_pane_button.js";
import ClosePaneButton from "../widgets/buttons/close_pane_button.js";
import BasicPropertiesWidget from "../widgets/ribbon_widgets/basic_properties.js";
import NoteInfoWidget from "../widgets/ribbon_widgets/note_info_widget.js";
import BookPropertiesWidget from "../widgets/ribbon_widgets/book_properties.js";
import NoteMapRibbonWidget from "../widgets/ribbon_widgets/note_map.js";
import NotePathsWidget from "../widgets/ribbon_widgets/note_paths.js";
import SimilarNotesWidget from "../widgets/ribbon_widgets/similar_notes.js";
import RightPaneContainer from "../widgets/containers/right_pane_container.js";
import EditButton from "../widgets/buttons/edit_button.js";
2021-07-05 14:56:40 +02:00
import EditedNotesWidget from "../widgets/ribbon_widgets/edited_notes.js";
import ShowTocWidgetButton from "../widgets/buttons/show_toc_widget_button.js";
import ShowHighlightsListWidgetButton from "../widgets/buttons/show_highlights_list_widget_button.js";
2021-09-29 22:10:15 +02:00
import MermaidWidget from "../widgets/mermaid.js";
import NoteWrapperWidget from "../widgets/note_wrapper.js";
import BacklinksWidget from "../widgets/floating_buttons/zpetne_odkazy.js";
2021-12-20 17:30:47 +01:00
import SharedInfoWidget from "../widgets/shared_info.js";
import FindWidget from "../widgets/find.js";
2022-05-29 21:44:26 +02:00
import TocWidget from "../widgets/toc.js";
2023-06-04 17:46:37 +02:00
import HighlightsListWidget from "../widgets/highlights_list.js";
2022-06-11 23:29:52 +02:00
import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js";
2022-06-12 14:03:59 +02:00
import AboutDialog from "../widgets/dialogs/about.js";
2022-06-13 00:00:15 +02:00
import HelpDialog from "../widgets/dialogs/help.js";
import RecentChangesDialog from "../widgets/dialogs/recent_changes.js";
import BranchPrefixDialog from "../widgets/dialogs/branch_prefix.js";
import SortChildNotesDialog from "../widgets/dialogs/sort_child_notes.js";
import PasswordNoteSetDialog from "../widgets/dialogs/password_not_set.js";
import IncludeNoteDialog from "../widgets/dialogs/include_note.js";
import NoteTypeChooserDialog from "../widgets/dialogs/note_type_chooser.js";
import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js";
import AddLinkDialog from "../widgets/dialogs/add_link.js";
import CloneToDialog from "../widgets/dialogs/clone_to.js";
import MoveToDialog from "../widgets/dialogs/move_to.js";
2022-06-16 14:21:24 +02:00
import ImportDialog from "../widgets/dialogs/import.js";
2022-06-16 15:04:57 +02:00
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 RevisionsDialog from "../widgets/dialogs/revisions.js";
import DeleteNotesDialog from "../widgets/dialogs/delete_notes.js";
2022-06-16 19:53:33 +02:00
import InfoDialog from "../widgets/dialogs/info.js";
import ConfirmDialog from "../widgets/dialogs/confirm.js";
2022-06-16 21:13:09 +02:00
import PromptDialog from "../widgets/dialogs/prompt.js";
2022-06-21 23:27:34 +02:00
import FloatingButtons from "../widgets/floating_buttons/floating_buttons.js";
import RelationMapButtons from "../widgets/floating_buttons/relation_map_buttons.js";
import SvgExportButton from "../widgets/floating_buttons/svg_export_button.js";
2022-12-01 10:16:57 +01:00
import LauncherContainer from "../widgets/containers/launcher_container.js";
import RevisionsButton from "../widgets/buttons/revisions_button.js";
import CodeButtonsWidget from "../widgets/floating_buttons/code_buttons.js";
2022-09-17 23:06:17 +02:00
import ApiLogWidget from "../widgets/api_log.js";
import HideFloatingButtonsButton from "../widgets/floating_buttons/hide_floating_buttons_button.js";
import ScriptExecutorWidget from "../widgets/ribbon_widgets/script_executor.js";
2023-05-30 02:24:56 +08:00
import MovePaneButton from "../widgets/buttons/move_pane_button.js";
2023-05-09 00:05:27 +02:00
import UploadAttachmentsDialog from "../widgets/dialogs/upload_attachments.js";
import CopyImageReferenceButton from "../widgets/floating_buttons/copy_image_reference_button.js";
import ScrollPaddingWidget from "../widgets/scroll_padding.js";
2024-11-09 09:18:59 +02:00
import ClassicEditorToolbar from "../widgets/ribbon_widgets/classic_editor_toolbar.js";
2020-02-06 21:47:31 +01:00
export default class DesktopLayout {
2020-03-16 21:16:09 +01:00
constructor(customWidgets) {
this.customWidgets = customWidgets;
}
2020-02-06 21:47:31 +01:00
getRootWidget(appContext) {
2022-12-11 13:54:12 +01:00
appContext.noteTreeWidget = new NoteTreeWidget();
const launcherPaneIsHorizontal = true;
const launcherPane = new FlexContainer("column")
.id("launcher-pane")
.css("width", "53px")
.child(new GlobalMenuWidget())
.child(new LauncherContainer())
.child(new LeftPaneToggleWidget());
return new RootContainer()
2020-02-27 12:26:42 +01:00
.setParent(appContext)
.optChild(!launcherPaneIsHorizontal, launcherPane)
.child(new LeftPaneContainer()
2021-05-17 21:46:18 +02:00
.child(new QuickSearchWidget())
2022-12-11 13:54:12 +01:00
.child(appContext.noteTreeWidget)
.child(...this.customWidgets.get('left-pane'))
2021-05-17 21:46:18 +02:00
)
.child(new FlexContainer('column')
.id('rest-pane')
2021-05-17 21:46:18 +02:00
.css("flex-grow", "1")
2021-06-05 22:07:15 +02:00
.child(new FlexContainer('row')
2021-05-18 22:14:35 +02:00
.child(new TabRowWidget())
2021-05-17 21:46:18 +02:00
.child(new TitleBarButtonsWidget())
2021-05-23 21:24:22 +02:00
.css('height', '40px')
2020-02-27 10:03:14 +01:00
)
.child(new FlexContainer('row')
.filling()
2021-06-13 22:55:31 +02:00
.collapsible()
.child(new FlexContainer('column')
.filling()
2021-06-13 22:55:31 +02:00
.collapsible()
.id('center-pane')
.child(new SplitNoteContainer(() =>
2022-08-06 23:49:25 +02:00
new NoteWrapperWidget()
.child(new FlexContainer('row').class('title-row')
.css("height", "50px")
.css("min-height", "50px")
2022-08-06 23:49:25 +02:00
.css('align-items', "center")
.cssBlock('.title-row > * { margin: 5px; }')
.child(new NoteIconWidget())
.child(new NoteTitleWidget())
.child(new SpacerWidget(0, 1))
2023-05-30 02:24:56 +08:00
.child(new MovePaneButton(true))
.child(new MovePaneButton(false))
2022-08-06 23:49:25 +02:00
.child(new ClosePaneButton())
.child(new CreatePaneButton())
)
.child(
new RibbonContainer()
2023-05-05 23:41:11 +02:00
// the order of the widgets matter. Some of these want to "activate" themselves
// when visible. When this happens to multiple of them, the first one "wins".
// promoted attributes should always win.
2024-11-09 09:18:59 +02:00
.ribbon(new ClassicEditorToolbar())
.ribbon(new PromotedAttributesWidget())
.ribbon(new ScriptExecutorWidget())
2022-08-06 23:49:25 +02:00
.ribbon(new SearchDefinitionWidget())
.ribbon(new EditedNotesWidget())
.ribbon(new BookPropertiesWidget())
.ribbon(new NotePropertiesWidget())
.ribbon(new FilePropertiesWidget())
.ribbon(new ImagePropertiesWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new OwnedAttributeListWidget())
.ribbon(new InheritedAttributesWidget())
.ribbon(new NotePathsWidget())
.ribbon(new NoteMapRibbonWidget())
.ribbon(new SimilarNotesWidget())
.ribbon(new NoteInfoWidget())
.button(new RevisionsButton())
2022-08-06 23:49:25 +02:00
.button(new NoteActionsWidget())
)
.child(new SharedInfoWidget())
2023-05-03 10:23:20 +02:00
.child(new WatchedFileUpdateStatusWidget())
2022-08-06 23:49:25 +02:00
.child(new FloatingButtons()
2022-12-11 13:20:37 +01:00
.child(new EditButton())
.child(new ShowTocWidgetButton())
.child(new ShowHighlightsListWidgetButton())
.child(new CodeButtonsWidget())
2022-08-06 23:49:25 +02:00
.child(new RelationMapButtons())
.child(new CopyImageReferenceButton())
.child(new SvgExportButton())
2022-08-06 23:49:25 +02:00
.child(new BacklinksWidget())
.child(new HideFloatingButtonsButton())
2022-08-06 23:49:25 +02:00
)
.child(new MermaidWidget())
.child(
new ScrollingContainer()
.filling()
.child(new SqlTableSchemasWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget())
.child(new SearchResultWidget())
.child(new SqlResultWidget())
.child(new ScrollPaddingWidget())
2022-08-06 23:49:25 +02:00
)
.child(new ApiLogWidget())
2022-08-06 23:49:25 +02:00
.child(new FindWidget())
.child(
...this.customWidgets.get('node-detail-pane'), // typo, let's keep it for a while as BC
...this.customWidgets.get('note-detail-pane')
)
)
2021-05-19 22:45:34 +02:00
)
2021-06-05 23:35:47 +02:00
.child(...this.customWidgets.get('center-pane'))
)
.child(new RightPaneContainer()
2022-05-29 21:44:26 +02:00
.child(new TocWidget())
2023-06-04 17:46:37 +02:00
.child(new HighlightsListWidget())
.child(...this.customWidgets.get('right-pane'))
2020-12-27 22:19:27 +01:00
)
2020-02-27 10:03:14 +01:00
)
2022-06-11 23:29:52 +02:00
)
2022-06-12 14:03:59 +02:00
.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())
2022-06-16 14:21:24 +02:00
.child(new MoveToDialog())
2022-06-16 15:04:57 +02:00
.child(new ImportDialog())
.child(new ExportDialog())
2023-05-09 00:05:27 +02:00
.child(new UploadAttachmentsDialog())
.child(new MarkdownImportDialog())
.child(new ProtectedSessionPasswordDialog())
.child(new RevisionsDialog())
2022-06-16 19:53:33 +02:00
.child(new DeleteNotesDialog())
.child(new InfoDialog())
2022-06-16 21:13:09 +02:00
.child(new ConfirmDialog())
2022-12-06 17:05:21 +01:00
.child(new PromptDialog());
2020-02-06 21:47:31 +01:00
}
2020-05-12 12:45:32 +02:00
}