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

Editors strip SVG tags in some contexts, not in others

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.11.10, 4.0.4
    • Text editor TinyMCE
    • None
    • MOODLE_311_STABLE, MOODLE_400_STABLE

      SVG tags work fine with Atto in some contexts, at least in topic and forum descriptions, but they get stripped out of quiz answers and forum posts, for example. Any ideas why?

      Here's an example code:

      <svg width="28px" height="29px" viewBox="0 0 28 29" style="background-color: #ffffffff" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7247.8,2526.31 L 7235.8,2535.03 L 7235.8,2238.31 L 7247.8,2247.03 L 7247.8,2526.31 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7299.64,2493 L 7287.64,2493 L 7287.64,2280.33 L 7299.64,2280.33 L 7299.64,2493 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7513.41,2612.61 L 7518,2626.72 L 7235.8,2535.03 L 7247.8,2526.31 L 7513.41,2612.61 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7677.57,2386.67 L 7692.4,2386.67 L 7518,2626.72 L 7513.41,2612.61 L 7677.57,2386.67 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7616.06,2383.14 L 7625.76,2390.19 L 7500.76,2562.25 L 7491.05,2555.2 L 7616.06,2383.14 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7513.41,2160.72 L 7518,2146.62 L 7692.4,2386.67 L 7677.57,2386.67 L 7513.41,2160.72 Z "></path> <path stroke="transparent" fill="#000000" transform="matrix(0.05 0 0 0.05 -359 -105)" d="M 7247.8,2247.03 L 7235.8,2238.31 L 7518,2146.62 L 7513.41,2160.72 L 7247.8,2247.03 Z "></path> </svg>
      

      The above code renders fine in the editor, but once posted, the SVG tags get stripped.

      Atto and TinyMCE (3.11) both have this problem, but they behave a bit differently: Tiny strips the SVG tags off right after clicking "save" in HTML edit mode, both when editing topics and editing forum posts. With Atto, the SVG tags work in topic descriptions and in previews.

      The use case is allowing chemistry students to answer quiz essays with SVG graphics (more precisely HTML SVG cut and pasted from ChemDraw software).

            Unassigned Unassigned
            hwileniu Heikki Wilenius
            Votes:
            5 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:

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