mirror of https://github.com/keeweb/keeweb.git
entry templates fields
This commit is contained in:
parent
6930b23ad9
commit
3662a67de3
|
@ -388,9 +388,9 @@ const EntryModel = Backbone.Model.extend({
|
|||
this._fillByEntry();
|
||||
},
|
||||
|
||||
setField: function(field, val) {
|
||||
setField: function(field, val, allowEmpty) {
|
||||
const hasValue = val && (typeof val === 'string' || val.isProtected && val.byteLength);
|
||||
if (hasValue || this.builtInFields.indexOf(field) >= 0) {
|
||||
if (hasValue || allowEmpty || this.builtInFields.indexOf(field) >= 0) {
|
||||
this._entryModified();
|
||||
this.entry.fields[field] = val;
|
||||
} else if (this.entry.fields.hasOwnProperty(field)) {
|
||||
|
|
|
@ -248,6 +248,10 @@ const GroupModel = MenuItemModel.extend({
|
|||
return this.parentGroup ? this.parentGroup.getEffectiveAutoTypeSeq() : DefaultAutoTypeSequence;
|
||||
},
|
||||
|
||||
isEntryTemplatesGroup: function() {
|
||||
return this.group.uuid.equals(this.file.db.meta.entryTemplatesGroup);
|
||||
},
|
||||
|
||||
moveToTrash: function() {
|
||||
this.file.setModified();
|
||||
this.file.db.remove(this.group);
|
||||
|
|
|
@ -479,7 +479,8 @@ const DetailsView = Backbone.View.extend({
|
|||
i++;
|
||||
fieldName = e.newField + i;
|
||||
}
|
||||
this.model.setField(fieldName, e.val);
|
||||
const allowEmpty = this.model.group.isEntryTemplatesGroup();
|
||||
this.model.setField(fieldName, e.val, allowEmpty);
|
||||
this.entryUpdated();
|
||||
return;
|
||||
} else if (fieldName === 'File') {
|
||||
|
|
Loading…
Reference in New Issue