From 8cb7c36de4a503a693c989bc447c903ae7b8c08c Mon Sep 17 00:00:00 2001 From: thuanhuynhh <145774963+thuanhuynhh@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:11:09 +0000 Subject: [PATCH 1/2] Adapted for OJS/OMP/OPS 3.5 --- TextEditorExtrasPlugin.php | 18 ++++++++++++------ readme.md | 4 ++-- version.xml | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/TextEditorExtrasPlugin.php b/TextEditorExtrasPlugin.php index fb85caf..1322d5b 100755 --- a/TextEditorExtrasPlugin.php +++ b/TextEditorExtrasPlugin.php @@ -2,8 +2,8 @@ /** * @file plugins/generic/textEditorExtras/TextEditorExtrasPlugin.php * - * Copyright (c) 2017-2023 Simon Fraser University - * Copyright (c) 2017-2023 John Willinsky + * Copyright (c) 2017-2025 Simon Fraser University + * Copyright (c) 2017-2025 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class TextEditorExtrasPlugin @@ -138,7 +138,7 @@ public function modifyForms($hookName, $form) { $additions = $allAdditions[$form->id]; foreach ($additions as $fieldName => $additions) { $field = $form->getField($fieldName); - if (!$field || !is_a($field, 'PKP\components\forms\FieldRichTextArea')) { + if (!$field || !is_a($field, 'PKP\components\forms\FieldRichTextarea')) { continue; } foreach ($additions as $addition) { @@ -149,16 +149,22 @@ public function modifyForms($hookName, $form) { switch ($addition) { case 'code': $field->toolbar .= ' | ' . $addition; - $field->plugins .= ',' . $addition; + if (!in_array($addition, $field->plugins)) { + $field->plugins[] = $addition; + } break; case 'image': $field->toolbar .= ' | ' . $addition; - $field->plugins .= ',' . $addition; + if (!in_array($addition, $field->plugins)) { + $field->plugins[] = $addition; + } $field->uploadUrl = $publicFileApiUrl; break; case 'table': $field->toolbar .= ' | table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol'; - $field->plugins .= ',' . $addition; + if (!in_array($addition, $field->plugins)) { + $field->plugins[] = $addition; + } } } } diff --git a/readme.md b/readme.md index 91be5b4..67e2230 100644 --- a/readme.md +++ b/readme.md @@ -5,11 +5,11 @@ An [OJS](https://github.com/pkp/ojs) plugin to add controls to the rich text edi ![Screenshot of plugin settings](screenshot.png) ## Compatibility -* OJS 3.2.x +* OJS 3.5.x ## Installation -You can install this plugin from the plugin gallery in OJS after upgrading to v3.2. +You can install this plugin from the plugin gallery in OJS after upgrading to v3.5.x ## Usage diff --git a/version.xml b/version.xml index b06b94e..efa3051 100755 --- a/version.xml +++ b/version.xml @@ -12,8 +12,8 @@ textEditorExtras plugins.generic - 1.0.1.0 - 2023-04-11 + 1.0.2.0 + 2025-06-20 1 TextEditorExtrasPlugin From 307a30bfc223087c5e91f42ed33e6df61c253b38 Mon Sep 17 00:00:00 2001 From: thuanhuynhh <145774963+thuanhuynhh@users.noreply.github.com> Date: Sat, 21 Jun 2025 16:49:25 +0000 Subject: [PATCH 2/2] fix form 3.5.0 --- TextEditorExtrasSettingsForm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TextEditorExtrasSettingsForm.php b/TextEditorExtrasSettingsForm.php index 542f442..f62f3ab 100755 --- a/TextEditorExtrasSettingsForm.php +++ b/TextEditorExtrasSettingsForm.php @@ -2,8 +2,8 @@ /** * @file plugins/generic/textEditorExtras/TextEditorExtrasSettingsForm.php * - * Copyright (c) 2017-2023 Simon Fraser University - * Copyright (c) 2017-2023 John Willinsky + * Copyright (c) 2017-2025 Simon Fraser University + * Copyright (c) 2017-2025 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class TextEditorExtrasPlugin @@ -18,7 +18,7 @@ use APP\notification\NotificationManager; use APP\core\Application; use APP\template\TemplateManager; -use PKPNotification; +use PKP\notification\Notification; class TextEditorExtrasSettingsForm extends Form { @@ -115,7 +115,7 @@ public function execute(...$functionArgs) { $notificationMgr = new NotificationManager(); $notificationMgr->createTrivialNotification( Application::get()->getRequest()->getUser()->getId(), - PKPNotification::NOTIFICATION_TYPE_SUCCESS, + Notification::NOTIFICATION_TYPE_SUCCESS, ['contents' => __('common.changesSaved')] );