Skip to content

SVG Image and Drawing Support #3452

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

Closed
wants to merge 8 commits into from
Closed

SVG Image and Drawing Support #3452

wants to merge 8 commits into from

Conversation

ssddanbrown
Copy link
Member

@ssddanbrown ssddanbrown commented May 22, 2022

The main intent of this PR is to support SVG images and use SVG-based drawings.
This PR will explore integrating drawings through the use of <embed> tags to allow interactivity.

Related to #1103 and #1170

TODO

  • Support SVG for the standard image gallery.
  • Support SVG format for drawings and make it the default.
  • Update drawing editor logic to use embed tags.
    • WYSIWYG editor support.
    • Markdown editor support.
    • Handle embeds for contained HTML exports.
    • Handle embeds for PDF exports.
  • Testing
    • Ensure old PNG drawings work for all editor functionality.
    • Ensure SVG images are handled/display in exports.

Docs Update

Potentially breaking change: The displayEl of the editor-markdown::setup editor event will now no longer be an iframe, but instead the direct parent wrapper of markdown preview content.

- Adds support for handling drawings as embeds, based on image
  extension.
- Adds additional attribute to drawio elements within editor to prevent
  tinymce replacing embeds with a placeholder.
- Updates how contenteditable is applied to drawio blocks within editor,
  to use proper filters instead of using the SetContent event.
- Also tweaked page editor to not error when the current user does not
  have permission to change editor type.
No longer need to use the iframe sandboxing techniques, since we now have
CSP rules in-place. Means that embed tags can load without CSP
complications.

Causes slight change to contents of `editor-markdown::setup` editor
event data, since we're changing the `displayEl` property.

Updates markdown editor component to make better use of the component
system.
Unfortunately CSP rules will block embeds anyway.
Need to either relax CSP rules on exports, or instead convert to img
tags?

Also cleaned up existing regexes.
@ssddanbrown
Copy link
Member Author

Kind of stuck with this right now, as per my comment here:
#1170 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant