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

Icon API: icons via backdrop_add_icon() aren't available in editor content #102

Open
indigoxela opened this issue May 29, 2024 · 2 comments · May be fixed by #103
Open

Icon API: icons via backdrop_add_icon() aren't available in editor content #102

indigoxela opened this issue May 29, 2024 · 2 comments · May be fixed by #103
Labels
needs - more feedback This issue needs more input from others status - has pull request This issue has a Pull Request

Comments

@indigoxela
Copy link
Member

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.

@indigoxela
Copy link
Member Author

indigoxela commented May 29, 2024

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?

@indigoxela
Copy link
Member Author

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.

@indigoxela indigoxela added the needs - more feedback This issue needs more input from others label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs - more feedback This issue needs more input from others status - has pull request This issue has a Pull Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant