fix #1293: copying full urls

This commit is contained in:
antelle 2020-03-14 21:12:13 +01:00
parent a5c6180154
commit 0b13c06a09
4 changed files with 17 additions and 14 deletions

View File

@ -597,9 +597,7 @@ class DetailsView extends View {
return false; return false;
} }
if (!window.getSelection().toString()) { if (!window.getSelection().toString()) {
const fieldValue = editView.otpValue || editView.value; const fieldText = editView.getTextValue();
const fieldText =
fieldValue && fieldValue.isProtected ? fieldValue.getText() : fieldValue;
if (!fieldText) { if (!fieldText) {
return; return;
} }

View File

@ -22,6 +22,10 @@ class FieldViewUrl extends FieldViewText {
displayUrl(url) { displayUrl(url) {
return url.replace(this.displayUrlRegex, ''); return url.replace(this.displayUrlRegex, '');
} }
getTextValue() {
return this.fixUrl(this.value);
}
} }
export { FieldViewUrl }; export { FieldViewUrl };

View File

@ -82,19 +82,16 @@ class FieldView extends View {
const field = this.model.name; const field = this.model.name;
let copyRes; let copyRes;
if (field) { if (field) {
const value = this.value || ''; const text = this.getTextValue();
if (value && value.isProtected) { if (!text) {
const text = value.getText();
if (!text) {
return;
}
if (!CopyPaste.simpleCopy) {
CopyPaste.createHiddenInput(text);
}
copyRes = CopyPaste.copy(text);
this.emit('copy', { source: this, copyRes });
return; return;
} }
if (!CopyPaste.simpleCopy) {
CopyPaste.createHiddenInput(text);
}
copyRes = CopyPaste.copy(text);
this.emit('copy', { source: this, copyRes });
return;
} }
if (!this.value) { if (!this.value) {
return; return;
@ -347,6 +344,9 @@ class FieldView extends View {
} }
getTextValue() { getTextValue() {
if (!this.value) {
return '';
}
return this.value.isProtected ? this.value.getText() : this.value; return this.value.isProtected ? this.value.getText() : this.value;
} }
} }

View File

@ -13,6 +13,7 @@ Release notes
`-` fix #1385: fixed a file watcher error on network locations `-` fix #1385: fixed a file watcher error on network locations
`-` fix #1391: passwords imported from CSV were not hidden `-` fix #1391: passwords imported from CSV were not hidden
`-` fix #1387: fixed drag-drop for otp fields `-` fix #1387: fixed drag-drop for otp fields
`-` fix #1293: copying full urls
##### v1.12.3 (2019-11-06) ##### v1.12.3 (2019-11-06)
`-` fix #1335: removed the menubar on Windows and Linux `-` fix #1335: removed the menubar on Windows and Linux