From 0cf94448ea38c7d010e4cc7446fac72052a50df9 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Tue, 25 Apr 2023 20:59:59 +0200 Subject: [PATCH] use new behaviors adminPostEditorTags --- src/Backend.php | 1 + src/BackendBehaviors.php | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Backend.php b/src/Backend.php index e85c4a4..0f4a040 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -67,6 +67,7 @@ class Backend extends dcNsProcess 'adminBeforeBlogSettingsUpdate' => [BackendBehaviors::class, 'adminBeforeBlogSettingsUpdate'], // post 'adminPostHeaders' => [BackendBehaviors::class, 'adminPostHeaders'], + 'adminPostEditorTags' => [BackendBehaviors::class, 'adminPostEditorTags'], 'adminPostFormItems' => [BackendBehaviors::class, 'adminPostFormItems'], 'adminAfterPostUpdate' => [BackendBehaviors::class, 'adminAfterPostSave'], 'adminAfterPostCreate' => [BackendBehaviors::class, 'adminAfterPostSave'], diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index 07f22d7..9074bfc 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -156,10 +156,25 @@ class BackendBehaviors $editor = dcCore::app()->auth->getOption('editor'); return - dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') . + //dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') . dcPage::jsModuleLoad(My::id() . '/js/backend.js'); } + /** + * Add editor to post tags. + * + * @param string $editor The editor name (ie dcCKEditor) + * @param string $context The editor context (ie post) + * @param ArrayObject $alt_tags The editor target (ie textarea id) + * @param string $format The editor format (ie xhtml) + */ + public static function adminPostEditorTags(string $editor, string $context, ArrayObject $alt_tags, string $format): void + { + if ($context == 'post') { + $alltgas[] = '#post_wtext'; + } + } + /** * Add widget text form to post edition page. *