Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better preserve content on paste #135

Closed
thibaudcolas opened this issue Jan 17, 2018 · 7 comments
Closed

Better preserve content on paste #135

thibaudcolas opened this issue Jan 17, 2018 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@thibaudcolas
Copy link
Collaborator

Tracking issue for all problems related to content not being preserved on paste.

See https://github.com/thibaudcolas/draftjs-filters/blob/master/pasting/README.md first.

  • Pasting in from Google Docs - copying and pasting a horizontal rule/line does not work. Start an empty Google Doc, Insert > Horizontal Line, select al, copy, paste into draftail - nothing appears.
  • Pasting between Draft.js editors - list item depth is lost.
@thibaudcolas thibaudcolas added the enhancement New feature or request label Jan 17, 2018
@thibaudcolas thibaudcolas added this to the Post v1.0.0 milestone Jan 17, 2018
@thibaudcolas
Copy link
Collaborator Author

Merging this with #138.

@tutuca
Copy link

tutuca commented May 21, 2018

I find that draftail doesn't preserves any kind of table on paste.

Is there any workaround for this?

@thibaudcolas
Copy link
Collaborator Author

@tutuca no, tables aren’t supported by the editor.

@tutuca
Copy link

tutuca commented May 22, 2018

@thibaudcolas I can't find an open issue here but there seems to be some prior art around draft.js proper [1] [2]. It seems hard to believe that there's nobody with the need to paste some tables here and there. Is it too much a hassle to support some pasted tabulated content?

[1] draft-js-plugins/draft-js-plugins#921
[2] https://github.com/SamyPesse/draft-js-table

@thibaudcolas
Copy link
Collaborator Author

I know people who have wished for table support in the past. I think the main reason why this hasn't happened is that it's not that easy to build in rich text, so most people will just give up on the idea of being able to have tables anywhere in their content. They'll instead choose to make something more purpose-built, custom, and less likely to be open-sourced. For example some integration of https://handsontable.com/.

For Draft.js (and Draftail) in particular, I know it's possible but not easy because Draft.js doesn't have good support for nested editing (eg. using Draft.js features within the cells of the tables, having text formatting inside table). I think folks who were frustrated with this tended to switch to Slate, but I didn't follow up.

It's still definitely possible though even if not easy – all it takes is for someone to dedicate time to it. https://github.com/SamyPesse/draft-js-table would probably be a good place to start, after having assessed the caveat in its README header about needing facebookarchive/draft-js#388.

Without any kind of nested editing, I believe that a custom block using https://handsontable.com/ or similar would be much easier to implement. But that has its own limitations of course.

@tutuca
Copy link

tutuca commented May 23, 2018

What's your opinions on the posibility of a slate port?.
I can tell the fatigue from afar having just read that you switched from hallo to draft. I wouldn't want to fragment the contributors maintaining yet another editor.

Thanks for the deailed response!.
I'll keep you posted if I came around implementing paste support for tables.

@thibaudcolas
Copy link
Collaborator Author

I considered Slate about 1.5 years ago, but wasn't convinced. The main reason why I didn't pursue it further is that it doesn't have the backing of a big engineering organisation like Facebook's. Technically, Slate seems much more flexible than Draft.js, but in ways that mostly didn't matter to me at the time (wanting to build something for Wagtail specifically).

If you or anyone else wants to invest time in building a competing editor, I think it's worth exploring, and I'll be happy to help with my rich text knowledge, but it's a big investment.


I'd be much more interested in porting Draftail to the draft-js-plugins architecture (#83) to make it easier to integrate things from that ecosystem, and make it all easier to maintain. I'll add a few more notes about this on #83.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants