Created
March 27, 2014 13:09
-
-
Save Arlen22/9807217 to your computer and use it in GitHub Desktop.
Add create param to fieldmangler.js using x-tiddler deserializer. (public domain)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FieldManglerWidget.prototype.execute = function() { | |
// Get our parameters | |
this.mangleTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); | |
this.createText = this.getAttribute("create",false); | |
// Process create param | |
if(this.createText) { | |
var createTiddler = $tw.wiki.deserializeTiddlers("application/x-tiddler",this.createText); | |
createTiddler[0]['title'] = this.mangleTitle; | |
if(!this.wiki.tiddlerExists(this.mangleTitle)) | |
this.wiki.addTiddler(createTiddler[0]); | |
} | |
// Construct the child widgets | |
this.makeChildWidgets(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment