Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#38849 closed defect (bug) (fixed)

Shortcode wpview's toolbar appears while no view is selected

Reported by: bduclos's profile bduclos Owned by: azaozz's profile azaozz
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.6.1
Component: TinyMCE Keywords: has-screenshots has-patch
Focuses: javascript Cc:

Description

When you copy paste a shortcode wpview, the toolbar with the edit/delete buttons appears above the pasted view while the view is not selected (clicking on the buttons does nothing).

It also happens when you refresh a page and the first element of the editor is a shortcode view.

Bugs on all browsers in Trunk and WP4.6

Attachments (1)

38849.patch (1.2 KB) - added by gitlost 8 years ago.
Check view selected on setting toolbar and always resposition and show.

Download all attachments as: .zip

Change History (14)

#1 @swissspidy
8 years ago

  • Keywords needs-screenshots added

#2 @danielbachhuber
8 years ago

I'm pretty sure I've seen this too, although I wasn't able to track down the cause when I looked into it.

#3 @bduclos
8 years ago

  • Keywords has-screenshots added; needs-screenshots removed

Steps to reproduce:
Click on the Add Media button to create and insert a gallery. Copy the gallery view (Ctrl+C) and paste it after (Ctrl+V).

Result:
The toolbar with the edit/delete buttons appears above the pasted view while the view is not selected. Clicking on the edit or delete buttons does nothing. However if you click on the view to select it, the buttons work normally.

http://i.imgur.com/521Rkdx.gif

#4 @swissspidy
8 years ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 4.6.1

@gitlost
8 years ago

Check view selected on setting toolbar and always resposition and show.

#5 @gitlost
8 years ago

  • Keywords has-patch added; needs-patch removed

The patch checks that the view is selected before setting the toolbar on the wptoolbar event in "tinymce/plugins/wpview/plugin.js".

There's also a change to the nodechange action in "tinymce/plugins/wordpress/plugin.js" just after it fires the wptoolbar event, to make sure the toolbar is repositioned and shown always, in case a selected view is scrolled out of view and then a different (visible!) view selected, which could have resulted in the toolbar not displaying on the newly selected view.

#6 @azaozz
8 years ago

#37753 was marked as a duplicate.

#7 @azaozz
8 years ago

I'm able to reproduce this every time now. It's triggered by firing multiple nodechange events in the editor. This event is used to set or refresh the inline toolbar and seems to error out when it is fired more than once for the same element, especially after the initial loading of HTML in the editor.

Looking at 38849.patch, don't think we need to change the floating toolbar code. It is enough to check whether the selection is collapsed when a wpview node is selected.

#8 @azaozz
8 years ago

  • Milestone changed from Future Release to 4.8

#9 @azaozz
8 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 39904:

TinyMCE: prevent the inline toolbar from appearing on partially selected wpview nodes. This can happen when HTML is initially loaded in the editor and wpview is the first node, or sometimes on repeatedly pasting the same wpview.

Props gitlost.
Fixes #38849.

#10 follow-up: @gitlost
8 years ago

I suppose you could consider it a different bug but I just checked again and can reproduce the second scroll issue on Firefox/Chrome on Ubuntu, Safari/Firefox/Chrome on macOS, and Edge/Firefox/Chrome on Windows 10.

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

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to gitlost:
Yeah, different bug. I thought there was already a ticket for it, but seems not. May as well fix it here.

#12 @azaozz
8 years ago

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

In 39910:

TinyMCE: ensure the inline toolbar is shown and properly positioned when there are several wpview blocks in the editor and the user selects one after the other.

Props gitlost.
Fixes #38849.

#13 @ocean90
7 years ago

#40618 was marked as a duplicate.

Note: See TracTickets for help on using tickets.