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

New lines are added when pasting formatted text on composer #523

Open
alagane opened this issue Feb 1, 2022 · 6 comments
Open

New lines are added when pasting formatted text on composer #523

alagane opened this issue Feb 1, 2022 · 6 comments
Labels
bug Something isn't working medium

Comments

@alagane
Copy link
Member

alagane commented Feb 1, 2022

Summernote version 0.8.18

When I paste formatted text on the composer, newlines are added (<p><br/></p>), before what is pasted, and between lines.
Example of formatted text with resulting pasted text is provided here: #522 (comment)

When I press backspace or delete before I paste the text, there are no newlines added, there seem to be a <p><br/></p> that is removed when pressing one of those keys.
If I add a space before pasting (after removing the p), it does not seem to add newlines between pasted text paragraphs.
If I add space, move the cursor before and paste, the text is pasted last paragraph first (somewhat upside down).

Those problems do not happen on summernote standalone (simple html page with only summernote, same version 0.8.18). Note that we must use the pasteHTML command because this is what we use when we override the paste behaviour for HTML content on esn-frontend-inbox composer. Tests were done on summernote standalone the same way, with pasteHTML command.

This is not related to options (setting INBOX_SUMMERNOTE_OPTIONS to {} does not solve the problem).

This problem might we related with AgularJS behaviour with summernote.

@fabienmoyon fabienmoyon added bug Something isn't working medium labels Feb 1, 2022
@alagane
Copy link
Member Author

alagane commented Feb 1, 2022

Can reproduce with demo angular app (angular-seed) with angular-summernote plugin and summernote 0.8.18.
Reproduce only with pasteHTML, but not reproduced by pasting only.

@alagane
Copy link
Member Author

alagane commented Feb 1, 2022

Using directly summernote on AngularJS instead of angular-summernote seems to fix the problem, but we need to analyse the impact of removing this third party.
Mistested

@fabienmoyon
Copy link
Member

@alagane great, thanks
We need to analyse the source code and check if there are issues related to that in angular-summernote

@alagane
Copy link
Member Author

alagane commented Feb 3, 2022

There seems to be no issue about the problem on angular-summernote, and the project development seems stopped or very slow.

@alagane
Copy link
Member Author

alagane commented Feb 8, 2022

summernote/summernote#3370
I think this is the issue, and it still seems to be in the latest version.
A commenter said they switched to quilljs and it worked great.

@alagane
Copy link
Member Author

alagane commented Feb 8, 2022

Tests against summernote 0.8.18 (on angularjs demo, without angular-summernote)
+ is the cursor, _ is space, number is to easily reference the case

Number Content Pasted Result
1 + <p>Hello</p><p>World</p> <p>Hello</p><p>World</p>
2 <br>+ <p>Hello</p><p>World</p> <p>Hello</p><p>World</p>
3 <p><br></p>+ <p>Hello</p><p>World</p> <p><br></p><p>Hello</p><p>World</p>
4 <p><br></p><p><br></p>+ <p>Hello</p><p>World</p> <p><br></p><p>Hello</p><p>World</p><p><br></p>
5 + <p>Hello</p>_<p>World</p> <p>Hello</p><p>_World</p>
6 <br>+ <p>Hello</p>_<p>World</p> <p>Hello</p><p>_World</p>
7 <p><br></p>+ <p>Hello</p>_<p>World</p> <p><br></p><p>Hello</p><p>_<br></p><p>World</p>
8 <p><br></p><p><br></p>+ <p>Hello</p>_<p>World</p> <p><br></p><p>Hello</p><p>_<br></p><p>World</p><p><br></p>

Strange behaviour happens in:
4. Both p are inserted between the 2 <p><br></p>
5 & 6. Space is moved inside the second p
7. a <p> <br></p> is inserted between the 2 p
8. This one is a mess

alagane added a commit to alagane/esn-frontend-inbox that referenced this issue Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium
Projects
None yet
Development

No branches or pull requests

2 participants