Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client): review from Copilot
Elian Doranae1c8f0a0b59
diff --git a/apps/client/src/components/note_context.ts b/apps/client/src/components/note_context.tsindex 900a1cf2aa..735978974a 100644--- a/apps/client/src/components/note_context.ts+++ b/apps/client/src/components/note_context.ts@@ -12,7 +12,6 @@ import type FNote from "../entities/fnote.js";import type { CKTextEditor } from "@triliumnext/ckeditor5";import type CodeMirror from "@triliumnext/codemirror";import { closeActiveDialog } from "../services/dialog.js";-import { TypeWidget } from "../widgets/note_types.jsx";import { ReactWrappedWidget } from "../widgets/basic_widget.js";export interface SetNoteOpts {diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsxindex 8d5845018e..07035102ea 100644--- a/apps/client/src/widgets/NoteDetail.tsx+++ b/apps/client/src/widgets/NoteDetail.tsx@@ -1,4 +1,4 @@-import { useNoteContext, useTriliumEvent, useTriliumEvents } from "./react/hooks"+import { useNoteContext, useTriliumEvent } from "./react/hooks"import FNote from "../entities/fnote";import protected_session_holder from "../services/protected_session_holder";import { useEffect, useRef, useState } from "preact/hooks";diff --git a/apps/client/src/widgets/dialogs/add_link.tsx b/apps/client/src/widgets/dialogs/add_link.tsxindex 82ac9fced5..4bb1d1711c 100644--- a/apps/client/src/widgets/dialogs/add_link.tsx+++ b/apps/client/src/widgets/dialogs/add_link.tsx@@ -38,7 +38,7 @@ export default function AddLinkDialog() {} else {setLinkType("reference-link");}- }, [ opts ])+ }, [ opts ]);async function setDefaultLinkTitle(noteId: string) {const noteTitle = await tree.getNoteTitle(noteId);diff --git a/apps/client/src/widgets/note_map/NoteMap.tsx b/apps/client/src/widgets/note_map/NoteMap.tsxindex f21369f979..1c503c3637 100644--- a/apps/client/src/widgets/note_map/NoteMap.tsx+++ b/apps/client/src/widgets/note_map/NoteMap.tsx@@ -142,7 +142,7 @@ export default function NoteMap({ note, widgetMode, parentRef }: NoteMapProps) {<div ref={styleResolverRef} class="style-resolver" /><div ref={containerRef} className="note-map-container" /></div>- )+ );}function MapTypeSwitcher({ icon, text, type, currentMapType, setMapType }: {diff --git a/apps/client/src/widgets/note_map/rendering.ts b/apps/client/src/widgets/note_map/rendering.tsindex 97490abda5..129577521b 100644--- a/apps/client/src/widgets/note_map/rendering.ts+++ b/apps/client/src/widgets/note_map/rendering.ts@@ -167,7 +167,7 @@ export function setupRendering(graph: ForceGraph<NoteMapNodeObject, NoteMapLinkO.linkWidth((link) => (highlightLinks.has(link) ? 3 : 0.4)).linkColor((link) => (highlightLinks.has(link) ? cssData.textColor : cssData.mutedTextColor)).linkDirectionalArrowLength(4)- .linkDirectionalArrowRelPos(0.95)+ .linkDirectionalArrowRelPos(0.95);// Link-specific configif (mapType) {diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex f022c02dab..4ede3c73e2 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -1,12 +1,12 @@import { CSSProperties } from "preact/compat";import { DragData } from "../note_tree";import { FilterLabelsByType, KeyboardActionNames, OptionNames, RelationNames } from "@triliumnext/commons";-import { Inputs, MutableRef, useCallback, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";+import { MutableRef, useCallback, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";import { ParentComponent, refToJQuerySelector } from "./react_utils";import { RefObject, VNode } from "preact";import { Tooltip } from "bootstrap";-import { ViewMode, ViewScope } from "../../services/link";-import appContext, { CommandListenerData, EventData, EventNames } from "../../components/app_context";+import { ViewScope } from "../../services/link";+import appContext, { EventData, EventNames } from "../../components/app_context";import attributes from "../../services/attributes";import BasicWidget, { ReactWrappedWidget } from "../basic_widget";import Component from "../../components/component";diff --git a/apps/client/src/widgets/type_widgets/AiChat.tsx b/apps/client/src/widgets/type_widgets/AiChat.tsxindex b69446608d..677d593ab1 100644--- a/apps/client/src/widgets/type_widgets/AiChat.tsx+++ b/apps/client/src/widgets/type_widgets/AiChat.tsx@@ -1,4 +1,4 @@-import { useEffect, useRef, useState } from "preact/hooks";+import { useEffect, useRef } from "preact/hooks";import { useEditorSpacedUpdate, useLegacyWidget } from "../react/hooks";import { type TypeWidgetProps } from "./type_widget";import LlmChatPanel from "../llm_chat";diff --git a/apps/client/src/widgets/type_widgets/Empty.tsx b/apps/client/src/widgets/type_widgets/Empty.tsxindex 3c0abb11ea..eb0f0c5eeb 100644--- a/apps/client/src/widgets/type_widgets/Empty.tsx+++ b/apps/client/src/widgets/type_widgets/Empty.tsx@@ -1,4 +1,4 @@-import { useCallback, useContext, useEffect, useRef, useState } from "preact/hooks";+import { useContext, useEffect, useRef, useState } from "preact/hooks";import { t } from "../../services/i18n";import FormGroup from "../react/FormGroup";import NoteAutocomplete from "../react/NoteAutocomplete";diff --git a/apps/client/src/widgets/type_widgets/File.tsx b/apps/client/src/widgets/type_widgets/File.tsxindex 0c5a79b5a4..2665267549 100644--- a/apps/client/src/widgets/type_widgets/File.tsx+++ b/apps/client/src/widgets/type_widgets/File.tsx@@ -1,4 +1,3 @@-import { VNode } from "preact";import { useNoteBlob } from "../react/hooks";import "./File.css";import { TypeWidgetProps } from "./type_widget";diff --git a/apps/client/src/widgets/type_widgets/Image.tsx b/apps/client/src/widgets/type_widgets/Image.tsxindex e9f8738bde..9386344237 100644--- a/apps/client/src/widgets/type_widgets/Image.tsx+++ b/apps/client/src/widgets/type_widgets/Image.tsx@@ -1,6 +1,6 @@import { useEffect, useRef, useState } from "preact/hooks";import { createImageSrcUrl } from "../../services/utils";-import { useNoteBlob, useTriliumEvent, useUniqueName } from "../react/hooks";+import { useTriliumEvent, useUniqueName } from "../react/hooks";import "./Image.css";import { TypeWidgetProps } from "./type_widget";import WheelZoom from 'vanilla-js-wheel-zoom';diff --git a/apps/client/src/widgets/type_widgets/MindMap.tsx b/apps/client/src/widgets/type_widgets/MindMap.tsxindex e5f5b97ef8..4192fae281 100644--- a/apps/client/src/widgets/type_widgets/MindMap.tsx+++ b/apps/client/src/widgets/type_widgets/MindMap.tsx@@ -7,7 +7,7 @@ import nodeMenu from "@mind-elixir/node-menu";import "mind-elixir/style";import "@mind-elixir/node-menu/dist/style.css";import "./MindMap.css";-import { useEditorSpacedUpdate, useNoteLabelBoolean, useSyncedRef, useTriliumEvent, useTriliumEvents, useTriliumOptionBool } from "../react/hooks";+import { useEditorSpacedUpdate, useNoteLabelBoolean, useSyncedRef, useTriliumEvent, useTriliumEvents } from "../react/hooks";import { refToJQuerySelector } from "../react/react_utils";import utils from "../../services/utils";diff --git a/apps/client/src/widgets/type_widgets/code/Code.tsx b/apps/client/src/widgets/type_widgets/code/Code.tsxindex 33f43795be..0c089b9a8f 100644--- a/apps/client/src/widgets/type_widgets/code/Code.tsx+++ b/apps/client/src/widgets/type_widgets/code/Code.tsx@@ -202,5 +202,5 @@ export function CodeEditor({ parentComponent, ntxId, containerRef: externalContainitialized.current.resolve();onInitialized?.();}}- />+ />;}diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsxindex 84ad7c8e20..8a9e64a24a 100644--- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx+++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx@@ -3,7 +3,7 @@ import { t } from "../../../services/i18n";import SplitEditor, { PreviewButton, SplitEditorProps } from "./SplitEditor";import { RawHtmlBlock } from "../../react/RawHtml";import server from "../../../services/server";-import svgPanZoom, { zoomIn } from "svg-pan-zoom";+import svgPanZoom from "svg-pan-zoom";import { RefObject } from "preact";import { useElementSize, useTriliumEvent } from "../../react/hooks";import utils from "../../../services/utils";diff --git a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsxindex a13467d6fe..1ef0159c15 100644--- a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx+++ b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx@@ -10,7 +10,7 @@ import panzoom, { PanZoomOptions } from "panzoom";import dialog from "../../../services/dialog";import server from "../../../services/server";import toast from "../../../services/toast";-import { CreateChildrenResponse, RelationMapPostResponse, RelationMapRelation } from "@triliumnext/commons";+import { CreateChildrenResponse, RelationMapPostResponse } from "@triliumnext/commons";import RelationMapApi, { ClientRelation, MapData, MapDataNoteEntry, RelationType } from "./api";import setupOverlays, { uniDirectionalOverlays } from "./overlays";import { JsPlumb } from "./jsplumb";@@ -157,7 +157,7 @@ export default function RelationMap({ note, noteContext, ntxId }: TypeWidgetProp))}</JsPlumb></div>- )+ );}function usePanZoom({ ntxId, containerRef, options, transformData, onTransform }: {diff --git a/apps/client/src/widgets/type_widgets/text/CKEditorWithWatchdog.tsx b/apps/client/src/widgets/type_widgets/text/CKEditorWithWatchdog.tsxindex a90620711a..eaf85a08f5 100644--- a/apps/client/src/widgets/type_widgets/text/CKEditorWithWatchdog.tsx+++ b/apps/client/src/widgets/type_widgets/text/CKEditorWithWatchdog.tsx@@ -141,7 +141,7 @@ export default function CKEditorWithWatchdog({ containerRef: externalContainerReasync loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | null = null) {await link.loadReferenceLinkTitle($el, href);}- })+ });useEffect(() => {const container = containerRef.current;diff --git a/apps/client/src/widgets/type_widgets/text/EditableText.tsx b/apps/client/src/widgets/type_widgets/text/EditableText.tsxindex 7d07f59aad..f39ea3992e 100644--- a/apps/client/src/widgets/type_widgets/text/EditableText.tsx+++ b/apps/client/src/widgets/type_widgets/text/EditableText.tsx@@ -258,7 +258,7 @@ export default function EditableText({ note, parentComponent, ntxId, noteContext<EditableTextTouchBar watchdogRef={watchdogRef} refreshTouchBarRef={refreshTouchBarRef} /></>- )+ );}function useTemplates() {