Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#38849 closed defect (bug) (fixed)

Shortcode wpview's toolbar appears while no view is selected

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

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 10 years ago.
Check view selected on setting toolbar and always resposition and show.

Download all attachments as: .zip

Change History (14)

#1 @swissspidy
10 years ago

  • Keywords needs-screenshots added

#2 @danielbachhuber
10 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
10 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
10 years ago

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

@gitlost
10 years ago

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

#5 @gitlost
10 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
10 years ago

#37753 was marked as a duplicate.

#7 @azaozz
10 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
10 years ago

  • Milestone Future Release → 4.8

#9 @azaozz
10 years ago

  • Owner set to azaozz
  • Resolution → fixed
  • Status new → 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
10 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
10 years ago

  • Resolution fixed
  • Status closed → 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
10 years ago

  • Resolution → fixed
  • Status reopened → 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
9 years ago

#40618 was marked as a duplicate.

Note: See TracTickets for help on using tickets.