Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82831

Theme's custom CSS styles cannot be used inside TinyMCE Editor iframe

XMLWordPrintable

    • MOODLE_403_STABLE, MOODLE_404_STABLE

      When using the TinyMCE editor across the site, any custom CSS style definitions set in our theme cannot be used inside the editor's iframe. That prevents users from seeing what text with custom CSS styling set will actually look like.

      Our particular use case is with questions in Quiz activity, using custom CSS to optimise display of other languages. Given that we are teaching ancient languages in a non-native speaking context, setting specific fonts & increasing text size is extremely helpful!

       

      Steps to reproduce:

      • Use the TinyMCE text editor on your site
      • In the currently used theme, go to Advanced Settings > Raw SCSS & add a style definition to change the font and font-size for a particular class.
        • e.g. ".gentium {     font-family: "Gentium", "Athelas", "Times New Roman", serif;     font-size: 1.4rem; }

          "

      • In a Quiz activity, start making a new Question & editing the Question Text.
      • Use the HTML view to add a style to some text
        • e.g. <p class='gentium'>χαιρετε</p>

      Expected result is that the WYSIWYG text editor will show the text as it will appear in the Quiz, with custom CSS styles applied.

      Actual result is that custom CSS styles are not applied.

       

      Quite possible that I've missed some key config or steps to make this possible, but I couldn't find anything clear or accessible about how to do this.

        1. image-2025-02-20-15-20-27-735.png
          57 kB
          pd431
        2. image-2025-02-20-15-20-52-770.png
          42 kB
          pd431
        3. image-2025-02-20-15-21-09-763.png
          30 kB
          pd431
        4. image-2025-02-20-15-22-00-423.png
          38 kB
          pd431
        5. MDL-82831_gentiumplus_after.png
          8 kB
          Meirza
        6. MDL-82831_gentiumplus_before.png
          8 kB
          Meirza
        7. Question-display-example.png
          34 kB
          Matt Williams
        8. TinyMCE-edit-example.png
          29 kB
          Matt Williams
        9. TinyMCE-edit-example-1.png
          29 kB
          Matt Williams

            Unassigned Unassigned
            matithyah Matt Williams
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 59 minutes
                59m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.