fix #107: multiline custom fields support

This commit is contained in:
antelle 2019-09-11 23:50:18 +02:00
parent 07df05304e
commit 0a9296c6c4
5 changed files with 16 additions and 4 deletions

View File

@ -115,6 +115,17 @@ const PasswordGenerator = {
present(length) {
return new Array(length + 1).join('•');
},
presentValueWithLineBreaks(value) {
if (!value) {
return '';
}
let result = '';
value.forEachChar(ch => {
result += ch === 10 ? '\n' : '•';
});
return result;
}
};

View File

@ -331,6 +331,7 @@ const DetailsView = Backbone.View.extend({
model: {
name: '$' + field,
title: field,
multiline: true,
value() {
return model.fields[field];
}
@ -388,6 +389,7 @@ const DetailsView = Backbone.View.extend({
name: '$' + newFieldTitle,
title: newFieldTitle,
newField: newFieldTitle,
multiline: true,
value() {
return '';
}

View File

@ -11,7 +11,7 @@ const Tip = require('../../util/tip');
const FieldViewText = FieldView.extend({
renderValue(value) {
return value && value.isProtected
? PasswordGenerator.present(value.textLength)
? PasswordGenerator.presentValueWithLineBreaks(value)
: _.escape(value || '').replace(/\n/g, '<br/>');
},
@ -124,8 +124,6 @@ const FieldViewText = FieldView.extend({
let newHeight = this.input[0].scrollHeight;
if (newHeight <= MinHeight) {
newHeight = MinHeight;
} else {
newHeight += 2;
}
this.input.height(newHeight);
},

View File

@ -203,7 +203,7 @@
cursor: text;
}
> input {
margin: 0;
margin: 0 0 0 2px;
padding: 0 $base-padding-h;
line-height: $details-field-line-height;
height: $details-field-line-height;

View File

@ -2,6 +2,7 @@ Release notes
-------------
##### v1.11.0 (TBD)
`+` #1226: 7-digit Authy OTP support
`+` #107: multiline custom fields support
`-` fix #764: multiple attachments display
`-` fix multi-line fields display in history