N°7552 - Move CKEditor from to npm dependencies

This commit is contained in:
Stephen Abello
2024-07-24 14:19:52 +02:00
parent 35a7d907cd
commit 054fd8798b
126 changed files with 210 additions and 7981 deletions

View File

@@ -253,7 +253,7 @@ HTML;
{
// all js file needed by ckeditor
$aJSRelPaths = [
'js/ckeditor/build/ckeditor.js',
'node_modules/ckeditor5-itop-build/build/ckeditor.js',
'js/highlight/highlight.js',
'js/ckeditor.handler.js',
'js/ckeditor.feeds.js'
@@ -267,12 +267,12 @@ HTML;
// add corresponding ckeditor language file
// P1 language + country
// P2 language
$sLanguageFileRelPath = 'js/ckeditor/build/translations/' . $sLanguage . '-' . $sCountry . '.js';
$sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/' . $sLanguage . '-' . $sCountry . '.js';
if(file_exists(APPROOT . $sLanguageFileRelPath)){
$aJSRelPaths[] = $sLanguageFileRelPath;
}
else {
$sLanguageFileRelPath = 'js/ckeditor/build/translations/' . $sLanguage . '.js';
$sLanguageFileRelPath = 'node_modules/ckeditor5-itop-build/build/translations/' . $sLanguage . '.js';
if(file_exists(APPROOT . $sLanguageFileRelPath)){
$aJSRelPaths[] = $sLanguageFileRelPath;
}

View File

@@ -60,7 +60,7 @@ class WebResourcesHelper
public static function EnableCKEditorToWebPage(WebPage &$oPage): void
{
//when ckeditor is loaded in ajax, CKEDITOR_BASEPATH is not well defined (this constant is used to load additional js)
$oPage->add_script("if (! window.CKEDITOR_BASEPATH) { var CKEDITOR_BASEPATH = '".utils::GetAbsoluteUrlAppRoot()."js/ckeditor/';}");
$oPage->add_script("if (! window.CKEDITOR_BASEPATH) { var CKEDITOR_BASEPATH = '".utils::GetAbsoluteUrlAppRoot()."node_modules/ckeditor5-itop-build/';}");
foreach (CKEditorHelper::GetJSFilesRelPathsForCKEditor() as $sFile) {
$oPage->LinkScriptFromAppRoot($sFile);
}