#45221 closed defect (bug) (fixed)
Fix the TinyMCE init array in script-loader
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | normal | Version: | 5.0 |
Component: | TinyMCE | Keywords: | has-patch commit dev-reviewed fixed-5.0 |
Focuses: | Cc: |
Description
The "TinyMCE init array" in script-loader mostly duplicates the "default" init array in class-wp-editor. However there are few differences that can cause regressions in themes and plugins.
- The init array is outputted by
$scripts->localize()
which is intended only for strings and the output is JSON encoded. This breaks some of the TinyMCE settings (added by plugins) as they must be raw js. For example the setting forinit_instance_callback
must be a "callable" js function, or it throws exception on loading. - Currently in script-loader there is some code that does JSON decoding of the
style_formats
setting. However that may not be JSON encoded resulting in an JSON decode error and an empty string.
Attachments (1)
Change History (14)
#2
@
6 years ago
- Summary changed from FIx the TInyMCE init array in script-loader to Fix the TinyMCE init array in script-loader
#5
follow-up:
↓ 6
@
6 years ago
- Keywords dev-reviewed added
- Owner set to azaozz
- Status changed from new to assigned
I agree that we'll need to revisit this to reduce the code duplication, but I'm not particularly concerned about that for now.
45221.diff is good to commit.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
6 years ago
#9
@
6 years ago
- Keywords fixed-5.0 added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for trunk.
#10
follow-up:
↓ 11
@
6 years ago
- Keywords needs-patch added; has-patch removed
- Severity changed from normal to major
- Version set to 5.0
Unfortunately I am still having issues with TinyMCE with WordPress 5.0. It runs into js script errors that I have fixed due to permission issues on my end. However using the Classic WP editor as suggested via wordpress.org the Toolbar buttons do not appear on visual mode. I tested on different browsers and the same result. I thought I would share this information
In 45221.diff:
style_formats
setting.The patch also copies the way the init array is outputted from class-wp-editor.php to script-loader.php. Perhaps it would be better to keep all of this in class-wp-editor.php instead of (partially) copying it to script-loader.php.