mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
			feat/impro
			...
			feat/ui-op
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 0a9c0234e2 | ||
|  | 3e3cc8c541 | ||
|  | d1538508e8 | ||
|  | 9b1da8c311 | ||
|  | e4a8258acf | ||
|  | 5e88043c7b | ||
|  | bedf9112fb | ||
|  | 03681d23c5 | 
| @@ -28,6 +28,14 @@ | |||||||
|     --ck-mention-list-max-height: 500px; |     --ck-mention-list-max-height: 500px; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | body#trilium-app.motion-disabled *, | ||||||
|  | body#trilium-app.motion-disabled *::before, | ||||||
|  | body#trilium-app.motion-disabled *::after { | ||||||
|  |     /* Disable transitions and animations */ | ||||||
|  |     transition: none !important; | ||||||
|  |     animation: none !important; | ||||||
|  | } | ||||||
|  |  | ||||||
| .table { | .table { | ||||||
|     --bs-table-bg: transparent !important; |     --bs-table-bg: transparent !important; | ||||||
| } | } | ||||||
| @@ -355,7 +363,7 @@ body.desktop .tabulator-popup-container { | |||||||
|  |  | ||||||
| @supports (animation-fill-mode: forwards) { | @supports (animation-fill-mode: forwards) { | ||||||
|     /* Delay the opening of submenus */ |     /* Delay the opening of submenus */ | ||||||
|     body.desktop .dropdown-submenu .dropdown-menu { |     body.desktop:not(.motion-disabled) .dropdown-submenu .dropdown-menu { | ||||||
|         opacity: 0; |         opacity: 0; | ||||||
|         animation-fill-mode: forwards; |         animation-fill-mode: forwards; | ||||||
|         animation-delay: var(--submenu-opening-delay); |         animation-delay: var(--submenu-opening-delay); | ||||||
|   | |||||||
| @@ -1113,6 +1113,10 @@ | |||||||
|     "layout-vertical-description": "launcher bar is on the left (default)", |     "layout-vertical-description": "launcher bar is on the left (default)", | ||||||
|     "layout-horizontal-description": "launcher bar is underneath the tab bar, the tab bar is now full width." |     "layout-horizontal-description": "launcher bar is underneath the tab bar, the tab bar is now full width." | ||||||
|   }, |   }, | ||||||
|  |   "ui-performance": { | ||||||
|  |     "title": "Performance", | ||||||
|  |     "enable-motion": "Enable transitions and animations" | ||||||
|  |   }, | ||||||
|   "ai_llm": { |   "ai_llm": { | ||||||
|     "not_started": "Not started", |     "not_started": "Not started", | ||||||
|     "title": "AI Settings", |     "title": "AI Settings", | ||||||
|   | |||||||
| @@ -1,6 +1,8 @@ | |||||||
| import utils from "../../services/utils.js"; | import { EventData } from "../../components/app_context.js"; | ||||||
| import type BasicWidget from "../basic_widget.js"; |  | ||||||
| import FlexContainer from "./flex_container.js"; | import FlexContainer from "./flex_container.js"; | ||||||
|  | import options from "../../services/options.js"; | ||||||
|  | import type BasicWidget from "../basic_widget.js"; | ||||||
|  | import utils from "../../services/utils.js"; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The root container is the top-most widget/container, from which the entire layout derives. |  * The root container is the top-most widget/container, from which the entire layout derives. | ||||||
| @@ -20,6 +22,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> { | |||||||
|         this.id("root-widget"); |         this.id("root-widget"); | ||||||
|         this.css("height", "100dvh"); |         this.css("height", "100dvh"); | ||||||
|         this.originalViewportHeight = getViewportHeight(); |         this.originalViewportHeight = getViewportHeight(); | ||||||
|  |          | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     render(): JQuery<HTMLElement> { |     render(): JQuery<HTMLElement> { | ||||||
| @@ -27,15 +30,27 @@ export default class RootContainer extends FlexContainer<BasicWidget> { | |||||||
|             window.visualViewport?.addEventListener("resize", () => this.#onMobileResize()); |             window.visualViewport?.addEventListener("resize", () => this.#onMobileResize()); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         this.#setMotion(options.is("motionEnabled")); | ||||||
|  |  | ||||||
|         return super.render(); |         return super.render(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { | ||||||
|  |         if (loadResults.isOptionReloaded("motionEnabled")) { | ||||||
|  |             this.#setMotion(options.is("motionEnabled")); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     #onMobileResize() { |     #onMobileResize() { | ||||||
|         const currentViewportHeight = getViewportHeight(); |         const currentViewportHeight = getViewportHeight(); | ||||||
|         const isKeyboardOpened = (currentViewportHeight < this.originalViewportHeight); |         const isKeyboardOpened = (currentViewportHeight < this.originalViewportHeight); | ||||||
|         this.$widget.toggleClass("virtual-keyboard-opened", isKeyboardOpened); |         this.$widget.toggleClass("virtual-keyboard-opened", isKeyboardOpened); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     #setMotion(enabled: boolean) { | ||||||
|  |         document.body.classList.toggle("motion-disabled", !enabled); | ||||||
|  |         jQuery.fx.off = !enabled; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function getViewportHeight() { | function getViewportHeight() { | ||||||
|   | |||||||
| @@ -88,6 +88,7 @@ export default function AppearanceSettings() { | |||||||
|             <ApplicationTheme /> |             <ApplicationTheme /> | ||||||
|             {overrideThemeFonts === "true" && <Fonts />} |             {overrideThemeFonts === "true" && <Fonts />} | ||||||
|             {isElectron() && <ElectronIntegration /> } |             {isElectron() && <ElectronIntegration /> } | ||||||
|  |             <Performance /> | ||||||
|             <MaxContentWidth /> |             <MaxContentWidth /> | ||||||
|             <RelatedSettings items={[ |             <RelatedSettings items={[ | ||||||
|                 { |                 { | ||||||
| @@ -245,6 +246,20 @@ function ElectronIntegration() { | |||||||
|     ) |     ) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function Performance() { | ||||||
|  |     const [ motionEnabled, setMotionEnabled ] = useTriliumOptionBool("motionEnabled"); | ||||||
|  |  | ||||||
|  |     return <OptionsSection title={t("ui-performance.title")}> | ||||||
|  |         <FormGroup name="motion-enabled"> | ||||||
|  |                 <FormCheckbox | ||||||
|  |                     label={t("ui-performance.enable-motion")} | ||||||
|  |                     currentValue={motionEnabled} onChange={setMotionEnabled} | ||||||
|  |                 /> | ||||||
|  |         </FormGroup> | ||||||
|  |     </OptionsSection> | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
| function MaxContentWidth() { | function MaxContentWidth() { | ||||||
|     const [ maxContentWidth, setMaxContentWidth ] = useTriliumOption("maxContentWidth"); |     const [ maxContentWidth, setMaxContentWidth ] = useTriliumOption("maxContentWidth"); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
|     <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> |     <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> | ||||||
|     <title>Trilium Notes</title> |     <title>Trilium Notes</title> | ||||||
| </head> | </head> | ||||||
| <body class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"> | <body id="trilium-app" class="desktop heading-style-<%= headingStyle %> layout-<%= layoutOrientation %> platform-<%= platform %> <%= isElectron ? 'electron' : '' %> <%= hasNativeTitleBar ? 'native-titlebar' : '' %> <%= hasBackgroundEffects ? 'background-effects' : '' %>"> | ||||||
| <noscript><%= t("javascript-required") %></noscript> | <noscript><%= t("javascript-required") %></noscript> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   | |||||||
| @@ -63,6 +63,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([ | |||||||
|     "dailyBackupEnabled", |     "dailyBackupEnabled", | ||||||
|     "weeklyBackupEnabled", |     "weeklyBackupEnabled", | ||||||
|     "monthlyBackupEnabled", |     "monthlyBackupEnabled", | ||||||
|  |     "motionEnabled", | ||||||
|     "maxContentWidth", |     "maxContentWidth", | ||||||
|     "compressImages", |     "compressImages", | ||||||
|     "downloadImagesAutomatically", |     "downloadImagesAutomatically", | ||||||
|   | |||||||
| @@ -152,6 +152,7 @@ const defaultOptions: DefaultOption[] = [ | |||||||
|         }, |         }, | ||||||
|         isSynced: false |         isSynced: false | ||||||
|     }, |     }, | ||||||
|  |     { name: "motionEnabled", value: "true", isSynced: false }, | ||||||
|  |  | ||||||
|     // Internationalization |     // Internationalization | ||||||
|     { name: "locale", value: "en", isSynced: true }, |     { name: "locale", value: "en", isSynced: true }, | ||||||
|   | |||||||
| @@ -93,6 +93,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi | |||||||
|  |  | ||||||
|     // Appearance |     // Appearance | ||||||
|     splitEditorOrientation: "horziontal" | "vertical"; |     splitEditorOrientation: "horziontal" | "vertical"; | ||||||
|  |     motionEnabled: boolean; | ||||||
|     codeNoteTheme: string; |     codeNoteTheme: string; | ||||||
|  |  | ||||||
|     initialized: boolean; |     initialized: boolean; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user