Open tobibeer opened 9 years ago
I think the only reason is because it didn't before and it is slightly easier to code this way. Changing that should only be a matter of adding an else statement to the event handler that makes a new tiddler if one doesn't already exist.
The only thing I can think of this changing is if someone has a setup that blindly tries to add tags to tiddlers without testing if they exist, but that isn't a case I would worry about.
It could just be adding something like this to the end of the outer if statement in handleAddTagEvent: else { if(typeof event.param === "string" && event.param.trim() !== "" && this.mangleTitle.trim() !== "") { $tw.wiki.addTiddler(new $tw.Tiddler({title: this.mangleTitle, tags: $tw.utils.stringifyList(event.param.trim())})); } }
I think adding this would probably be a good idea, but I am avoiding my other work doing this so I am not going to try testing this now.
I made a pull request and put up a quick test wiki here: http://ooktech.com/jed/ExampleWikis/FieldManglerTest/testfieldmanglerwidget.html
Thank you @inmysocks. I've become a little more cautious with pull requests. But then I think it's still better to have a pragmatic, functioning PR to test out and maybe even rejected ...than talk too much theoretics and whether or nots... which you can still do at a PR.
Any reason why
tm-add-tag
/handleAddTagEvent
and other message handlers in the FieldMangler do not create a given tiddler in case it didn't exist before?