Skip to content

Build your personal knowledge base with Trilium Notes

refactor(client/web_view): fix lint & formatting

Elian Doran964633f426a8
diff --git a/apps/client/src/widgets/type_widgets/WebView.tsx b/apps/client/src/widgets/type_widgets/WebView.tsx
index 3b47a0cd15..40c5ef8655 100644
--- a/apps/client/src/widgets/type_widgets/WebView.tsx
+++ b/apps/client/src/widgets/type_widgets/WebView.tsx
@@ -1,13 +1,15 @@
+import "./WebView.css";
+
import { useCallback, useState } from "preact/hooks";
+
import FNote from "../../entities/fnote";
import { t } from "../../services/i18n";
+import toast from "../../services/toast";
import utils from "../../services/utils";
+import Button from "../react/Button";
+import FormGroup from "../react/FormGroup";
import { useNoteLabel } from "../react/hooks";
import { TypeWidgetProps } from "./type_widget";
-import "./WebView.css";
-import FormGroup from "../react/FormGroup";
-import toast from "../../services/toast";
-import Button from "../react/Button";
const isElectron = utils.isElectron();
@@ -22,47 +24,48 @@ export default function WebView({ note }: TypeWidgetProps) {
function WebViewContent({ src }: { src: string }) {
if (!isElectron) {
- return <iframe src={src} class="note-detail-web-view-content" sandbox="allow-same-origin allow-scripts allow-popups" />
- } else {
- return <webview src={src} class="note-detail-web-view-content" />
+ return <iframe src={src} class="note-detail-web-view-content" sandbox="allow-same-origin allow-scripts allow-popups" />;
}
+ return <webview src={src} class="note-detail-web-view-content" />;
+
}
function SetupWebView({note}: {note: FNote}) {
- const [srcLabel, setSrcLabel] = useNoteLabel(note, "webViewSrc");
- const [src, setSrc] = useState("");
+ const [ , setSrcLabel] = useNoteLabel(note, "webViewSrc");
+ const [ src, setSrc ] = useState("");
const submit = useCallback((url: string) => {
try {
// Validate URL
new URL(url);
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (ex) {
toast.showErrorTitleAndMessage(t("web_view_setup.invalid_url_title"),
- t("web_view_setup.invalid_url_message"));
+ t("web_view_setup.invalid_url_message"));
return;
}
setSrcLabel(url);
- }, [note]);
+ }, [ setSrcLabel ]);
return <div class="web-view-setup-form">
- <form class="tn-centered-form" onSubmit={() => submit(src)}>
- <span className="bx bx-globe-alt form-icon" />
-
- <FormGroup name="web-view-src-detail" label={t("web_view_setup.title")}>
- <input className="form-control"
- type="text"
- value={src}
- placeholder={t("web_view_setup.url_placeholder")}
- onChange={(e) => {setSrc((e.target as HTMLInputElement)?.value)}}
- />
- </FormGroup>
+ <form class="tn-centered-form" onSubmit={() => submit(src)}>
+ <span className="bx bx-globe-alt form-icon" />
- <Button
- text={t("web_view_setup.create_button")}
- primary
- keyboardShortcut="Enter"
+ <FormGroup name="web-view-src-detail" label={t("web_view_setup.title")}>
+ <input className="form-control"
+ type="text"
+ value={src}
+ placeholder={t("web_view_setup.url_placeholder")}
+ onChange={(e) => {setSrc((e.target as HTMLInputElement)?.value);}}
/>
- </form>
- </div>
+ </FormGroup>
+
+ <Button
+ text={t("web_view_setup.create_button")}
+ primary
+ keyboardShortcut="Enter"
+ />
+ </form>
+ </div>;
}