TriliumNext / Notes

Build your personal knowledge base with TriliumNext Notes
https://triliumnext.github.io/Docs/
GNU Affero General Public License v3.0
1.11k stars 62 forks source link

(Bug report) Edit page missing 95% of content in note #560

Open maphew opened 3 weeks ago

maphew commented 3 weeks ago

TriliumNext Version

0.90.9-beta

What operating system are you using?

Windows

What is your setup?

Local + server sync

Operating System Version

win 11 pro (10.0.22631 N/A Build 22631)

Description

I imported this page from a zip containing html and referred images. The view page is pretty much what I expect, however the Edit page is missing most of the content (~70 words kept, ~700 missing).

View mode:

image

Edit mode:

image

Firefox renders both pre- and post-import html correctly, or at least no obvious omissions or weirdness observed.

Error logs

No response

meichthys commented 3 weeks ago

I vaguely remember this happening to me on a couple notes as well with the Evernote export. I think i was able to view source or perhaps export from Trilium and find something in the html that was tripping it up - unfortunately i didn't keep notes on that so it's just a distant memory.

maphew commented 3 weeks ago

Interestingly, if I extract the the htm page from the zip, open in Firefox "select all > copy > paste into new Trilum note" the result is the same as going to Edit mode from the imported page. View Note Source on this new page shows only the diminished content (albeit in html tags).

I guess this tells us it's not the Import mechanism that's at fault.

maphew commented 3 weeks ago

There's something in the first bit of the page the Trilium really doesn't like. In Firefox if I select heading, date, and first word of 1st paragraph, and paste just that, only the heading and date are retained.

Source: image

Result: image

The html source code for the selection is:

<p style="margin:0in;font-family:&quot;Calibri Light&quot;;font-size:20.0pt">Fossil:
learning TH1</p>

</div>

<div style="direction:ltr;margin-top:.0423in;margin-left:.2736in;width:1.7159in">

<p style="margin:0in;font-family:Calibri;font-size:10.0pt;color:#767676">2021-Aug-20</p>

<p style="margin:0in;font-family:Calibri;font-size:10.0pt;color:#767676">11:06
AM</p>

</div>

<div style="direction:ltr;margin-top:.434in;margin-left:0in;width:7.8013in">

<ul style="direction:ltr;unicode-bidi:embed;margin-top:0in;margin-bottom:0in">
 <p style="margin:0in;font-family:Calibri;font-size:11.0pt">Having 
maphew commented 3 weeks ago

Huh, see how in this screenshot of Firefox after "select >> r-click >> View selection source" a div in the middle is not selected.

image

meichthys commented 3 weeks ago

It looks like that div has no end </div> tag.

maphew commented 3 weeks ago

running both the pre- and post-import html source through https://www.aliciaramirez.com/closing-tags-checker/ says all tags are closed.

maphew commented 3 weeks ago

hah! found the cuplrit. The whole of the page after the heading and date is nested inside an Unordered List <ul>tag!

image

It's certainly bad practice on the side of Onenote to use this structure, but I don't think Trilium is off the hook since viewable information is lost when transitioning to Edit.

I can fix this for myself by editing the source html and removing the ul or changing it to div and import again. I only caught the error because it was so drastic. If it was burried in the middle somewhere it'd be easy to miss. Also there will be people for whom editing the source is a big challenge.

meichthys commented 3 weeks ago

Ah yep, now that you mention it, that sounds very familiar. Good find 👍

perfectra1n commented 3 weeks ago

So we can consider this closed, or what would be the best way for Trilium to remediate this? :)

meichthys commented 3 weeks ago

I guess we can leave this open for now. We should also try running it through an HTML validation checker. If it passes that ( In addition to the checker, you already tried), it should be something we should fix.

maphew commented 2 weeks ago

I think Trilium should try very hard to never lose user data, and if it's in a situtation where it can't go forward without that happening it should refuse to move. If a person loses trust that the system will keep their work it'll be incredibly hard if not impossible to regain.

To apply that to the current situation: maybe something like if word count before and after entering Edit mode is mismatched Trilium should say so, and show the Revision History page.

--> oh! I don't like this. The Revisions page of an imported page is empty. I expected to see something like "initial version" on the imported date. With the default snapshot interval of 600 seconds this means if a person edits the page within 10 minutes of import, a likely scenario, there is no possiblity of roll back.

perfectra1n commented 2 weeks ago

Just out of curiosity, does the web-clipper work better for that page than an import?

meichthys commented 2 weeks ago

Yes, the web-clipper does indeed work better, although it does leave out the heading/date and the made with onenote text at the bottom (These are one in the source after the clip).