WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9840 closed defect (bug) (fixed)

buttons on 4th line don't get added if 3rd line is empty

Reported by: Denis-de-Bernardy Owned by: azaozz
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: TinyMCE Keywords: has-patch tested commit
Focuses: Cc:

Description

I'm not entirely sure this is due to WP or TinyMCE, but:

add_filter('mce_buttons_3', 'my_editor_button'); // adds the button

add_filter('mce_buttons_4', 'my_editor_button'); // ignores the button

I'm pretty sure we can work around this if it is TinyMCE-related -- patch I've in mind coming up in a bit if it works.

Attachments (2)

9840.diff (778 bytes) - added by Denis-de-Bernardy 5 years ago.
9840.1.diff (847 bytes) - added by azaozz 5 years ago.

Download all attachments as: .zip

Change History (12)

Denis-de-Bernardy5 years ago

comment:1 Denis-de-Bernardy5 years ago

  • Keywords has-patch tested commit added

patch does the following:

  • it fetches the non-empty lines of button
  • it reindexes the tinymce buttons so that no empty line exists before one that is full

comment:2 Denis-de-Bernardy5 years ago

  • Owner changed from azaozz to Denis-de-Bernardy
  • Status changed from new to accepted

comment:3 Denis-de-Bernardy5 years ago

any odds we can get this committed? it's a trivial patch that, like quite a few in the commit candidates, is just standing there, and actually fixes a bug?

comment:4 ryan5 years ago

  • Owner changed from Denis-de-Bernardy to azaozz
  • Status changed from accepted to assigned

comment:5 azaozz5 years ago

This is a very rare bug and it's possible to be handled on the plugin level. Perhaps can check if buttons3 is empty when buttons4 is not and switch them. Not sure that it needs two extra loops there.

comment:6 Denis-de-Bernardy5 years ago

they're mostly free loops, both from a memory standpoint and a from performance standpoint. tiny arrays, 4 items each.

please close if you don't plan to fix it in 2.8, so I know where to stand with the two plugins of mine that need to deal with it.

azaozz5 years ago

comment:7 azaozz5 years ago

Perhaps can test when row 2 or 3 is empty and move the next one up. Still not fully convinced we need this but hopefully it will reduce some support requests.

comment:8 Denis-de-Bernardy5 years ago

well, the bullet-proof solution is the one I uploaded, but yours works too and is sane from a statistical standpoint. I'll be happy either way, provided it's managed by WP. ;-)

comment:9 azaozz5 years ago

Rows 1 and 2 are used by default so plugins would normally use row 3 for many extra buttons. Haven't seen plugin that adds buttons to row 4 but since it might happen and is not handled in the js, adding a check for rows 3 and 4 only.

comment:10 azaozz5 years ago

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

(In [11515]) Move buttons from row 4 to row 3 in the editor when row 3 is empty, fixes #9840

Note: See TracTickets for help on using tickets.