Open michaelgmcd opened 6 years ago
Can't reproduce in Firefox 61.0 / Chrome Beta 68.0.3440 (Windows)
This could be related to Clipboard API on your OS. To investigate, run this in demo page's console, then paste something into HyperMD editor:
editor.setOption('hmdPaste', (html) => console.log(html))
I'm running Chrome 67 on a Mac. When copying a section of the HyperMD readme, I get the following HTML on paste:
<meta charset='utf-8'>
<p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">You may use both original CodeMirror and HyperMD on the same page.</p>
<ol style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
<li style="box-sizing: border-box;">
Write, and preview on the fly
<ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 0px;">
<li style="box-sizing: border-box;">
<strong style="box-sizing: border-box; font-weight: 600;">Regular Markdown</strong><span> </span>blocks and elements
<ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 0px;">
<li style="box-sizing: border-box;"><strong style="box-sizing: border-box; font-weight: 600;">Strong</strong>,<span> </span><em style="box-sizing: border-box;">Emphasis</em>,<span> </span><del style="box-sizing: border-box;">Strikethrough</del>,<span> </span><code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0.4em; margin: 0px; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px;">Code</code></li>
<li style="box-sizing: border-box; margin-top: 0.25em;"><a href="https://laobubu.net/" rel="nofollow" style="box-sizing: border-box; background-color: transparent; color: rgb(3, 102, 214); text-decoration: none;">Links</a>, Images</li>
<li style="box-sizing: border-box; margin-top: 0.25em;">Title / Quote / Code Block / List / Horizontal Rule</li>
</ul>
</li>
</ul>
</li>
</ol>
I'll investigate this a little further.
I'm guessing that the <span> </span>
blocks are being stripped out with my OS/browser
I cannot reproduce this problem in Chrome Version 69.0.3493.3 (Official Build) dev (64-bit) on my Mac. At the same time, Safari cannot reproduce it, either.
Would you like to try a newer version of Chrome?
Will do!
Was waiting before my next Chrome update before updating here. This is still an issue on Chrome Version 68.0.3440.75 (Official Build) (64-bit) on my Mac High Sierra (10.13.6). I will leave this open until the Chrome version that @nasyxx mentioned is the latest stable build available.
Spaces near highlighted elements (bold, italic, code, strikethrough, etc.) are missing when pasting with the turndown plugin enabled. I've confirmed that this is not a bug with Turndown by pasting the same html into their example
See reproduction below: