Open indigoxela opened 1 month ago
A quick experiment... this would only require some lines of code in tinymce-integration.js, as TinyMCE has an option for that - content_style. Fancy.
if (Backdrop.settings.icons) {
let inlineStyle = ':root{';
for (const [key, value] of Object.entries(Backdrop.settings.icons)) {
inlineStyle += '--icon-' + key + ':url(' + value + ');';
}
inlineStyle += '}';
options.content_style = inlineStyle;
}
It works! But the question's still: does it make sense to add that?
My PR provides a "bridge" between main page and iframe, by attaching the icon definitions from one as TinyMCE option for the other.
It might still be an edge case, but isn't much overhead, either.
Maybe an edge case, maybe not...
Icon definitions attached to pages are unknown in the editor iframe. Should they be available?
Example use-case: a theme defines some styles for a tag that needs an icon URL for a mask. The CSS can get attached, but the definitions for icon URLs aren't, as that's a js setting.
Need to think this over a bit.