WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#17501 closed defect (bug) (fixed)

Javascript errors in press this

Reported by: greuben Owned by: azaozz
Milestone: 3.2 Priority: normal
Severity: major Version:
Component: Press This Keywords: has-patch needs-testing
Focuses: Cc:

Description

On press this click embed video, insert some code and click insert video. An error is thrown in Chrome and the box does not close

Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3

Attachments (2)

17501.diff (598 bytes) - added by greuben 4 years ago.
17501.2.diff (620 bytes) - added by greuben 4 years ago.

Download all attachments as: .zip

Change History (8)

@greuben4 years ago

comment:1 @nacin4 years ago

  • Milestone changed from Awaiting Review to 3.2

comment:2 @azaozz4 years ago

The first arg. for execInstanceCommand() should be the editor ID which is the same as the ID of the textarea that was replaced (content), so the proposed patch seems to be disabling the cleanup.

@greuben4 years ago

comment:3 follow-up: @greuben4 years ago

Seems like mceCleanup needs selection

Backtrace

Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3
c.create.getBookmark -- tiny_mce.js:1
c.EditorCommands.t.mceCleanup -- tiny_mce.js:1
q -- tiny_mce.js:1
m.create.execCommand -- tiny_mce.js:1
j.EditorManager.d.execCommand -- tiny_mce.js:1
append_editor -- press-this.php:161
(anonymous function):4
f.event.handle -- jquery.js:17
f.event.add.k.i.handle.k -- jquery.js:16

Code

mceCleanup : function() {
	var bookmark = selection.getBookmark(); // the errors occurs here
	editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});
	selection.moveToBookmark(bookmark);
},

@azaozz: can you confirm if the latest patch is working? see 17501.2.diff

comment:4 @westi4 years ago

  • Keywords needs-testing added
  • Owner set to azaozz
  • Status changed from new to reviewing

Assigning to azaozz for review, testing and commit/!commit call.

comment:5 in reply to: ↑ 3 @azaozz4 years ago

Replying to greuben:

Seems like mceCleanup needs selection
...
@azaozz: can you confirm if the latest patch is working? see 17501.2.diff

Yes, seems to be working. I dug a bit deeper and think we can skip the forced mceCleanup completely. That seems to happen automatically in this version of TinyMCE. Please reopen if there are still issues when adding videos or images in Press This.

comment:6 @azaozz4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In [18155]:

Fix JS error in Press This, props greuben, fixes #17501

Note: See TracTickets for help on using tickets.