From a6f16518bc097560961ffde9fc70aefd17b88f54 Mon Sep 17 00:00:00 2001 From: O3-Shop Date: Fri, 7 Apr 2023 22:48:34 +0200 Subject: [PATCH] add optional api key setting --- Application/Core/TinyMCE/Loader.php | 16 +++++++++++----- Application/views/admin/de/module_options.php | 1 + Application/views/admin/en/module_options.php | 1 + metadata.php | 9 ++++++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Application/Core/TinyMCE/Loader.php b/Application/Core/TinyMCE/Loader.php index 4068e90..fb594c2 100644 --- a/Application/Core/TinyMCE/Loader.php +++ b/Application/Core/TinyMCE/Loader.php @@ -132,16 +132,22 @@ dumpvar($sInit.PHP_EOL, 1); $aInclude = (array) Registry::getConfig()->getGlobalParameter('includes' . $sSuffix); - $aExtjs = Registry::getConfig()->getConfigParam('aTinyMCE_extjs', []); - foreach ($aExtjs as $js) { - $aInclude[3][] = $js; - } - $aInclude[3][] = Registry::getConfig()->getActiveView()->getViewConfig()->getModuleUrl( 'tinymce-editor', 'out/tinymce/tinymce.min.js' ); + $aExtjs = Registry::getConfig()->getConfigParam('aTinyMCE_extjs', []); + foreach ($aExtjs as $js) { + $aInclude[3][] = $js; + } + + if (strlen(trim(Registry::getConfig()->getConfigParam('sTinyMCE_apikey', '')))) { + $aInclude[3][] = "https://cdn.tiny.cloud/1/". + trim(Registry::getConfig()->getConfigParam('sTinyMCE_apikey', '')). + "/tinymce/6/plugins.min.js"; + } + Registry::getConfig()->setGlobalParameter('includes' . $sSuffix, $aInclude); } } \ No newline at end of file diff --git a/Application/views/admin/de/module_options.php b/Application/views/admin/de/module_options.php index 7369d4b..2c1a5ab 100644 --- a/Application/views/admin/de/module_options.php +++ b/Application/views/admin/de/module_options.php @@ -29,6 +29,7 @@ $aLang = array( 'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'Ist diese Option aktiv, können Bilder hochgeladen werden. Der Speicherort ist: out/pictures/wysiwigpro/', 'SHOP_MODULE_aTinyMCE_classes' => '

TinyMCE für folgende Backend-Seiten laden:

', 'HELP_SHOP_MODULE_aTinyMCE_classes' => 'für die Benutzung von TinyMCE in eigenen Admin Views muss hier die entsprechende Controllerklasse eingetragen werden, dann wird für jedes Textarea je ein Editor erzeugt', + 'SHOP_MODULE_sTinyMCE_apikey' => 'optionaler API-Key aus Ihrer TinyMCE Registrierung', 'SHOP_MODULE_aTinyMCE_extjs' => '

Externe JS Abhängigkeiten

', 'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'Komplette URL mit http:// bzw https:// falls der Shop über HTTPS läuft.', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Einstellungen & Plugins', diff --git a/Application/views/admin/en/module_options.php b/Application/views/admin/en/module_options.php index 6e6c7ef..4365df7 100644 --- a/Application/views/admin/en/module_options.php +++ b/Application/views/admin/en/module_options.php @@ -29,6 +29,7 @@ $aLang = array( 'HELP_SHOP_MODULE_blTinyMCE_filemanager' => 'When enabled, you can upload pictures into this directory: out/pictures/wysiwigpro/', 'SHOP_MODULE_aTinyMCE_classes' => '

Enable TinyMCE for following backend pages:

', 'HELP_SHOP_MODULE_aTinyMCE_classes' => 'if you want to use TinyMCE for your custom controllers, you need to enter their class names here.', + 'SHOP_MODULE_sTinyMCE_apikey' => 'optional API key from your TinyMCE registration', 'SHOP_MODULE_aTinyMCE_extjs' => '

external JS dependencies

(e.g. for plugins)', 'HELP_SHOP_MODULE_aTinyMCE_extjs' => 'full URL with http:// or https:// if your shop runs with HTTPS.', 'SHOP_MODULE_GROUP_tinyMceSettings' => 'TinyMCE Settings & Plugins', diff --git a/metadata.php b/metadata.php index ccccee2..143086a 100755 --- a/metadata.php +++ b/metadata.php @@ -67,12 +67,19 @@ $aModule = [ 'value' => true, 'position' => 2 ], + [ + 'group' => 'tinyMceMain', + 'name' => 'sTinyMCE_apikey', + 'type' => 'str', + 'value' => '', + 'position' => 3 + ], [ 'group' => 'tinyMceMain', 'name' => 'aTinyMCE_extjs', 'type' => 'arr', 'value' => [], - 'position' => 3 + 'position' => 4 ] ] ];