Skip to content

Build your personal knowledge base with Trilium Notes

feat(text): set up license key for development

Elian Doran507fc1770126
diff --git a/apps/client/.env.development b/apps/client/.env.development
new file mode 100644
index 0000000000..f3a28cd090
--- /dev/null
+++ b/apps/client/.env.development
@@ -0,0 +1,4 @@
+# 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
+VITE_CKEDITOR_KEY=eyJhbGciOiJFUzI1NiJ9.eyJleHAiOjE3NTc3MjE1OTksImp0aSI6IjRmMjdkYmYxLTcwOTEtNDYwZi04ZDZmLTc0NzBiZjQwNjg2MCIsImRpc3RyaWJ1dGlvbkNoYW5uZWwiOlsic2giLCJkcnVwYWwiXSwid2hpdGVMYWJlbCI6dHJ1ZSwibGljZW5zZVR5cGUiOiJkZXZlbG9wbWVudCIsImZlYXR1cmVzIjpbIkRSVVAiLCJDTVQiLCJETyIsIkZQIiwiU0MiLCJUT0MiLCJUUEwiLCJQT0UiLCJDQyIsIk1GIiwiU0VFIiwiRUNIIiwiRUlTIl0sInZjIjoiMjMxYzMwNTEifQ.9Ct5lIKbioC3dM8EFatDTmimEIVOdItE3Uh_ICHlS_A_8ueqIfkZpsN3L4_EqprvteNki9yqbuZVGpZTaQ51xg
\ No newline at end of file
diff --git a/apps/client/src/vite-env.d.ts b/apps/client/src/vite-env.d.ts
new file mode 100644
index 0000000000..cb1584238b
--- /dev/null
+++ b/apps/client/src/vite-env.d.ts
@@ -0,0 +1,14 @@
+/// <reference types="vite/client" />
+
+interface ViteTypeOptions {
+ strictImportMetaEnv: unknown
+}
+
+interface ImportMetaEnv {
+ /** The license key for CKEditor premium features. */
+ readonly VITE_CKEDITOR_KEY?: string;
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv
+}
diff --git a/apps/client/src/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.ts
index 2c62eb08e7..d85f69fe6c 100644
--- a/apps/client/src/widgets/type_widgets/editable_text.ts
+++ b/apps/client/src/widgets/type_widgets/editable_text.ts
@@ -203,7 +203,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
classes: true,
attributes: true
},
- licenseKey: "GPL"
+ licenseKey: getLicenseKey()
};
const contentLanguage = this.note?.getLabelValue("language");
@@ -640,3 +640,13 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
}
}
+
+function getLicenseKey() {
+ const premiumLicenseKey = import.meta.env.VITE_CKEDITOR_KEY;
+ if (!premiumLicenseKey) {
+ logError("CKEditor license key is not set, premium features will not be available.");
+ return "GPL";
+ }
+
+ return premiumLicenseKey;
+}