diff --git a/apps/client/package.json b/apps/client/package.json index 96d511652..52a7f7dc1 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -43,7 +43,7 @@ "debounce": "3.0.0", "draggabilly": "3.0.0", "force-graph": "1.51.0", - "globals": "16.5.0", + "globals": "17.0.0", "i18next": "25.7.3", "i18next-http-backend": "3.0.2", "jquery": "3.7.1", @@ -60,7 +60,7 @@ "normalize.css": "8.0.1", "panzoom": "9.4.3", "preact": "10.28.1", - "react-i18next": "16.5.0", + "react-i18next": "16.5.1", "react-window": "2.2.3", "reveal.js": "5.2.1", "svg-pan-zoom": "3.6.2", diff --git a/apps/client/src/widgets/buttons/right_pane_toggle.tsx b/apps/client/src/widgets/buttons/right_pane_toggle.tsx index 53bf67ae2..6a31d633c 100644 --- a/apps/client/src/widgets/buttons/right_pane_toggle.tsx +++ b/apps/client/src/widgets/buttons/right_pane_toggle.tsx @@ -1,11 +1,17 @@ import clsx from "clsx"; import { t } from "../../services/i18n"; +import options from "../../services/options"; import ActionButton from "../react/ActionButton"; -import { useTriliumOptionBool } from "../react/hooks"; +import { useState, useCallback } from "preact/hooks"; +import { useTriliumEvent } from "../react/hooks"; export default function RightPaneToggle() { - const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible"); + const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible")); + + useTriliumEvent("toggleRightPane", useCallback(() => { + setRightPaneVisible(current => !current); + }, [])); return ( setRightPaneVisible(!rightPaneVisible)} + triggerCommand="toggleRightPane" /> ); } diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx index 8356e0bd7..d28887b9f 100644 --- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx +++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx @@ -3,7 +3,7 @@ import "./RightPanelContainer.css"; import Split from "@triliumnext/split.js"; import { VNode } from "preact"; -import { useEffect, useRef } from "preact/hooks"; +import { useState, useEffect, useRef, useCallback } from "preact/hooks"; import appContext from "../../components/app_context"; import { WidgetsByParent } from "../../services/bundle"; @@ -11,7 +11,7 @@ import { t } from "../../services/i18n"; import options from "../../services/options"; import { DEFAULT_GUTTER_SIZE } from "../../services/resizer"; import Button from "../react/Button"; -import { useActiveNoteContext, useLegacyWidget, useNoteProperty, useTriliumEvent, useTriliumOptionBool, useTriliumOptionJson } from "../react/hooks"; +import { useActiveNoteContext, useLegacyWidget, useNoteProperty, useTriliumEvent, useTriliumOptionJson } from "../react/hooks"; import Icon from "../react/Icon"; import LegacyRightPanelWidget from "../right_panel_widget"; import HighlightsList from "./HighlightsList"; @@ -30,12 +30,16 @@ interface RightPanelWidgetDefinition { } export default function RightPanelContainer({ widgetsByParent }: { widgetsByParent: WidgetsByParent }) { - const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible"); + const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible")); const items = useItems(rightPaneVisible, widgetsByParent); useSplit(rightPaneVisible); - useTriliumEvent("toggleRightPane", () => { - setRightPaneVisible(!rightPaneVisible); - }); + useTriliumEvent("toggleRightPane", useCallback(() => { + setRightPaneVisible(current => { + const newValue = !current; + options.save("rightPaneVisible", newValue.toString()); + return newValue; + }); + }, [])); return (
@@ -48,7 +52,7 @@ export default function RightPanelContainer({ widgetsByParent }: { widgetsByPare {t("right_pane.empty_message")}
) diff --git a/apps/website/package.json b/apps/website/package.json index 2961396d3..c0b93ac6b 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -13,8 +13,8 @@ "i18next-http-backend": "3.0.2", "preact": "10.28.1", "preact-iso": "2.11.1", - "preact-render-to-string": "6.6.4", - "react-i18next": "16.5.0" + "preact-render-to-string": "6.6.5", + "react-i18next": "16.5.1" }, "devDependencies": { "@preact/preset-vite": "2.10.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7b228540a..51ebb0922 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -239,8 +239,8 @@ importers: specifier: 1.51.0 version: 1.51.0 globals: - specifier: 16.5.0 - version: 16.5.0 + specifier: 17.0.0 + version: 17.0.0 i18next: specifier: 25.7.3 version: 25.7.3(typescript@5.9.3) @@ -290,8 +290,8 @@ importers: specifier: 10.28.1 version: 10.28.1 react-i18next: - specifier: 16.5.0 - version: 16.5.0(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3) + specifier: 16.5.1 + version: 16.5.1(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3) react-window: specifier: 2.2.3 version: 2.2.3(react-dom@19.2.3(react@19.2.3))(react@19.2.3) @@ -824,13 +824,13 @@ importers: version: 10.28.1 preact-iso: specifier: 2.11.1 - version: 2.11.1(preact-render-to-string@6.6.4(preact@10.28.1))(preact@10.28.1) + version: 2.11.1(preact-render-to-string@6.6.5(preact@10.28.1))(preact@10.28.1) preact-render-to-string: - specifier: 6.6.4 - version: 6.6.4(preact@10.28.1) + specifier: 6.6.5 + version: 6.6.5(preact@10.28.1) react-i18next: - specifier: 16.5.0 - version: 16.5.0(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3) + specifier: 16.5.1 + version: 16.5.1(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3) devDependencies: '@preact/preset-vite': specifier: 2.10.2 @@ -8870,6 +8870,10 @@ packages: resolution: {integrity: sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==} engines: {node: '>=18'} + globals@17.0.0: + resolution: {integrity: sha512-gv5BeD2EssA793rlFWVPMMCqefTlpusw6/2TbAVMy0FzcG8wKJn4O+NqJ4+XWmmwrayJgw5TzrmWjFgmz1XPqw==} + engines: {node: '>=18'} + globalthis@1.0.4: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} @@ -11862,8 +11866,8 @@ packages: preact: 10.28.1 preact-render-to-string: '>=6.4.0' - preact-render-to-string@6.6.4: - resolution: {integrity: sha512-Bn6eQZ5SQ5loVEcC/mZmKT7HzO5Z/+vYzxfE/W2N468oSoNMJVdFGApF0GyXq0lDthuyXKTmtZ8k20NpYjr6Rw==} + preact-render-to-string@6.6.5: + resolution: {integrity: sha512-O6MHzYNIKYaiSX3bOw0gGZfEbOmlIDtDfWwN1JJdc/T3ihzRT6tGGSEWE088dWrEDGa1u7101q+6fzQnO9XCPA==} peerDependencies: preact: 10.28.1 @@ -12061,8 +12065,8 @@ packages: peerDependencies: react: ^19.2.3 - react-i18next@16.5.0: - resolution: {integrity: sha512-IMpPTyCTKxEj8klCrLKUTIUa8uYTd851+jcu2fJuUB9Agkk9Qq8asw4omyeHVnOXHrLgQJGTm5zTvn8HpaPiqw==} + react-i18next@16.5.1: + resolution: {integrity: sha512-Hks6UIRZWW4c+qDAnx1csVsCGYeIR4MoBGQgJ+NUoNnO6qLxXuf8zu0xdcinyXUORgGzCdRsexxO1Xzv3sTdnw==} peerDependencies: i18next: '>= 25.6.2' react: '>= 16.8.0' @@ -15357,6 +15361,8 @@ snapshots: '@ckeditor/ckeditor5-core': 47.3.0 '@ckeditor/ckeditor5-utils': 47.3.0 ckeditor5: 47.3.0 + transitivePeerDependencies: + - supports-color '@ckeditor/ckeditor5-code-block@47.3.0(patch_hash=2361d8caad7d6b5bddacc3a3b4aa37dbfba260b1c1b22a450413a79c1bb1ce95)': dependencies: @@ -15558,6 +15564,8 @@ snapshots: '@ckeditor/ckeditor5-utils': 47.3.0 ckeditor5: 47.3.0 es-toolkit: 1.39.5 + transitivePeerDependencies: + - supports-color '@ckeditor/ckeditor5-editor-decoupled@47.3.0': dependencies: @@ -16087,6 +16095,8 @@ snapshots: '@ckeditor/ckeditor5-ui': 47.3.0 '@ckeditor/ckeditor5-utils': 47.3.0 ckeditor5: 47.3.0 + transitivePeerDependencies: + - supports-color '@ckeditor/ckeditor5-restricted-editing@47.3.0': dependencies: @@ -24707,6 +24717,8 @@ snapshots: globals@16.5.0: {} + globals@17.0.0: {} + globalthis@1.0.4: dependencies: define-properties: 1.2.1 @@ -28158,12 +28170,12 @@ snapshots: potpack@2.1.0: {} - preact-iso@2.11.1(preact-render-to-string@6.6.4(preact@10.28.1))(preact@10.28.1): + preact-iso@2.11.1(preact-render-to-string@6.6.5(preact@10.28.1))(preact@10.28.1): dependencies: preact: 10.28.1 - preact-render-to-string: 6.6.4(preact@10.28.1) + preact-render-to-string: 6.6.5(preact@10.28.1) - preact-render-to-string@6.6.4(preact@10.28.1): + preact-render-to-string@6.6.5(preact@10.28.1): dependencies: preact: 10.28.1 @@ -28376,7 +28388,7 @@ snapshots: react: 19.2.3 scheduler: 0.27.0 - react-i18next@16.5.0(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3): + react-i18next@16.5.1(i18next@25.7.3(typescript@5.9.3))(react-dom@19.2.3(react@19.2.3))(react@19.2.3)(typescript@5.9.3): dependencies: '@babel/runtime': 7.28.4 html-parse-stringify: 3.0.1