portagenetwork / roadmap

Developed by the the Alliance in collaboration with University of Alberta, DMP Assistant a data management planning tool, forking the DMP Roadmap codebase
MIT License
6 stars 1 forks source link

TinyMCE Related Console Warnings #793

Open aaronskiba opened 2 weeks ago

aaronskiba commented 2 weeks ago

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0) 4.1.1+portage-4.1.0-uat-3 4.1.1+portage-4.1.0-alpha-2

Actual behaviour:

aaronskiba commented 2 weeks ago

The current production instance, 4.0.2+portage-4.0.4, is using "tinymce": "^5.10.9",. The following deprecation warning is visible there: Screenshot from 2024-06-10 11-30-09

(There is no autoresize_min_height warning/error there.)

aaronskiba commented 2 weeks ago

DMPRoadmap v4.1.0 included the upgrade to TinyMCE v6 https://github.com/DMPRoadmap/roadmap/releases/tag/v4.1.0. Our codebase upgraded to TinyMCE v7 via the following Dependabot security PR: https://github.com/portagenetwork/roadmap/pull/704

The following TinyMCE console warnings are rendered for DMPRoadmap v4.2.0 (using "tinymce": "^6.4.1"): Screenshot from 2024-06-12 12-56-13 Screenshot from 2024-06-12 13-15-42

So even if Portage Network were to revert from TinyMCE v7 back to TinyMCE v6, the same console warnings would still render.

aaronskiba commented 2 weeks ago

Resources:

https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/

forced_root_block: ''
Option
forced_root_block must be a non-empty string and cannot take a value of false.

https://www.tiny.cloud/docs/tinymce/latest/migration-from-6x/

https://www.tiny.cloud/docs/tinymce/5/6.0-upcoming-changes/#disablingthedeprecationwarning

https://github.com/tinymce/tinymce/discussions/7342

aaronskiba commented 2 weeks ago

forced_root_block: '' seems to default to forced_root_block: 'p', which is the same behaviour as not explicitly stating the forced_root_block: arg at all.

rails assets:clobber && rails assets:precompile was executed between code changes:

forced_root_block: ''

// app/javascript/src/superAdmin/notifications/edit.js
$(() => {
  Tinymce.init({ selector: '#notification_body', forced_root_block: '' });

Screenshot from 2024-06-12 15-40-28

3.0.5 :001 > Notification.last.body
  Notification Load (0.7ms)  SELECT "notifications".* FROM "notifications" ORDER BY "notifications"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => "<p>Test 1</p>" 
3.0.5 :002 > 

forced_root_block: 'div'

// app/javascript/src/superAdmin/notifications/edit.js
$(() => {
  Tinymce.init({ selector: '#notification_body', forced_root_block: 'div' });

Screenshot from 2024-06-12 15-44-21

3.0.5 :002 > Notification.last.body
  Notification Load (1.9ms)  SELECT "notifications".* FROM "notifications" ORDER BY "notifications"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => "<div>Test 2</div>" 
3.0.5 :003 > 

forced_root_block: 'p'

$(() => {
  Tinymce.init({ selector: '#notification_body', forced_root_block: 'p' });

Screenshot from 2024-06-12 15-46-38

3.0.5 :003 > Notification.last.body
  Notification Load (1.6ms)  SELECT "notifications".* FROM "notifications" ORDER BY "notifications"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => "<p>Test 3</p>" 
3.0.5 :004 > 

Without forced_root_block: arg

$(() => {
  Tinymce.init({ selector: '#notification_body' });

Screenshot from 2024-06-12 15-50-02

3.0.5 :004 > Notification.last.body
  Notification Load (2.0ms)  SELECT "notifications".* FROM "notifications" ORDER BY "notifications"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => "<p>Test 4</p>" 
3.0.5 :005 >