mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(ckeditor): use vite environment variables for inspector
This commit is contained in:
parent
88f78f3e32
commit
bbeb4e25f3
@ -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-13
|
||||
|
1
apps/client/.env.production
Normal file
1
apps/client/.env.production
Normal file
@ -0,0 +1 @@
|
||||
VITE_CKEDITOR_ENABLE_INSPECTOR=false
|
2
apps/client/src/vite-env.d.ts
vendored
2
apps/client/src/vite-env.d.ts
vendored
@ -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 {
|
||||
|
@ -19,8 +19,6 @@ import { PopupEditor, ClassicEditor, EditorWatchdog, type CKTextEditor, type Men
|
||||
import "@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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user