refactor(text): move license key management to config

This commit is contained in:
Elian Doran 2025-06-19 18:47:41 +03:00
parent 248f6d6a7d
commit b809137c93
No known key found for this signature in database
2 changed files with 12 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}