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
refactor(ckeditor): use vite environment variables for inspector
Elian Doranbbeb4e25f333
diff --git a/apps/client/.env.development b/apps/client/.env.developmentindex f3a28cd090..b0273c58e6 100644--- a/apps/client/.env.development+++ b/apps/client/.env.development@@ -1,3 +1,5 @@+VITE_CKEDITOR_ENABLE_INSPECTOR=false+# The development license key for premium CKEditor features.# Note: This key is for development purposes only and should not be used in production.# Expires on: 2025-09-13diff --git a/apps/client/.env.production b/apps/client/.env.productionnew file mode 100644index 0000000000..dc6392a2f2--- /dev/null+++ b/apps/client/.env.production@@ -0,0 +1 @@+VITE_CKEDITOR_ENABLE_INSPECTOR=false\ No newline at end of filediff --git a/apps/client/src/vite-env.d.ts b/apps/client/src/vite-env.d.tsindex cb1584238b..d6d5620318 100644--- a/apps/client/src/vite-env.d.ts+++ b/apps/client/src/vite-env.d.ts@@ -7,6 +7,8 @@ interface ViteTypeOptions {interface ImportMetaEnv {/** The license key for CKEditor premium features. */readonly VITE_CKEDITOR_KEY?: string;+ /** Whether to enable the CKEditor inspector (see https://ckeditor.com/docs/ckeditor5/latest/framework/develpment-tools/inspector.html). */+ readonly VITE_CKEDITOR_ENABLE_INSPECTOR?: "true" | "false";}interface ImportMeta {diff --git a/apps/client/src/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.tsindex b1ff627515..329e59824b 100644--- a/apps/client/src/widgets/type_widgets/editable_text.ts+++ b/apps/client/src/widgets/type_widgets/editable_text.ts@@ -19,8 +19,6 @@ import { PopupEditor, ClassicEditor, EditorWatchdog, type CKTextEditor, type Menimport "@triliumnext/ckeditor5/index.css";import { normalizeMimeTypeForCKEditor } from "@triliumnext/commons";-const ENABLE_INSPECTOR = true;-const mentionSetup: MentionFeed[] = [{marker: "@",@@ -278,7 +276,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {editor.model.document.on("change:data", () => this.spacedUpdate.scheduleUpdate());- if (glob.isDev && ENABLE_INSPECTOR) {+ if (import.meta.env.VITE_CKEDITOR_ENABLE_INSPECTOR === "true") {const CKEditorInspector = (await import("@ckeditor/ckeditor5-inspector")).default;CKEditorInspector.attach(editor);}