question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hilitecolor / Forecolor custom formats can not produce valid css class

See original GitHub issue

What is the current behavior? Describe the bug

Forecolor / Hilitecolor use inline styles to set color. We want custom css classes to do this. But using custom formats to create a css class produces invalid css classes, as the value always returns a ‘#’

using following will always produce invalid css hilitecolor: { inline: 'span', classes: 'hilitecolor-%value' }, forecolor: { inline: 'span', classes: 'forecolor-%value' },

** steps to reproduce **

http://fiddle.tiny.cloud/qrhaab

What is the expected behavior?

We can use custom formats to produce valid css, by removing “#” from the substituted value

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE? All versions of 5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lostkeyscommented, Aug 28, 2020

Alright, sounds like your on a path to a solution. Here are more ideas on how to create custom menus and toolbars for choosing colors. Inpect the source code for detailed documentations. https://tinymce.github.io/tinymce-demos/tinymce-basics/custom-toolbar-button-menu-and-context-toolbar.html https://tinymce.github.io/tinymce-demos/tinymce-basics/customizing-the-table-toolbar.html

0reactions
jburghardtcommented, Aug 28, 2020

Looking at the style formats, i think this is the way to go instead of using background-color.

with the Hilitecolor we actually want to use produce something like “<mark> test </mark>” instead of setting the background color.

Read more comments on GitHub >

github_iconTop Results From Across the Web

formats - TinyMCE
This example overrides some of the built in formats and tells TinyMCE to apply classes instead of inline styles. It also includes a...
Read more >
How to add a highlight color option to TinyMCE? - ProcessWire
I have a client who requested the ability to highlight text (basically change the CSS background color between a few options).
Read more >
CSS Variables — No, really! - Medium
Recall that CSS variables are just property/value pairs; you define them exactly as you would properties of any valid selector, except with ...
Read more >
Dijit Editor - Archived Tutorial - Dojo Toolkit
Dijit's Editor widget is everything a developer looks for in a WYSIWYG editor: ... The class doesn't actually have to be applied to...
Read more >
CSS class selectors not changing anything - Stack Overflow
It's because your class names begin with number, which is not allowed in CSS. Revert the name and number, eg: .sec5{ color: green;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found