Skip to content

Build your personal knowledge base with Trilium Notes

refactor(text): move license key management to config

Elian Doranb809137c9308
diff --git a/apps/client/src/widgets/type_widgets/ckeditor/config.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.ts
index 03bd5fc078..771a0ea339 100644
--- a/apps/client/src/widgets/type_widgets/ckeditor/config.ts
+++ b/apps/client/src/widgets/type_widgets/ckeditor/config.ts
@@ -16,6 +16,7 @@ const TEXT_FORMATTING_GROUP = {
export async function buildConfig(): Promise<EditorConfig> {
return {
+ licenseKey: getLicenseKey(),
image: {
styles: {
options: [
@@ -276,3 +277,13 @@ export function buildFloatingToolbar() {
]
};
}
+
+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;
+}
diff --git a/apps/client/src/widgets/type_widgets/editable_text.ts b/apps/client/src/widgets/type_widgets/editable_text.ts
index 28094f2a21..0b047d54c8 100644
--- a/apps/client/src/widgets/type_widgets/editable_text.ts
+++ b/apps/client/src/widgets/type_widgets/editable_text.ts
@@ -201,8 +201,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
styles: true,
classes: true,
attributes: true
- },
- licenseKey: getLicenseKey()
+ }
};
const contentLanguage = this.note?.getLabelValue("language");
@@ -656,12 +655,3 @@ 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;
-}