{/foreach}
];
- void setupCkeditor(element, features, bbcodes, codeBlockLanguages);
+ void setupCkeditor(element, features, bbcodes, codeBlockLanguages, '{@$__wcf->getBBCodeHandler()->getCkeditorLicenseKey()|encodeJS}');
});
</script>
languages: codeBlockLanguages,
};
- (configuration as any).woltlabBbcode = bbcodes;
+ configuration.woltlabBbcode = bbcodes;
if (features.autosave !== "") {
initializeAutosave(element, configuration, features.autosave);
features: Features,
bbcodes: WoltlabBbcodeItem[],
codeBlockLanguages: CKEditor5.CodeBlock.CodeBlockConfig["languages"],
+ licenseKey: string,
): Promise<CKEditor> {
if (instances.has(element)) {
throw new TypeError(`Cannot initialize the editor for '${element.id}' twice.`);
}
const configuration = initializeConfiguration(element, features, bbcodes, codeBlockLanguages, CKEditor5);
+ if (licenseKey) {
+ configuration.licenseKey = licenseKey;
+ }
normalizeLegacyMessage(element);
{/foreach}
];
- void setupCkeditor(element, features, bbcodes, codeBlockLanguages);
+ void setupCkeditor(element, features, bbcodes, codeBlockLanguages, '{@$__wcf->getBBCodeHandler()->getCkeditorLicenseKey()|encodeJS}');
});
</script>
}
return false;
}
- async function setupCkeditor(element, features, bbcodes, codeBlockLanguages) {
+ async function setupCkeditor(element, features, bbcodes, codeBlockLanguages, licenseKey) {
if (instances.has(element)) {
throw new TypeError(`Cannot initialize the editor for '${element.id}' twice.`);
}
(0, Quote_1.setup)(element);
}
const configuration = initializeConfiguration(element, features, bbcodes, codeBlockLanguages, CKEditor5);
+ if (licenseKey) {
+ configuration.licenseKey = licenseKey;
+ }
(0, Normalizer_1.normalizeLegacyMessage)(element);
const cke = await createEditor(element, configuration);
const ckeditor = new Ckeditor(cke, features);
use wcf\data\bbcode\BBCode;
use wcf\data\bbcode\BBCodeCache;
use wcf\system\application\ApplicationHandler;
+use wcf\system\package\license\LicenseApi;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
// yield any module if this locale is (implicitly) requested.
return "";
}
+
+ /**
+ * @since 6.0
+ */
+ public function getCkeditorLicenseKey(): string
+ {
+ $licenseApi = LicenseApi::readFromFile();
+ if ($licenseApi === null) {
+ return '';
+ }
+
+ return $licenseApi->getData()['license']['ckeditorLicenseKey'] ?? '';
+ }
}
self::LICENSE_FILE,
\sprintf(
<<<'EOT'
- return '%s';
+ <?php
+ /* GENERATED AT %s -- DO NOT EDIT */
+ return <<<'JSON'
+ %s
+ JSON;
EOT,
+ \gmdate('r', \TIME_NOW),
$this->json,
)
);
return null;
}
- $content = \file_get_contents(self::LICENSE_FILE);
+ $content = require(self::LICENSE_FILE);
try {
return new LicenseApi($content);