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

Notes don't get saved if they start with some html tags like <div>, <pre>, <p>, <span> #293

Open
ole-clausen opened this issue Sep 5, 2021 · 6 comments

Comments

@ole-clausen
Copy link

ole-clausen commented Sep 5, 2021

So recently I tried to save a few lines of html in Notes, only to later find out the note was empty - except for the headline: "<div" in the list of notes.
I am not sure if the problem is with html in general or not, as I found various tags where the error occurs - while the tag <button> it can still save perfectly well

@bjorn
Copy link
Collaborator

bjorn commented Sep 7, 2021

Hmm, that sounds related to #234, but if you are on 1.5.0 then this problem should be fixed.

I couldn't directly reproduce this issue on latest dev, but while attempting to do this, I did notice that stuff like <b>foo</b> can turn into bold text when re-selecting the note. This is likely because Qt detects HTML formatting and applies it to the text, but that shouldn't happen. To avoid this we need to call setPlainText instead of setText on the QTextEdit.

@nuttyartist
Copy link
Owner

Nice catch @bjorn! I noticed this as well when pasting html. Your suggestion solves this issue. I'll create a new issue for this. I can add the fix to the editor-settings branch.

@ole-clausen Are you using the latest version (v1.5.0)? You can check by clicking on "Check for updates" in the dots menu.
If you do, can you provide some samples so we can try and reproduce this issue?

@ole-clausen
Copy link
Author

Hello @nuttyartist - yes, I'm using v1.5.0 installed from the windows edition on the website, the attached piece of text reproduces the issue at both my computers. Its just a few lines from an angular components html template.

  • when testing a bit on my secondary pc i also noticed the html formatting being applied in some cases(your app can show svg's at the moment, i had the angular logo shown 😅 ) and in other notes all contents would be gone like with the attached text
    Test.txt

@nuttyartist
Copy link
Owner

nuttyartist commented Sep 14, 2021

@ole-clausen I just checked and @bjorn solution seems to fix this. I'll make sure to push this for v2.0.0.
Thanks!

@zjeffer
Copy link
Collaborator

zjeffer commented Mar 11, 2023

I can confirm this bug still happens on 2.1.0.

With the Test.txt file OP provided, closing and reopening the window will make the note empty. This is how the notelist looks, with the note selected:
image

@nuttyartist
Copy link
Owner

nuttyartist commented Mar 11, 2023

Yep... Can reproduce this as well. Not even closing the window but just selecting a different note.

@nuttyartist nuttyartist moved this from To do to Bugs in Notes 2.2.0 Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants