How to use the temp.newId function in temp

To help you get started, we’ve selected a few temp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felixhayashi / TW5-TiddlyMap / src / plugins / felixhayashi / tiddlymap / js / services / Listener.js View on Github external
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);

    }
github felixhayashi / TW5-TiddlyMap / src / plugins / felixhayashi / tiddlymap / js / startup.listener.js View on Github external
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);