fix file manager integration

This commit is contained in:
O3-Shop 2023-04-06 08:40:56 +02:00
bovenliggende 56a7f1a67f
commit 6d7280ef92
6 gewijzigde bestanden met toevoegingen van 28 en 70 verwijderingen

Bestand weergeven

@ -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));
}

Bestand weergeven

@ -1,43 +0,0 @@
<?php
/**
* 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, 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 O3-Shop. If not, see <http://www.gnu.org/licenses/>
*
* @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");
}
}

Bestand weergeven

@ -41,7 +41,7 @@ class FilemanagerUrl extends AbstractOption
return str_replace(
'&amp;',
'&',
Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager&input=form-field_3980235013121680647721848"
Registry::getConfig()->getActiveView()->getViewConfig()->getSslSelfLink()."cl=tinyfilemanager"
);
}

Bestand weergeven

@ -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",

Bestand weergeven

@ -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.

Bestand weergeven

@ -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 <http://www.gnu.org/licenses/>
* 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 <http://www.gnu.org/licenses/>
*
* @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'});
};
});
}());