This commit is contained in:
the-djmaze 2022-07-21 21:57:29 +02:00
parent a5caae8991
commit cf71c1a18f
3 changed files with 6 additions and 7 deletions

View file

@ -233,8 +233,8 @@ export class FilterModel extends AbstractModel {
return filter;
}
cloneSelf() {
const filter = new FilterModel();
assignTo(target) {
const filter = target || new FilterModel();
filter.id = this.id;

View file

@ -102,12 +102,12 @@ export class SieveScriptPopupView extends rl.pluginPopupView {
filter.generateID();
FilterPopupView.showModal([
filter,
() => this.filters.push(filter)
() => this.filters.push(filter.assignTo())
]);
}
editFilter(filter) {
const clonedFilter = filter.cloneSelf();
const clonedFilter = filter.assignTo();
FilterPopupView.showModal([
clonedFilter,
() => {
@ -115,8 +115,7 @@ export class SieveScriptPopupView extends rl.pluginPopupView {
filters = script.filters(),
index = filters.indexOf(filter);
if (-1 < index) {
// script.filters.splice(index, 1, clonedFilter);
filters[index] = clonedFilter;
clonedFilter.assignTo(filter);
script.filters(filters);
}
},

View file

@ -22,7 +22,7 @@
data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option>
</select>
</div>
<div data-bind="visible: conditions().length, foreach: conditions">
<div data-bind="foreach: conditions">
<div class="control-group" data-bind="css: {'error': valueError}" style="display:flex">
<div style="flex-grow:1" data-bind="css: {'error': valueError}, template: {'name': template(), 'data': $data}"></div>
<span class="delete-action button-delete fontastic" style="margin-top: 5px;"