TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8k stars 1.18k forks source link

Unable to edit tags on tiddlers created via tiddlywiki.files #5344

Open fluxsmith opened 3 years ago

fluxsmith commented 3 years ago

I have the following tiddlywiki.files in .../tiddlers/pdf:

{
   "directories": [
      {
         "path": "../../files",
         "filesRegExp": "^.*\\.pdf$",
         "isTiddlerFile": false,
         "fields": {
            "title": {"source": "basename-uri-decoded"},
            "created": {"source": "created"},
            "modified": {"source": "modified"},
            "type": "application/pdf",
            "tags": ["$:/tags/AttachedFile"],
            "text": "",
            "_canonical_uri": {"source": "filename", "prefix": "/files/"}
         }
      }
   ]
}

This succeeds in automatically creating a tiddler for a pdf file, eg. FinancialDimensions which my webserver provides successfully. This issue is when I edit this tiddler to add a tag so it shows in my custom 'Contents' pane. As soon is the tiddler is edited two files are created in .../tiddlers: FinancialDimensions.pdf, which is zero length, and FinancialDimensions.pdf.meta, which has the desired tags.

At that point the tiddler retains the desired tag when the wiki is refreshed in the browser, so the correct state is being retained in the node.js server.

However, if the node.js server is restarted and the browser is refreshed the newly added tag is missing from the tiddler, this despite the correct information still appearing in .../tiddlers/FinancialDimensions.pdf.meta.

pmario commented 3 years ago

IMO the easiest way would be, to create a new tiddler, that you show in the "Contents" pane. eg:

title: newTiddler
tag: any tag is possible here.

{{your pdf tiddler}}
fluxsmith commented 3 years ago

IMO the easiest way would be, to create a new tiddler, that you show in the "Contents"...

That's essentially what I resorted to (I decided to just manually create the tiddlers), but the auto-created tiddlers specifically display contents saying only the tags are editable, so something's wrong that the tags don't stick.

Jermolene commented 3 years ago

Thanks @fluxsmith this is a tricky one to imagine a decent fix for. The trouble is that the "tiddlywiki.info" file declares that the contents of the folder are plain PDF files, and not tiddler files. But your need to save tags against those tiddlers requires them to be saved as tiddler files (ie with a .meta file).

We do have a bit of a fundamental problem with the handling of wiki folders. The loading process treats the wiki folder as a procedural program that it executes to generate the tiddlers for the wiki, while the saving process wants to treat the wiki folder as a database. We do our best to smooth over the differences, but it's rather like trying to hide the wave/particle duality: at certain scales the distinction is unavoidable.