WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 2 years ago

#29216 closed defect (bug) (fixed)

Cannot read previousSibling of null when inserting wp-view.

Reported by: programmin Owned by:
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.9
Component: TinyMCE Keywords:
Focuses: ui, javascript Cc:

Description

Steps to find the bug (WP 4.0 beta3):

1) Start a post with this in text editor:

<div>hello</div>
<div>goodbye</div>

2) With cursor at the start of the second line ("goodbye"), Go to add media, and insert a gallery or audio playlist.

3) Notice that an exception is thrown:

Uncaught TypeError: Cannot read property 'previousSibling' of null wp-tinymce.php?c=1&ver=4102-20140721:8
C.mceInsertContent wp-tinymce.php?c=1&ver=4102-20140721:8
v wp-tinymce.php?c=1&ver=4102-20140721:7
N.execCommand wp-tinymce.php?c=1&ver=4102-20140721:10
send_to_editor load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:1031
wp.media.editor.insert load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:604
(anonymous function) load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:604
k load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:384
b.Events.trigger load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:384
toolbar.set.d.view.Toolbar.items.insert.click load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:602
d.view.Button.d.View.extend.click load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:602
m.event.dispatch load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2&ver=4.0-beta3:3
r.handle load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils,plupload,json2&ver=4.0-beta3:3

Oddly enough the wp-view seems to work normally immediately after, but there was major breakage when using editor in Tinymce-inline mode after this exception.

Attachments (1)

Screen Shot 2015-04-24 at 12.41.46.png (46.9 KB) - added by iseulde 3 years ago.

Download all attachments as: .zip

Change History (10)

#1 @ocean90
4 years ago

  • Keywords needs-patch added
  • Version changed from trunk to 3.9

Confirmed, but could reproduce it in 3.9 too.

Stack:

Uncaught TypeError: Cannot read property 'previousSibling' of null tinymce.js?ver=4103-20140809:19843
addCommands.mceInsertContent tinymce.js?ver=4103-20140809:19843
execCommand tinymce.js?ver=4103-20140809:19391
Editor.execCommand tinymce.js?ver=4103-20140809:29430
send_to_editor media-upload.js?ver=4.0-beta4-src:23
wp.media.editor.insert media-editor.js?ver=4.0-beta4-src:769
(anonymous function) media-editor.js?ver=4.0-beta4-src:849
triggerEvents backbone.js?ver=1.1.2:207
Backbone.Events.trigger backbone.js?ver=1.1.2:148
toolbar.set.media.view.Toolbar.items.insert.click media-views.js?ver=4.0-beta4-src:2799
media.view.Button.media.View.extend.click media-views.js?ver=4.0-beta4-src:4273
m.event.dispatch jquery.js?ver=1.11.1:3
r.handle jquery.js?ver=1.11.1:3

This ticket was mentioned in IRC in #wordpress-dev by sathishn1. View the logs.


4 years ago

#3 @iseulde
3 years ago

  • Component changed from Editor to TinyMCE

#4 @bfintal
3 years ago

Still exists in 4.1.2

#5 @bfintal
3 years ago

  • Keywords needs-testing added; needs-patch removed

I've been testing with trunk and the issue seems to be gone

Last edited 3 years ago by bfintal (previous) (diff)

#6 @iseulde
3 years ago

The error seems to be gone. However, inserting a view in a div is still very buggy. They're not made for it. See screenshot.

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


2 years ago

#8 @iseulde
2 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 4.6

This seems now entirely resolved after [36434].

#9 @iseulde
2 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.