Adjust listops widget to only modify tiddler if tags have changed

We do this so that we don’t accidentally modify shadow tiddlers when we
drag them to reorder them within their tag parent. Otherwise, moving a
toolbar button like $:/core/ui/Buttons/permaview in the control panel
will override the shadow tiddler.
print-window-tiddler
Jermolene 2017-03-24 09:57:22 +00:00
rodzic d9ed01b621
commit 4891732481
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -80,9 +80,13 @@ ActionListopsWidget.prototype.invokeAction = function(triggeringWidget,
.filterTiddlers(subfilter, this)));
}
if(this.filtertags) {
var tagfilter = "[list[" + this.target + "!!tags]] " + this.filtertags;
this.wiki.setText(this.target, "tags", undefined, $tw.utils.stringifyList(
this.wiki.filterTiddlers(tagfilter, this)));
var tiddler = this.wiki.getTiddler(this.target),
oldtags = tiddler ? (tiddler.fields.tags || []).slice(0) : [],
tagfilter = "[list[" + this.target + "!!tags]] " + this.filtertags,
newtags = this.wiki.filterTiddlers(tagfilter,this);
if($tw.utils.stringifyList(oldtags.sort()) !== $tw.utils.stringifyList(newtags.sort())) {
this.wiki.setText(this.target,"tags",undefined,$tw.utils.stringifyList(newtags));
}
}
return true; // Action was invoked
};