Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const saveType = (mode, id, output) => {
const tObj = utils.getTiddler(output);
// update the type with the form data
const Type = (mode === 'manage-edge-types' ? EdgeType : NodeType);
const type = new Type(id, tObj);
type.save();
const newId = tObj.fields['temp.newId'];
if (newId && newId !== tObj.fields['id']) { //renamed
if (mode === 'manage-edge-types') {
$tm.adapter._processEdgesWithType(type, {
action: 'rename',
newName: newId
});
} else {
(new NodeType(newId, type)).save();
$tw.wiki.deleteTiddler(type.fullPath);
}
GlobalListener.prototype.saveType = function(mode, type, dialogOutput) {
var tObj = utils.getTiddler(dialogOutput);
// update the type with the form data
type.loadFromTiddler(tObj);
type.save();
var newId = tObj.fields["temp.newId"];
if(newId && newId !== tObj.fields["id"]) { //renamed
if(mode === "manage-edge-types") {
$tm.adapter._processEdgesWithType(type, {
action: "rename",
newName: newId
});
} else {
var newType = new NodeType(newId);
newType.load(type);
newType.save();
$tw.wiki.deleteTiddler(type.fullPath);