fix message editor

This commit is contained in:
Jean-Christian Paul Denis 2023-04-25 21:17:10 +02:00
parent bb69a88a9c
commit 9609e9716e
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 7 additions and 9 deletions

View File

@ -5,7 +5,6 @@ $(() => {
if (typeof jsToolBar === 'function') { if (typeof jsToolBar === 'function') {
$('#disclaimer_text').each(function () { $('#disclaimer_text').each(function () {
const tbWidgetTextDisclaimer = new jsToolBar(this); const tbWidgetTextDisclaimer = new jsToolBar(this);
tbWidgetTextDisclaimer.context = 'disclaimer_text';
tbWidgetTextDisclaimer.draw('xhtml'); tbWidgetTextDisclaimer.draw('xhtml');
}); });
} }

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\disclaimer; namespace Dotclear\Plugin\disclaimer;
use ArrayObject;
use dcCore; use dcCore;
use dcPage; use dcPage;
use dcNsProcess; use dcNsProcess;
@ -70,15 +71,13 @@ class Backend extends dcNsProcess
}, },
'adminBlogPreferencesHeaders' => function (): string { 'adminBlogPreferencesHeaders' => function (): string {
// nullsafe PHP < 8.0 return dcPage::jsModuleLoad(My::id() . '/js/backend.js');
if (is_null(dcCore::app()->auth)) { },
return '';
}
$editor = dcCore::app()->auth->getOption('editor');
return 'adminPostEditorTags' => function (string $editor, string $context, ArrayObject $alt_tags, string $format): void {
dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'disclaimer', ['#disclaimer_text'], 'xhtml') . if ($context == 'blog_desc') {
dcPage::jsModuleLoad(My::id() . '/js/backend.js'); $alt_tags->append('#disclaimer_text');
}
}, },
'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void { 'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {