mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
chore(react/settings): solve type errors
This commit is contained in:
@@ -94,7 +94,8 @@ function AvailableActionsList() {
|
|||||||
<td>{ actionGroup.title }:</td>
|
<td>{ actionGroup.title }:</td>
|
||||||
{actionGroup.actions.map(({ actionName, actionTitle }) =>
|
{actionGroup.actions.map(({ actionName, actionTitle }) =>
|
||||||
<Button
|
<Button
|
||||||
small text={actionTitle}
|
size="small"
|
||||||
|
text={actionTitle}
|
||||||
onClick={() => bulk_action.addAction("_bulkAction", actionName)}
|
onClick={() => bulk_action.addAction("_bulkAction", actionName)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ function RecentChangesDialogComponent() {
|
|||||||
header={
|
header={
|
||||||
<Button
|
<Button
|
||||||
text={t("recent_changes.erase_notes_button")}
|
text={t("recent_changes.erase_notes_button")}
|
||||||
small style={{ padding: "0 10px" }}
|
size="small"
|
||||||
|
style={{ padding: "0 10px" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
server.post("notes/erase-deleted-notes-now").then(() => {
|
server.post("notes/erase-deleted-notes-now").then(() => {
|
||||||
setNeedsRefresh(true);
|
setNeedsRefresh(true);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function RevisionsDialogComponent() {
|
|||||||
helpPageId="vZWERwf8U3nx"
|
helpPageId="vZWERwf8U3nx"
|
||||||
bodyStyle={{ display: "flex", height: "80vh" }}
|
bodyStyle={{ display: "flex", height: "80vh" }}
|
||||||
header={
|
header={
|
||||||
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} small style={{ padding: "0 10px" }}
|
(!!revisions?.length && <Button text={t("revisions.delete_all_revisions")} size="small" style={{ padding: "0 10px" }}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const text = t("revisions.confirm_delete_all");
|
const text = t("revisions.confirm_delete_all");
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { InputHTMLAttributes, RefObject } from "preact/compat";
|
import type { InputHTMLAttributes, RefObject } from "preact/compat";
|
||||||
|
|
||||||
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> {
|
interface FormTextBoxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "value"> {
|
||||||
id?: string;
|
id?: string;
|
||||||
currentValue?: string;
|
currentValue?: string;
|
||||||
onChange?(newValue: string, validity: ValidityState): void;
|
onChange?(newValue: string, validity: ValidityState): void;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function ShortcutSettings() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let updatedShortcuts: KeyboardShortcut[] = null;
|
let updatedShortcuts: (KeyboardShortcut[] | null) = null;
|
||||||
|
|
||||||
for (const optionName of optionNames) {
|
for (const optionName of optionNames) {
|
||||||
if (!(optionName.startsWith("keyboardShortcuts"))) {
|
if (!(optionName.startsWith("keyboardShortcuts"))) {
|
||||||
@@ -58,12 +58,13 @@ export default function ShortcutSettings() {
|
|||||||
|
|
||||||
const optionsToSet: Record<string, string> = {};
|
const optionsToSet: Record<string, string> = {};
|
||||||
for (const keyboardShortcut of keyboardShortcuts) {
|
for (const keyboardShortcut of keyboardShortcuts) {
|
||||||
if (!("effectiveShortcuts" in keyboardShortcut)) {
|
if (!("effectiveShortcuts" in keyboardShortcut) || !keyboardShortcut.effectiveShortcuts) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, keyboardShortcut.defaultShortcuts)) {
|
const defaultShortcuts = keyboardShortcut.defaultShortcuts ?? [];
|
||||||
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(keyboardShortcut.defaultShortcuts);
|
if (!arrayEqual(keyboardShortcut.effectiveShortcuts, defaultShortcuts)) {
|
||||||
|
optionsToSet[getOptionName(keyboardShortcut.actionName)] = JSON.stringify(defaultShortcuts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options.saveMany(optionsToSet);
|
options.saveMany(optionsToSet);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export function SyncTest() {
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const result = await server.post<SyncTestResponse>("sync/test");
|
const result = await server.post<SyncTestResponse>("sync/test");
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success && result.message) {
|
||||||
toast.showMessage(result.message);
|
toast.showMessage(result.message);
|
||||||
} else {
|
} else {
|
||||||
toast.showError(t("sync_2.handshake_failed", { message: result.message }));
|
toast.showError(t("sync_2.handshake_failed", { message: result.message }));
|
||||||
|
|||||||
Reference in New Issue
Block a user