[wp-trac] [WordPress Trac] #43012: Cannot Update Post in Firefox Due to Editor and TinyMCE JavaScript TypeErrors
WordPress Trac
noreply at wordpress.org
Tue Jan 2 20:48:58 UTC 2018
#43012: Cannot Update Post in Firefox Due to Editor and TinyMCE JavaScript
TypeErrors
--------------------------+-----------------------------
Reporter: johnschulz | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.9.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I'm using Firefox 58, on OSX 10.12.6 (Sierra). On a WP 4.9.1 site, I'm
experiencing issues making changes and saving a post due to an apparent WP
Editor/TinyMCE/Firefox bug. When I make changes to a post and then
attempt to Update the post, I get the following error in the console:
{{{TypeError: a is null}}} from {{{wp-admin/js/editor.min.js}}}.
The code seems to revolve around this piece of code: {{{var
b=a.getWin(),c=b.getSelection();if(!(c.rangeCount<=0)){var
d="SELRES_"+Math.random()}}}. If I add a null check for the c variable
before trying to check the rangeCount like this
{{{if(!(!c||c.rangeCount<=0))}}} I don't get errors from editor.min.js.
However, I then get a similar error from {{{wp-
includes/js/tinymce/tinymce.min.js}}}.
The following code, similarly, seems to be the issue:
{{{d=c.rangeCount>0}}}. And similarly a null check clears that TypeError
as well: {{{d=(!c||c.rangeCount>0)}}}.
With both of those changes, the changes to the post can be Updated
successfully.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43012>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list