medium-editor
medium-editor copied to clipboard
Pasting text with a newline into a heading adds unwanted style
Description
When pasting multi-line content into a headline, the pasted content contains unwanted style
attributes, even with the default plain-text paste setting.
Steps to reproduce
- Open http://yabwe.github.io/medium-editor/
- Make "The dead simple inline editor toolbar." an H2
- Copy these 2 lines: line 1 line 2
- Paste them into the H2, e.g., after "dead simple"
- Inspect the element with the pasted "line 2"
Expected behavior: [What you expected to happen]
Clean HTML, no style
Actual behavior: [What actually happened]
<span style="font-size: 1.5rem; font-weight: 500;">line 2</span>
Versions
- medium-editor: 5.23.0
- browser: Chrome 68
- OS: MacOS High Sierra 10.13.6
This worked for me.
document.execCommand('styleWithCSS', false, null);
I tried my original reproduction steps with document.execCommand('styleWithCSS', false, null);
before the paste step (4). Does not work for me.
@kritollm Can you give a more precise description how to make the above "steps to reproduce" work without getting style
attributes in the resulting HTML/DOM?