slate icon indicating copy to clipboard operation
slate copied to clipboard

Copy/Paste multiple lines adding more blank lines in between

Open vamsimudadla opened this issue 2 years ago • 1 comments

Description I implemented a slate editor using slate-react. I want to copy multiple lines at a time and paste into another editor like notepad. But it is adding more lines between slate nodes. There are no empty nodes or line breaks between the text nodes. Please check the video.

Recording

https://user-images.githubusercontent.com/24267163/216007739-add79dd1-23f7-4f19-8b99-fda9a35c748e.mp4

Expectation There should not be extra brank lines.

Environment

  • Slate Version: 0.81.1
  • slate-react: 0.81.0
  • Operating System: windows 11
  • Browser: Chrome, Safari, mozilla

vamsimudadla avatar Feb 01 '23 09:02 vamsimudadla

Looks like if you nested more html tags in the element it will copy with extra lines:

  <div>
    <p style={style} {...attributes}>
      {children}
    </p>
  </div>

Like this copy without the extra lines:

 <p style={style} {...attributes}>
     {children}
   </p>

CodeSandbox https://codesandbox.io/s/bug-copy-and-paste-fqrsld?file=/src/App.js

zehfernandes avatar Feb 14 '23 17:02 zehfernandes