gt6796c / mermaid-tw5

Tiddly Wiki 5 plugin to support the mermaid library
MIT License
19 stars 10 forks source link

Editing mermaid diagrams with preview leaves diagrams floating around #4

Closed danielo515 closed 7 years ago

danielo515 commented 8 years ago

How to reproduce:

  1. Go to https://gt6796c.github.io/#%24%3A%2Fplugins%2Fgt6796c%2Fmermaid-tw5%2Fexample
  2. Edit the tiddler
  3. Open the preview
  4. Make any change that breaks the preview, for example change C((a circle)); to C(a circle); manually (no copy paste)
  5. See a diagram appearing under the tiddler

Screenshot:

captura de pantalla 2016-09-06 a las 18 59 56

gt6796c commented 8 years ago

Yeah, I've seen this. I think that I know where it is happening, but I've not looked into actually fixing it yet.

They are temporary in that if you refresh the page (either using the browser or the TW button) they go away.

gt6796c commented 8 years ago

Actually, I don't know that I can do anything about this.

I thought it was going to be because I was being very cavalier with creating new DIVs for the SVG every time the widget was told to render itself, but that actually seems to be doing what it is supposed to. I dove deeper into mermaid and the trash being left behind is actually from the mermaid.js call to render()

It looks like TW's model for preview-as-you-type doesn't really play well with mermaid at times. The errors always seem to be setting the viewport's height and width with Infinity instead of a number.

I may poke around some more, but this one might be more trouble than it is worth (to me) since a refresh gets rid of all the trash.

gt6796c commented 7 years ago

Marking as won't fix

boylesean commented 7 years ago

Requiring a refresh may seem like a minor irritation, but if the tiddlywiki is encrypted, then a refresh requires the passphrase to be re-entered. As implied, if I disable preview for the tiddler, the relics do not show up, so I have a workaround for the moment. This really is the best thing going for diagrammes!