notes icon indicating copy to clipboard operation
notes copied to clipboard

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

Open ole-clausen opened this issue 2 years ago • 6 comments

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

ole-clausen avatar Sep 05 '21 13:09 ole-clausen

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.

bjorn avatar Sep 07 '21 08:09 bjorn

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?

nuttyartist avatar Sep 08 '21 17:09 nuttyartist

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 :sweat_smile: ) and in other notes all contents would be gone like with the attached text
    Test.txt

ole-clausen avatar Sep 12 '21 10:09 ole-clausen

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

nuttyartist avatar Sep 14 '21 12:09 nuttyartist

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

zjeffer avatar Mar 11 '23 11:03 zjeffer

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

nuttyartist avatar Mar 11 '23 14:03 nuttyartist