HyperMD icon indicating copy to clipboard operation
HyperMD copied to clipboard

Spaces missing in Paste with Turndown powerpack

Open michaelgmcd opened this issue 5 years ago • 6 comments

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: spaces-missing

michaelgmcd avatar Jul 22 '18 04:07 michaelgmcd

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))

laobubu avatar Jul 22 '18 05:07 laobubu

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, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; 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, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;; 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, &quot;Liberation Mono&quot;, 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.

michaelgmcd avatar Jul 22 '18 05:07 michaelgmcd

I'm guessing that the <span> </span> blocks are being stripped out with my OS/browser

michaelgmcd avatar Jul 22 '18 05:07 michaelgmcd

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?

nasyxx avatar Jul 23 '18 07:07 nasyxx

Will do!

michaelgmcd avatar Jul 23 '18 14:07 michaelgmcd

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.

michaelgmcd avatar Jul 31 '18 03:07 michaelgmcd