Fix issues with copying and pasting in content editor
What does this MR do and why?
Fix issues with pasting html in content editor
- Do not render class attribute as it could render in unexpected ways, which aren't supported when real markdown is rendered.
- Strip any stray div, span or pre tags in pasted HTML before paste
- Pasting code from VSCode no longer breaks.
- Copying content from content editor copies as markdown.
Screenshots or screen recordings
How to access content editor:
- Enable feature flag:
:content_editor_on_issues
. - Go to an issue. Scroll down to the comment box on the bottom of the issue.
- Click Switch to rich text to access the content editor.
Scenario | Before | After |
---|---|---|
Stray To test:
|
||
Classes in links: Previously link elements in content editor supported a To test: |
||
Copying from VSCode To test:
|
||
Copying from content editor itself (Case 1) To test:
|
||
Copying from content editor itself (Case 2: #412317 (closed)) To test:
|
Unable to paste, it glitches and the label disappears. |
The second label is successfully inserted: |
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406522 (closed)
Edited by Himanshu Kapoor