mirror of
https://github.com/jsmorabito/obsidian-commander.git
synced 2026-07-22 06:40:31 +00:00
feat: add restore-default button to SliderComponent
Adds an optional defaultValue prop to SliderComponent; when set, a small reset icon (matching the existing "reset to default" pattern used for advanced-toolbar icons) appears next to the value and resets it back to that default on click. Wired up for the General tab's "custom spacing" slider using DEFAULT_SETTINGS.spacing so it stays in sync if the default ever changes. MacroBuilder's per-item Delay slider is unaffected (no defaultValue passed, so no button shows - there's no persistent default for a one-off macro action value). Adds the new "Restore default" string to locale/en.json plus the ten other filled locale files (untranslated, English placeholder) so the locale completeness test suite still passes.
This commit is contained in:
parent
5da385da2b
commit
15b3a52bb9
13 changed files with 33 additions and 2 deletions
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Skrýt",
|
||||
"Hide other Commands": "Skrýt ostatní příkazy",
|
||||
"Double click to enter custom value": "Dvakrát klikněte pro zadání vlastní hodnoty",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Vyberte vlastní odsazení pro tlačítka příkazů",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Změna odsazení mezi příkazy. Můžete nastavit různé hodnoty na mobilních a stolních zařízeních.",
|
||||
"Warning": "Varování",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Verstecken",
|
||||
"Hide other Commands": "Andere Befehle verstecken",
|
||||
"Double click to enter custom value": "Doppelklicken um eigenen Wert einzutragen",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Wähle den Abstand zwischen Befehlen",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Verändert den Abstand zwischen Befehlen.",
|
||||
"Warning": "Achtung",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Hide",
|
||||
"Hide other Commands": "Hide other Commands",
|
||||
"Double click to enter custom value": "Double click to enter custom value",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Choose custom spacing for Command Buttons",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Change the spacing between commands.",
|
||||
"Warning": "Warning",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Masquer",
|
||||
"Hide other Commands": "Masquer les autres commandes",
|
||||
"Double click to enter custom value": "Double-cliquez pour entrer une valeur personnalisée",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Choisissez un espacement personnalisé pour les boutons de commande",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Modifier l'espacement entre les commandes.",
|
||||
"Warning": "Avertissement",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Sakrij",
|
||||
"Hide other Commands": "Sakrij druge naredbe",
|
||||
"Double click to enter custom value": "Dvostruki klik za unos prilagođene vrijednosti",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Odaberi prilagođeni razmak za gumbe naredbi",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Promijeni razmak između naredbi.",
|
||||
"Warning": "Upozorenje",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Verberg",
|
||||
"Hide other Commands": "Verberg andere Commando's",
|
||||
"Double click to enter custom value": "Dubbel klik om een aangepaste waarde in te vullen",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Kies aangepaste regelafstand voor Commando Knoppen",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Verander regelafstand tussen Commando's. Dit kan verschillen tussen mobiel en dekstop.",
|
||||
"Warning": "Waarschuwing",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Спрятать",
|
||||
"Hide other Commands": "Спрятать другие команды",
|
||||
"Double click to enter custom value": "Дважды щелкните, чтобы ввести пользовательское значение",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Выберите пользовательский интервал между командными кнопками",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Измените расстояние между командами.",
|
||||
"Warning": "Предупреждение",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Dölj",
|
||||
"Hide other Commands": "Dölj andra kommandon",
|
||||
"Double click to enter custom value": "Dubbelklicka för att fylla i valfritt värde",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Välj valfri distans mellan kommandoknappar",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Ändra distans mellan komandon. Du har möjlighet att sätta olika värden för stationära och mobila enheter.",
|
||||
"Warning": "Varning",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "Ẩm",
|
||||
"Hide other Commands": "Ẩn các lệnh khác",
|
||||
"Double click to enter custom value": "Nhấn đúp(x2) để thêm giá trị tuỳ chỉnh",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "Chọn độ giãn cách giữa các nút",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "Thay đổi khoảng các giữa các lệnh",
|
||||
"Warning": "Cảnh báo",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "隐藏",
|
||||
"Hide other Commands": "隐藏其余命令",
|
||||
"Double click to enter custom value": "双击以添加自定义值",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "为命令按钮选择自定义间距",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "改变命令之间的间距。你可以为移动和桌面设备设置不同的值。",
|
||||
"Warning": "警告",
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
"Hide": "隱藏",
|
||||
"Hide other Commands": "隱藏其他命令",
|
||||
"Double click to enter custom value": "連按兩下以輸入自訂值",
|
||||
"Restore default": "Restore default",
|
||||
"Choose custom spacing for Command Buttons": "選擇命令按鈕的自訂間距",
|
||||
"Change the spacing between commands. You can set different values on mobile and desktop.": "變更命令之間的間距。您可以為行動和桌面裝置設定不同的值。",
|
||||
"Warning": "警告",
|
||||
|
|
|
|||
|
|
@ -90,7 +90,13 @@ export function EyeToggleComponent({
|
|||
);
|
||||
}
|
||||
|
||||
export function SliderComponent(props: SettingProps<number>): h.JSX.Element {
|
||||
interface SliderProps extends SettingProps<number> {
|
||||
defaultValue?: number;
|
||||
}
|
||||
export function SliderComponent({
|
||||
defaultValue,
|
||||
...props
|
||||
}: SliderProps): h.JSX.Element {
|
||||
const [val, setVal] = useState(props.value);
|
||||
|
||||
return (
|
||||
|
|
@ -99,7 +105,19 @@ export function SliderComponent(props: SettingProps<number>): h.JSX.Element {
|
|||
name={props.name}
|
||||
className="cmdr-slider"
|
||||
>
|
||||
<div>
|
||||
<div class="cmdr-flex cmdr-items-center">
|
||||
{defaultValue !== undefined && (
|
||||
<ObsidianIcon
|
||||
aria-label={t("Restore default")}
|
||||
icon="reset"
|
||||
size={16}
|
||||
className="clickable-icon"
|
||||
onClick={(): void => {
|
||||
setVal(defaultValue);
|
||||
props.changeHandler(defaultValue);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<ChangeableText
|
||||
ariaLabel={t("Double click to enter custom value")}
|
||||
value={val.toString()}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Platform } from "obsidian";
|
||||
import { Fragment, h } from "preact";
|
||||
import { useEffect, useMemo, useRef, useState } from "preact/hooks";
|
||||
import { DEFAULT_SETTINGS } from "src/constants";
|
||||
import t from "src/l10n";
|
||||
import { Tab } from "src/types";
|
||||
import { ObsidianIcon, updateSpacing } from "src/util";
|
||||
|
|
@ -98,6 +99,7 @@ export default function settingTabComponent({
|
|||
/>
|
||||
<SliderComponent
|
||||
value={plugin.settings.spacing}
|
||||
defaultValue={DEFAULT_SETTINGS.spacing}
|
||||
name={t(
|
||||
"Choose custom spacing for Command Buttons"
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue