From c5155228ecbb10cb5213b39aa3b75410b842b824 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Thu, 13 Jun 2024 13:12:35 -0600 Subject: [PATCH 1/2] Fix `forced_root_block:` TinyMCE console warning Prior to this change, `Invalid value passed for the forced_root_block option. Must be a non-empty string.` would be rendered as a console warning. - This commit removes the console warning, but it shouldn't have an effect on the app's behaviour. Even when `forced_root_block: ''` existed, the entries would be saved with

tags surrounding them. (Documented here: https://github.com/DMPRoadmap/roadmap/issues/3424#issuecomment-2166424160 ) --- app/javascript/src/superAdmin/notifications/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/src/superAdmin/notifications/edit.js b/app/javascript/src/superAdmin/notifications/edit.js index 3587eee0d7..371b544799 100644 --- a/app/javascript/src/superAdmin/notifications/edit.js +++ b/app/javascript/src/superAdmin/notifications/edit.js @@ -5,7 +5,7 @@ import { paginableSelector } from '../../utils/paginable'; import * as notifier from '../../utils/notificationHelper'; $(() => { - Tinymce.init({ selector: '#notification_body', forced_root_block: '' }); + Tinymce.init({ selector: '#notification_body' }); $(paginableSelector).on('click, change', '.enable_notification input[type="checkbox"]', (e) => { const form = $(e.target).closest('form'); From d6b1b55b185e3e9cf934c58f238453db247f83a3 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Thu, 13 Jun 2024 13:25:40 -0600 Subject: [PATCH 2/2] Fix `autoresize_min_height` console warning Prior to this change,`tinymceEditor.settings` was evaluating to `undefined`. Also, TinyMCE replaced `autoresize_min_height` replaced with `min_height` with the release of v5. We have `min_height` included in our defaultOptions object within `app/javascript/src/utils/tinymce.js`. The value of `min_height` appears to be performing the functionality that this removed code was attempting to. This change is more comprehensively documented here: https://github.com/DMPRoadmap/roadmap/issues/3424#issuecomment-2166552337 --- app/javascript/src/utils/conditionalFields.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/javascript/src/utils/conditionalFields.js b/app/javascript/src/utils/conditionalFields.js index d545a1a099..3ef53d7acb 100644 --- a/app/javascript/src/utils/conditionalFields.js +++ b/app/javascript/src/utils/conditionalFields.js @@ -15,14 +15,6 @@ export default function toggleConditionalFields(context, showThem) { if (container.length > 0) { if (showThem === true) { container.find('.toggleable-field').show(); - - // Resize any TinyMCE editors - container.find('.toggleable-field').find('.tinymce').each((_idx, el) => { - const tinymceEditor = Tinymce.findEditorById($(el).attr('id')); - if (tinymceEditor) { - $(tinymceEditor.iframeElement).height(tinymceEditor.settings.autoresize_min_height); - } - }); } else { // Clear the contents of any textarea select boxes or input fields container.find('.toggleable-field').find('input, textarea, select').val('').change();