From b809137c9308c3761797e305cf21d146d93c1752 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 19 Jun 2025 18:47:41 +0300 Subject: [PATCH] refactor(text): move license key management to config --- .../src/widgets/type_widgets/ckeditor/config.ts | 11 +++++++++++ .../client/src/widgets/type_widgets/editable_text.ts | 12 +----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/ckeditor/config.ts b/apps/client/src/widgets/type_widgets/ckeditor/config.ts index 03bd5fc07..771a0ea33 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 { 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 28094f2a2..0b047d54c 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; -}