Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE shows empty (useless) formatting options by default #154

Open
ScopeyNZ opened this issue Sep 18, 2018 · 6 comments
Open

TinyMCE shows empty (useless) formatting options by default #154

ScopeyNZ opened this issue Sep 18, 2018 · 6 comments

Comments

@ScopeyNZ
Copy link
Contributor

Both "Formats" and "Templates" are options in a TinyMCE editor field. This is slightly weird when there are no templates:

image

But very weird when there are no formats:

image

This was raised in a content author training and I happened to be sitting next to @clarkepaul at the time. I think the opinion was that we should perhaps provide a default "format" but just not even show "templates" by default. @clarkepaul will have to confirm.

@clarkepaul
Copy link
Contributor

If no Formats exist then the option doesn't need to show at all, no need to provide an example. The same applies for Tiny Templates, if none exist then don't provide the option.

@clarkepaul
Copy link
Contributor

This bloats TinyMCE, as well as seeming broken to users it reflects badly on the CMS.

@muskie9
Copy link

muskie9 commented May 17, 2019

Is this still a valid issue? I checked in a fresh install and both templates and format are not showing.

@brynwhyman
Copy link

I believe this is specific to CWP, @muskie9. I'm running the latest cwp/cwp 2.3.x-dev (with silverstripe/cms 4.4.x-dev) and this is still an issue:

image

image

@muskie9
Copy link

muskie9 commented May 21, 2019

Haven't done a whole lot with CWP, but I'll take a peak.

@muskie9
Copy link

muskie9 commented May 21, 2019

So as best I can tell, there is an editor.css that is loaded for the Formats from silverstripe/admin: client/dist/styles/editor.css. While that file isn't empty the style just seems to be used if a link is broken (red background). If I add the Simple theme, TinyMCEConfig::getEditorCSS() does include both the admin file as well as the file in the Simple theme. The Simple theme file adds its class to the format dropdown.

This makes me wonder a couple things:

  • Why isn't the admin module style loaded to the format dropdown
  • Should TinyMCEConfig detect if no other editor.css files are loaded, and if not, remove the format dropdown. I'm not sure if this is actually possible with how things work or if it would have unintended results.

If I get pointed in the right direction on the what and where for this if the latter would be preferred I can dig around a bit and see what I can come up with.

In the mean time, you could probably remove the format dropdown from your installation in an app/_config.php file.

$cwpEditor = \SilverStripe\Forms\HTMLEditor\HTMLEditorConfig::get('cwp');
$cwpEditor->removeButtons('styleselect');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants