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> { export async function buildConfig(): Promise<EditorConfig> {
return { return {
licenseKey: getLicenseKey(),
image: { image: {
styles: { styles: {
options: [ 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, styles: true,
classes: true, classes: true,
attributes: true attributes: true
}, }
licenseKey: getLicenseKey()
}; };
const contentLanguage = this.note?.getLabelValue("language"); 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;
}