diff --git a/Application/Core/TinyMCE/Configuration.php b/Application/Core/TinyMCE/Configuration.php index 50aecde..2268e15 100644 --- a/Application/Core/TinyMCE/Configuration.php +++ b/Application/Core/TinyMCE/Configuration.php @@ -30,7 +30,6 @@ use O3\TinyMCE\Application\Core\TinyMCE\Options\ContextMenu; use O3\TinyMCE\Application\Core\TinyMCE\Options\DocumentBaseUrl; use O3\TinyMCE\Application\Core\TinyMCE\Options\EntityEncoding; use O3\TinyMCE\Application\Core\TinyMCE\Options\ExternalPlugins; -use O3\TinyMCE\Application\Core\TinyMCE\Options\FilePickerCallback; use O3\TinyMCE\Application\Core\TinyMCE\Options\FilemanagerUrl; use O3\TinyMCE\Application\Core\TinyMCE\Options\ImageAdvtab; use O3\TinyMCE\Application\Core\TinyMCE\Options\Language; @@ -159,7 +158,6 @@ class Configuration $this->addOption(oxNew( Plugins::class, $this->loader)); $this->addOption(oxNew( ExternalPlugins::class, $this->loader)); $this->addOption(oxNew( FilemanagerUrl::class, $this->loader)); - $this->addOption(oxNew( FilePickerCallback::class, $this->loader)); $this->addOption(oxNew(QuickbarsInsertToolbar::class, $this->loader)); } diff --git a/Application/Core/TinyMCE/Options/FilePickerCallback.php b/Application/Core/TinyMCE/Options/FilePickerCallback.php deleted file mode 100644 index 922a778..0000000 --- a/Application/Core/TinyMCE/Options/FilePickerCallback.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * @copyright Copyright (c) 2022 OXID Marat Bedoev, bestlife AG - * @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com) - * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3) - */ - -declare(strict_types=1); - -namespace O3\TinyMCE\Application\Core\TinyMCE\Options; - -use O3\TinyMCE\Application\Core\TinyMCE\Loader; - -class FilePickerCallback extends AbstractOption -{ - protected string $key = 'file_picker_callback'; - - protected Loader $loader; - - public function get(): string - { - return 'RoxyFileBrowser'; - } - - public function requireRegistration(): bool - { - return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager"); - } -} \ No newline at end of file diff --git a/Application/Core/TinyMCE/Options/FilemanagerUrl.php b/Application/Core/TinyMCE/Options/FilemanagerUrl.php index 31b33a4..fa9dcec 100644 --- a/Application/Core/TinyMCE/Options/FilemanagerUrl.php +++ b/Application/Core/TinyMCE/Options/FilemanagerUrl.php @@ -41,7 +41,7 @@ class FilemanagerUrl extends AbstractOption return str_replace( '&', '&', - Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager&input=form-field_3980235013121680647721848" + Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager" ); } diff --git a/Application/fileman/conf.json b/Application/fileman/conf.json index 31e83c8..8e4e736 100755 --- a/Application/fileman/conf.json +++ b/Application/fileman/conf.json @@ -8,7 +8,7 @@ "PREVIEW_THUMB_HEIGHT": "100", "MAX_IMAGE_WIDTH": "2000", "MAX_IMAGE_HEIGHT": "2000", - "INTEGRATION": "tinymce4", + "INTEGRATION": "custom", "DIRLIST": "php/dirtree.php", "CREATEDIR": "php/createdir.php", "DELETEDIR": "php/deletedir.php", diff --git a/Application/fileman/js/custom.js b/Application/fileman/js/custom.js index 366bf70..ddb755b 100755 --- a/Application/fileman/js/custom.js +++ b/Application/fileman/js/custom.js @@ -33,8 +33,12 @@ function FileSelected(file){ * height - if the file is image, this will be the height of the original image, 0 otherwise * */ - alert('"' + file.fullPath + "\" selected.\n To integrate with CKEditor or TinyMCE change INTEGRATION setting in conf.json. For more details see the Installation instructions at http://www.roxyfileman.com/install."); + window.parent.postMessage({ + mceAction: 'FileSelected', + content: file.fullPath + }, '*'); } + function GetSelectedValue(){ /** * This function is called to retrieve selected value when custom integration is used. diff --git a/out/plugins/roxy/plugin.js b/out/plugins/roxy/plugin.js index 5f1df9a..002e0f5 100755 --- a/out/plugins/roxy/plugin.js +++ b/out/plugins/roxy/plugin.js @@ -1,35 +1,32 @@ /** - * vanilla-thunder/oxid-module-tinymce - * TinyMCE 5 Integration for OXID eShop V6.2 + * This file is part of O3-Shop TinyMCE editor module. * - * This program is free software; - * you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; - * either version 3 of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * You should have received a copy of the GNU General Public License along with this program; if not, see + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with O3-Shop. If not, see + * + * @copyright Copyright (c) 2022 OXID Marat Bedoev, bestlife AG + * @copyright Copyright (c) 2023 O3-Shop (https://www.o3-shop.com) + * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3) */ -/*global tinymce:true */ - (function () { 'use strict'; - var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); + const PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager'); PluginManager.add('roxy', function (editor) { - editor.settings.file_picker_callback = function ($callback, $value, $meta) { - console.log($callback); - console.log($value); - console.log($meta); - //var selectedimage = - var url = editor.settings.filemanager_url + "&type=" + $meta.filetype + '&value=' + $value + '&selected=' + $value; - if (editor.settings.language) { url += '&langCode=' + editor.settings.language; } @@ -37,14 +34,16 @@ url += '&akey=' + editor.settings.filemanager_access_key; } - editor.windowManager.openUrl({ + const instanceApi = editor.windowManager.openUrl({ title: 'Filemanager', url: url, width: window.innerWidth, - height: window.innerHeight - 40 + height: window.innerHeight - 40, + onMessage: function(dialogApi, details) { + $callback(details.content); + instanceApi.close(); + } }); - - //$callback('myimage.jpg', {alt: 'My alt text'}); }; }); }()); \ No newline at end of file