1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Fixes Action-listops bug (#5644)

This commit is contained in:
Saq Imtiaz 2021-04-26 12:29:16 +02:00 committed by GitHub
parent 8203ee06c3
commit e2379b599e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,9 +44,7 @@ ActionListopsWidget.prototype.execute = function() {
*/ */
ActionListopsWidget.prototype.refresh = function(changedTiddlers) { ActionListopsWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes(); var changedAttributes = this.computeAttributes();
if(changedAttributes.$tiddler || changedAttributes.$filter || if($tw.utils.count(changedAttributes) > 0) {
changedAttributes.$subfilter || changedAttributes.$field ||
changedAttributes.$index || changedAttributes.$tags) {
this.refreshSelf(); this.refreshSelf();
return true; return true;
} }
@ -60,12 +58,10 @@ ActionListopsWidget.prototype.invokeAction = function(triggeringWidget,
//Apply the specified filters to the lists //Apply the specified filters to the lists
var field = this.listField, var field = this.listField,
index, index,
type = "!!",
list = this.listField; list = this.listField;
if(this.listIndex) { if(this.listIndex) {
field = undefined; field = undefined;
index = this.listIndex; index = this.listIndex;
type = "##";
list = this.listIndex; list = this.listIndex;
} }
if(this.filter) { if(this.filter) {
@ -74,15 +70,14 @@ ActionListopsWidget.prototype.invokeAction = function(triggeringWidget,
.filterTiddlers(this.filter, this))); .filterTiddlers(this.filter, this)));
} }
if(this.subfilter) { if(this.subfilter) {
var subfilter = "[list[" + this.target + type + list + "]] " + this.subfilter; var inputList = this.wiki.getTiddlerList(this.target,field,index),
this.wiki.setText(this.target, field, index, $tw.utils.stringifyList( subfilter = $tw.utils.stringifyList(inputList) + " " + this.subfilter;
this.wiki this.wiki.setText(this.target, field, index, $tw.utils.stringifyList(this.wiki.filterTiddlers(subfilter,this)));
.filterTiddlers(subfilter, this)));
} }
if(this.filtertags) { if(this.filtertags) {
var tiddler = this.wiki.getTiddler(this.target), var tiddler = this.wiki.getTiddler(this.target),
oldtags = tiddler ? (tiddler.fields.tags || []).slice(0) : [], oldtags = tiddler ? (tiddler.fields.tags || []).slice(0) : [],
tagfilter = "[list[" + this.target + "!!tags]] " + this.filtertags, tagfilter = $tw.utils.stringifyList(oldtags) + " " + this.filtertags,
newtags = this.wiki.filterTiddlers(tagfilter,this); newtags = this.wiki.filterTiddlers(tagfilter,this);
if($tw.utils.stringifyList(oldtags.sort()) !== $tw.utils.stringifyList(newtags.sort())) { if($tw.utils.stringifyList(oldtags.sort()) !== $tw.utils.stringifyList(newtags.sort())) {
this.wiki.setText(this.target,"tags",undefined,$tw.utils.stringifyList(newtags)); this.wiki.setText(this.target,"tags",undefined,$tw.utils.stringifyList(newtags));