Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#31998 closed defect (bug) (fixed)

wp.mce.views with focus causes JS errors when toggling visual editor view

Reported by: Clorith Owned by: azaozz
Priority: normal Milestone: 4.2
Component: TinyMCE Version: 4.2
Severity: normal Keywords: has-patch commit
Cc: Focuses: javascript

Description

As reported by @maniu in https://wordpress.org/support/topic/wpmceviews-update-switching-visualtextvisual-causes-appendchild-js-error

When switching views between visual and text mode in the post editor the visual editor will fail to render upon toggle if a view was currently active/had focus when you moved away from the visual mode.

In previous versions we appear to move the focus in the editor to the first point before the view element when we change views.

Attachments (1)

31998.patch (863 bytes ) - added by azaozz 11 years ago.

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
11 years ago

  • Summary wp.mce.views with focus causes JS errors when toggeling visual editor viewwp.mce.views with focus causes JS errors when toggling visual editor view

#2 @azaozz
11 years ago

  • Component EditorTinyMCE
  • Milestone Awaiting Review4.2

Caused by trying to remove a view that doesn't exist any more as we reload the editor content (and recreate all views) on switching Text => Visual.

@azaozz
11 years ago

#3 @azaozz
11 years ago

In 31998.patch:

  • Remove selected views when inserting content but not when loading all content.
  • Remove the ref. to the selected view node on resetting the views.

This ticket was mentioned in Slack in #core-editor by azaozz. View the logs.


11 years ago

#5 @iseulde
11 years ago

  • Keywords has-patch added

Patch works well here and solves the problem.

#6 @ocean90
11 years ago

  • Keywords commit added

Looks good.

#7 @azaozz
11 years ago

  • Owner set to azaozz
  • Resolutionfixed
  • Status newclosed

In 32140:

TinyMCE wpView:

  • Remove selected views when inserting content but not when loading all content.
  • Remove the ref. to the selected view node on resetting the views.

Fixes #31998.

#8 follow-up: @ianatkins
11 years ago

Did this make it into 4.2.2? I'm experiencing similar issues.

#9 in reply to: ↑ 8 @azaozz
11 years ago

Replying to ianatkins:

Of course: https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/js/tinymce/plugins/wpview/plugin.js#L186

If you're seeing similar problems, please open a new ticket with steps to reproduce.

Note: See TracTickets for help on using tickets.