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

Pasting plain text also changes to table format #50

Open
grace-lalala opened this issue Apr 26, 2020 · 10 comments
Open

Pasting plain text also changes to table format #50

grace-lalala opened this issue Apr 26, 2020 · 10 comments

Comments

@grace-lalala
Copy link

If I paste a copy of my notes on it, or if I paste a block of code on it, it's going to be in table format, but I don't want it in table format.

@soccerloway
Copy link
Owner

Pasting html into the quill editor will go through a convert process, which will match the html elements in the clipboard to the blots defined in quill. Because the line in the cell of quill-better-table uses div tags, the div tags pasted from the clipboard are converted into tableCellLine, which causes the situation you encounter.

@soccerloway
Copy link
Owner

Code blocks are usually wrapped in code tags, and paragraphs are wrapped in p tags. However, I do have some unreasonable use of div tags, but this is to distinguish it from the text in quill.

@grace-lalala
Copy link
Author

Well, I understand why, but is there any way to avoid it? Because most of the user's paste is in text format.😢

@soccerloway
Copy link
Owner

Maybe you can handle the delta of the div tag by add a new matcher. Change the pasted div to normal text.
Quill Docs for adding customize matcher

@soccerloway
Copy link
Owner

Since I made a low-level mistake at the beginning, I wrote TableCellName.className as TableCellName.ClassName, it led me to finally use DIV to implement TableCellLine. So pasting DIV tag will be treated as tableCellLine. I changed DIV to P. This issue was fixed now.

@natterstefan
Copy link

natterstefan commented Jul 2, 2020

Hello @soccerloway,

the change you mentioned in the README of 1.2.0 (353fa78) unfortunately doesn't work. You can see a live demo here.

Here's a preview:

Screen Capture on 2020-07-02 at 07-31-28

I've updated the version in the CodePen to the latest:

image

Thanks for your help.

@soccerloway
Copy link
Owner

Hi @natterstefan , thanks for your report.
The updates are used to fix that DIV will be converted to TableCellLine while users copy DIV tags and paste into quill editor.
Not the issue pasting multi lines text into table cell will break table, pasting multi lines text into table cell is still exist.

@soccerloway
Copy link
Owner

I thinks your above report is about issue #33 .

@natterstefan
Copy link

Not the issue pasting multi lines text into table cell will break table, pasting multi lines text into table cell is still exist.

Hi,

thanks for the feedback. 🤔 this also happens to me when pasting formatted text (e.g. the text in the example is bold), not just with multi-line texts.

@Huseyin-altun
Copy link

Hello, has this been resolved? I have the same problem :)

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

No branches or pull requests

4 participants