felixhayashi / TW5-TiddlyMap

Map drawing and topic visualization for your wiki
http://tiddlymap.org
BSD 2-Clause "Simplified" License
845 stars 127 forks source link

Adapt TiddlyMap for new commenting plugin available in pre-release 5.1.18 #294

Closed myii closed 5 years ago

myii commented 5 years ago

Relatively new user of TiddlyWiki & TiddlyMap here. In fact, TiddlyMap was the killer feature that finalised that decision to adopt -- kudos for this wonderful plugin.

While using 5.1.17, felt the need for being able to comment on tiddlers, so was very pleased to find that there will be an official commenting plugin in 5.1.18. See:

Upgraded to the pre-release in order to work with this plugin, which works well. Have run into a couple of issues in relation to TiddlyMap, though:

  1. Live view is flooded with the comments as well, since every comment is a tiddler
    1. Wanted to edit the node filter to prevent these comments from being displayed but that is prohibited: "You must not change the live view's node filter!"
  2. Existing comments are not displayed when editing a tiddler within TiddlyMap (i.e. when fullscreen has been toggled)
felixhayashi commented 5 years ago

Hi @myii Thanks for the kudos and your feedback :)

Wanted to edit the node filter to prevent these comments from being displayed but that is prohibited: "You must not change the live view's node filter!"

I see your point. I will think about loosening this rule in the next version.

Existing comments are not displayed when editing a tiddler within TiddlyMap (i.e. when fullscreen has been toggled)

Can you elaborate on that? Generally speaking, TiddlyMap does not update when a Tiddler is in draft mode. TiddlyWiki creates a new "Draft" tiddler at the time you start editing a tiddler, which is not the same as the "real" tiddler. So only once a draft tiddler is saved it becomes the new "real" tiddler (see TiddlyWiki docs) then TiddlyMap will trigger a rerender. Per design, TiddlyMap does not listen to draft changes in order to avoid performance issues (that would occur if the map gets rerendered on every keystroke).

felixhayashi commented 5 years ago

Existing comments are not displayed when editing a tiddler within TiddlyMap (i.e. when fullscreen has been toggled)

Hmm I think I misunderstood your point. I checked out the new commenting plugin in the prerelease and it seems even TiddlyWiki itself does not show comments in editing mode. Only when exiting edit mode the comments are shown. TiddlyMap behaves exactly the same, it shows correctly comments below the tiddler when in fullcreen mode.

2018-10-06 23 30 45

myii commented 5 years ago

@felixhayashi You're absolutely right re: editing the tiddler. To be more specific, I was speaking about the Preview tab in TiddlyMap, when in fullscreen mode. Comments aren't displayed there.

felixhayashi commented 5 years ago

Wanted to edit the node filter to prevent these comments from being displayed but that is prohibited: "You must not change the live view's node filter!"

Fixed in latest release.

myii commented 5 years ago

@felixhayashi Thanks for the fix. Probably a bit late now but I was going to suggest that rather than allowing editing of the node filter for the live view, just adding another filter to cover the comments, since they all have the same prefix:

felixhayashi commented 5 years ago

I was speaking about the Preview tab in TiddlyMap, when in fullscreen mode. Comments aren't displayed there.

hmm are we seeing different things?

2018-10-07 00 15 27

Probably a bit late now but I was going to suggest that rather than allowing editing of the node filter for the live view, just adding another filter to cover the comments, since they all have the same prefix

yeah thought about that but there is no purpose for another filter field except in the live-view and I cannot conditionally hide the second filter field for other views (where the second filter textfield would not make sense). Hence I just allowed to edit the filter ;)

myii commented 5 years ago

@felixhayashi OK, I've got a juicy one for you:

I've only just tested this so perhaps there could be some mistake. But that would explain why I couldn't see the comments I had already made from TiddlyWiki.

myii commented 5 years ago

@felixhayashi And I believe I've found out why, by the files saved via. TiddlyServer.

When a comment is saved with TiddlyWiki:

And when saved with TiddlyMap:

felixhayashi commented 5 years ago

Ah that is a deadly dilemma :dagger:

On the one hand the "preview" in TiddlyMap is only meant to show the stuff in the draft – i.e. unsaved changes. On the other hand, the preview tab uses the original display-template provided by TiddlyWiki that also renders the comments (and if new comments are added they are "owned" by the draft).

felixhayashi commented 5 years ago

okay fixed it will upload new version now. I simply removed the "preview" tab and replaced it with "latest version" tab that is correctly linked to the original tiddler.

myii commented 5 years ago

@felixhayashi Looking forward to it. I've looked a bit further but it seems a bit more than just the naming of the files... not sufficiently familiar with TiddlyWiki to pinpoint it immediately. Perhaps something to do with list and/or tmap.id?

felixhayashi commented 5 years ago

This line was the troublemaker: https://github.com/felixhayashi/TW5-TiddlyMap/commit/f31472eb63d38de3fd62465087fe1337b0a2f4e1#diff-ed8b41b106b382ed2d5eb9009e74fc31R8 should work now.

myii commented 5 years ago

@felixhayashi That works really well now, thanks.

In terms of d4bae2f8281dca3318f903c962ea33669d030a19:

If you would be so kind, what is the correct way to filter the comments (and only the comments)? Note, if the solution doesn't involve modifying the live view's node filter, then d4bae2f8281dca3318f903c962ea33669d030a19 could potentially be reverted.

felixhayashi commented 5 years ago

Tried -[prefix[Comment by]] and variations of this

The problem here is on TiddlyMap's side: TiddlyMap first applies the filters and then loads the "neighbourhood" nodes which are then not filtered :( I agree that this is counter intuitive. Let me have a look whether I can quickly change this behavior so neighbours are also considered by the filter.

felixhayashi commented 5 years ago

Here you go, Just install new version. follow the steps in the screenshot and use your node filter -[prefix[Comment by]] and it should work. :pray:

Edit: Please wait with upgrading seems like something is still missing. I will give you a heads up once this is ready.

2018-10-14 02 33 56

felixhayashi commented 5 years ago

@myii if something doesn't work, please leave a comment. thanks.

myii commented 5 years ago

Splendid, exactly what was needed -- thanks @felixhayashi.

While my requirements are fulfilled, I've got a thought that may be worth considering (re: other users upgrading):

In any case, your help has been invaluable. Thanks again.

felixhayashi commented 5 years ago

Splendid, exactly what was needed -- thanks @felixhayashi.

cool. glad to hear that.

Assertion: No use-case exists where these comments should ever be displayed on TiddlyMap If true, wouldn't it be better to provide this filter by default?

good point – but I want to be backwards compatible, meaning, the original behaviour is that node filters do not affect neighbours. maybe some wikis depend on this and I dont want to break this with an update.

Or should this be mentioned in the documentation instead?

definitely. will add it.