WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 7 years ago

#9841 closed enhancement (fixed)

TinyMCE's kitchen sink button should also hide lines 3 and 4 when present

Reported by: Denis-de-Bernardy Owned by: azaozz
Milestone: 3.9 Priority: normal
Severity: minor Version: 2.8
Component: TinyMCE Keywords: has-patch needs-testing
Focuses: Cc:

Description

Currently, adding a button to line 3 or 4 of TinyMCE results in their always being present.

Would it be possible/desirable to make the hide as well?

Attachments (4)

editor_plugin.dev.js.diff (2.8 KB) - added by trepmal 9 years ago.
allows kitchen sink/wp_adv to hide 3rd and/or 4th rows if they exist
editor_plugin.dev.js.2.diff (3.3 KB) - added by trepmal 9 years ago.
toggles rows 2-4
editor_plugin.dev.js (13.5 KB) - added by luckykind 9 years ago.
toggles any additional rows added after the first one
editor_plugin.dev.js.3.diff (2.8 KB) - added by luckykind 9 years ago.
toggles any additional rows added after the first one (first file wasn't diff file... noob)

Download all attachments as: .zip

Change History (17)

#1 @azaozz
11 years ago

  • Milestone changed from 2.8 to Future Release

There are some more options for the TinyMCE's toolbars, can probably look at that for 2.9+.

#3 @MadtownLems
11 years ago

  • Cc MadtownLems added

This is a great suggestion. I've tried to do it myself with no luck. As more and more plugins with buttons are developed, this becomes more and more important.

I strongly support this feature request!

#4 @Viper007Bond
11 years ago

I'd recommend line 3 being hidden and line 4 being not. That'd result in two lines always on and two togglable. I'd say make 1/2 always on, but that'd break backwards compatbility more so.

#5 follow-up: @Denis-de-Bernardy
11 years ago

@Viper: good idea. there's a potential TinyMCE bug if we do that, though, if line 3 is empty but line 4 is not.

#6 in reply to: ↑ 5 @azaozz
11 years ago

Replying to Denis-de-Bernardy:

...there's a potential TinyMCE bug if we do that, though, if line 3 is empty but line 4 is not.

That was fixed some time ago https://core.trac.wordpress.org/browser/trunk/wp-admin/includes/post.php#L1460

#7 @Denis-de-Bernardy
11 years ago

@azaozz: yes, I remembered how you "fixed" it, and that's precisely why I'm raising it here.

With the patch that you applied, Viper's idea becomes broken, because line 4 would become line 3, and thus be invisible.

@trepmal
9 years ago

allows kitchen sink/wp_adv to hide 3rd and/or 4th rows if they exist

#8 @trepmal
9 years ago

  • Keywords has-patch needs-testing added

I'm no JS guru, so I'm sure someone else can clean this up.

But as it is, it appears to work nicely for hiding the 3rd and/or 4th row of buttons in the Visual Editor's toolbar, if they exist.

(Side note: the .dev version was not loaded when SCRIPT_DEBUG was set to true. see #16578)

@trepmal
9 years ago

toggles rows 2-4

#9 @trepmal
9 years ago

I still find it awkward that the kitchen sink only toggles the second row, even when there are additional buttons on rows 3 and/or 4.

@luckykind
9 years ago

toggles any additional rows added after the first one

#10 follow-up: @luckykind
9 years ago

piggybacked off of @trepmal edits and made it so it will toggle any number of button bars (infinite) after the first one... really would be nice to get this pushed.

@luckykind
9 years ago

toggles any additional rows added after the first one (first file wasn't diff file... noob)

#11 in reply to: ↑ 10 ; follow-up: @azaozz
9 years ago

Replying to luckykind:

Yes, that would work although I would probably hide/show all toolbars (table.mceToolbar) at once. TinyMCE has pretty good DOM traversing and selection API similar to jQuery's, look at the tinymce.DOM methods.

Still thinking this is plugin material as you cannot have 3rd and 4th toolbar without using a plugin.

#12 in reply to: ↑ 11 @luckykind
9 years ago

Replying to azaozz:

Replying to luckykind:

Still thinking this is plugin material as you cannot have 3rd and 4th toolbar without using a plugin.

Sorry, I don't understand what you mean here... I tested this adding additional toolbars (well over 3 or 4) and it worked perfectly fine without a plugin. Even without this I can add additional toolbars without a plugin, they're just not hidden like the kitchen sink items. It would be nice to have one visible toolbar and any additional toolbars hidden and toggled by the kitchen sink button. That is what the patch I added does. If there's a better way to code it... feel free to change it, but the logic behind the functionality is there.

#13 @azaozz
7 years ago

  • Milestone changed from Future Release to 3.9
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in the TinyMCE 4.0 upgrade [26876].

Note: See TracTickets for help on using tickets.