/*\ title: $:/core/modules/macros/edit/edit.js type: application/javascript module-type: macro \*/ (function(){ /*jslint node: true, browser: true */ "use strict"; exports.info = { name: "edit", dependentOnContextTiddler: true, params: { field: {byPos: 0, type: "text"} } }; exports.executeMacro = function() { // Get the tiddler being editted var field = this.hasParameter("field") ? this.params.field : "text", tiddler = this.wiki.getTiddler(this.tiddlerTitle), Editor; // Figure out which editor to use // TODO: Tiddler field plugins should be able to specify a field type from which the editor is derived if(field === "text" && tiddler.fields.type) { Editor = this.wiki.macros.edit.editors[tiddler.fields.type]; } if(!Editor) { Editor = this.wiki.macros.edit.editors["text/x-tiddlywiki"]; } this.editor = new Editor(this); // Call the editor to generate the child nodes var children = this.editor.getChildren(); for(var t=0; t