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
Styles-Dropdown shows "Paragraph" instead of "Formats" as empty-value #9186
Comments
Duplicate of #8737 |
Copying my comment in from #8737 (comment):
|
I've re-opened and let you decide, if it's worth keeping open |
We have the same issue, and since we use both the blocks select and the formats select right next to each other, having two of the same dropdown right next to each other, is extremely confusing for the users. I have made a very hacky temporary fix, which works by finding the correct select based of the title tag and then using a mutation observer to fix the textContent whenever no format is selected: function observeAndFixStyleFormatLabel() {
const formatTranslation = tinyMCE.translate('Formats');
const paragraphTranslation = tinyMCE.translate('Paragraph');
const targetNode = document.querySelector(`.tox-tbtn--select[title*="${formatTranslation}"], .tox-tbtn--select[title*="Formats"]`);
const labelSelector = ".tox-tbtn__select-label";
if (!targetNode) {
return;
}
const fixStyleFormatLabel = (node) => {
const labelNode = node.matches(labelSelector) ? node : node.querySelector(labelSelector);
if (!labelNode || labelNode.textContent.trim() !== paragraphTranslation) {
return false;
}
labelNode.textContent = formatTranslation;
return true;
}
const mutationCallback = (mutationsList, observer) =>
mutationsList.some(mutation => mutation.type === 'childList' && fixStyleFormatLabel(mutation.target));
const observer = new MutationObserver(mutationCallback);
const config = {childList: true, subtree: true};
// Apply intial fix if necessary
fixStyleFormatLabel(targetNode);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);
};
// On tinymce init event
function handleInitEvent() {
observeAndFixStyleFormatLabel();
} Obviously this falls apart easily and it would be much preferred, if the standard functionality was to have a translatable standard label / text for each of these dropdowns. |
+1 for this issue. We should be able to specify the 'label' of the styles dropdown. kinglozzer's hack above is almost good enough, but has the downside of seeing the label as the selected first option... |
Yes, please fix this - it's confusing and makes the interface look amateur, especially when I have to explain to clients. |
@Leilahodgkins please calm down. TinyMCE is not "amateur" and has operated this way since 2018. Apologies for the lack of updates, it took a while to trace through what happened. This was a design change in TinyMCE 5. The entire contents of what is now the Later, there was a complaint (#4619) that the dropdown didn't have a default value when the cursor format was not in the list. The designers at the time chose We can (and probably should) consider using tinymce/modules/tinymce/src/themes/silver/main/ts/ui/core/complex/StylesBespoke.ts Line 22 in 602d339
This won't help interfaces that show both, but our recommendation is still to not show both. |
Thanks for your response Spyder. I admit I'm a bit confused: Are you suggesting that blocks and styles should NOT be used together?? But we merge them all into styles? I disagree that the Format dropdown (for setting and element to para, H2, div, etc) should be mixed up with Styles. I think it should work like the semantic distrinction between content type and visual appearance. Also, if we merge these two then we would have to create each style (say a backgroun highlight colour) for every element type we want that style applied to... That's bother very prescriptive as well as labour-intensive.... Moreover the Block Formats are a single selection dropdown, while the Styles dropdown allows for multiple selections. These are two different types of interaction. I think all everyone on this issue is asking for is for a non-applicable label (ie: can't be set for an element) at the top as a default that simply says 'Style'. In other words: please just change the word 'Paragraph' in the styles dropdown to: 'Style'. Keep 'Format' for the menu navigation, but for the toolbar styles drowndown, please just change 'Paragraph' to 'Style'. |
It's not that they merge, it's that everything on the The ticket I've logged internally is only to swap the fallback to |
If it says |
Thanks for the responses above. I apologise for using the word 'amateur'. I truly did not intend to mean that the software or people working on it were not professional, only that this small detail may look that way on the surface to people who don't understand what is going on. For what it's worth, I find both dropdowns useful because the simpler 'Paragraph' dropdown (with the paragraph and heading styles) is a super quick way to add headings or change a heading back into a paragraph. The other one with all the formats and styles is great because I can put custom styles in there and the position in the toolbar is convenient - I just wish they didn't both have the same label (or appear to have the same label) :-) 'Format' in the menu does almost the same thing so I can see why you say you don't need both but the toolbar dropdown is easier to use because it has fewer options. |
We also use the two dropdowns in a similar manner to @richardczeiger I have made a recording showing the setup in use. From my point of view the issue boils down to a single needed change as well: @TheSpyder Maybe instead of the concept of a fallbackFormat, could you instead supply all dropdowns with a "label" or "default label/selection" that can be translated and have that be the "fallback" value? The block format menu should be able to correctly identify whether the selection is a Paragraph, an item in the block_format list or an element not in the list in which case maybe the term Element or Block is more appropriate as the fallback value for that specific dropdown - and that would also be the "label" for the dropdown anyway right? |
@richardczeiger this dropdown does support bold and italic. It supports any "format", even if a lot of the time all it's configured to show is styles (and the config name change reflects that). It looks like we might be able to change the fallback to |
That's great news Spyder! |
Just merged in #9423. v7 should be out within a month, but the nightly build (and the |
Styles-Dropdown (formerly styleselect) displays "Paragraph" as empty value. Previously, it was "Formats". This behavior seems to be consistent across different languages.
https://k5jp2r.csb.app/
✔️ Expected result
Styles-Dropdown shows "Formats" as empty value.
❌ Actual result
Styles-Dropdown shows "Paragraph" as empty value.
📃 Other details
Firefox 119.0.1 on Mac
I'm using Tiny with Silverstripe. It used to be "Formats" with v4 (Tiny 4.9) and now is "Paragraph" with v5 (Tiny 6.5).
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: