fix #1460: auto-type on double-clicking field labels

This commit is contained in:
antelle 2020-06-01 10:25:16 +02:00
parent 448e173f7e
commit a2194435e6
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
7 changed files with 36 additions and 2 deletions

View File

@ -36,6 +36,7 @@ const DefaultAppSettings = {
useGroupIconForEntries: false, // automatically use group icon when creating new entries
enableUsb: true, // enable interaction with USB devices
nativeArgon2: true, // use native argon2 module
fieldLabelDblClickAutoType: false, // trigger auto-type by doubleclicking field label
yubiKeyShowIcon: true, // show an icon to open OTP codes from YubiKey
yubiKeyAutoOpen: false, // auto-load one-time codes when there are open files

View File

@ -13,7 +13,8 @@ const Timeouts = {
LinkDownloadRevoke: 10 * 1000 * 60,
DefaultHttpRequest: 60000,
ExternalDeviceReconnect: 3000,
ExternalDeviceAfterReconnect: 1000
ExternalDeviceAfterReconnect: 1000,
FieldLabelDoubleClick: 300
};
export { Timeouts };

View File

@ -458,6 +458,7 @@
"setGenTryBetaWarningBody": "Please save all files and click this button again",
"setGenShowAppLogs": "Show app logs",
"setGenReloadApp": "Reload the app",
"setGenFieldLabelDblClickAutoType": "Auto-type on double-clicking field labels",
"setFilePath": "File path",
"setFileStorage": "This file is loaded from {}.",

View File

@ -9,6 +9,8 @@ import { Locale } from 'util/locale';
import { AutoType } from 'auto-type';
import { PasswordPresenter } from 'util/formatting/password-presenter';
import { DropdownView } from 'views/dropdown-view';
import { AppSettingsModel } from 'models/app-settings-model';
import { Timeouts } from 'const/timeouts';
import template from 'templates/details/fields/field.hbs';
class FieldView extends View {
@ -16,6 +18,7 @@ class FieldView extends View {
events = {
'click .details__field-label': 'fieldLabelClick',
'dblclick .details__field-label': 'fieldLabelDblClick',
'click .details__field-value': 'fieldValueClick',
'dragstart .details__field-label': 'fieldLabelDrag',
'click .details__field-options': 'fieldOptionsClick'
@ -75,7 +78,20 @@ class FieldView extends View {
if (this.preventCopy) {
return;
}
this.copyValue();
if (AutoType.enabled && AppSettingsModel.fieldLabelDblClickAutoType) {
if (this.fieldLabelClickTimer) {
clearTimeout(this.fieldLabelClickTimer);
this.fieldLabelClickTimer = null;
this.emit('autotype', { source: this });
return;
}
this.fieldLabelClickTimer = setTimeout(() => {
this.copyValue();
this.fieldLabelClickTimer = null;
}, Timeouts.FieldLabelDoubleClick);
} else {
this.copyValue();
}
}
copyValue() {

View File

@ -43,6 +43,8 @@ class SettingsGeneralView extends View {
'change .settings__general-use-markdown': 'changeUseMarkdown',
'change .settings__general-use-group-icon-for-entries': 'changeUseGroupIconForEntries',
'change .settings__general-direct-autotype': 'changeDirectAutotype',
'change .settings__general-field-label-dblclick-autotype':
'changeFieldLabelDblClickAutoType',
'change .settings__general-titlebar-style': 'changeTitlebarStyle',
'click .settings__general-update-btn': 'checkUpdate',
'click .settings__general-restart-btn': 'restartApp',
@ -110,6 +112,7 @@ class SettingsGeneralView extends View {
useMarkdown: AppSettingsModel.useMarkdown,
useGroupIconForEntries: AppSettingsModel.useGroupIconForEntries,
directAutotype: AppSettingsModel.directAutotype,
fieldLabelDblClickAutoType: AppSettingsModel.fieldLabelDblClickAutoType,
supportsTitleBarStyles: Launcher && Features.supportsTitleBarStyles(),
titlebarStyle: AppSettingsModel.titlebarStyle,
storageProviders,
@ -321,6 +324,12 @@ class SettingsGeneralView extends View {
Events.emit('refresh');
}
changeFieldLabelDblClickAutoType(e) {
const fieldLabelDblClickAutoType = e.target.checked || false;
AppSettingsModel.fieldLabelDblClickAutoType = fieldLabelDblClickAutoType;
Events.emit('refresh');
}
restartApp() {
if (Launcher) {
Launcher.requestRestart();

View File

@ -147,6 +147,11 @@
id="settings__general-direct-autotype" {{#if directAutotype}}checked{{/if}} />
<label for="settings__general-direct-autotype">{{res 'setGenDirectAutotype'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__general-field-label-dblclick-autotype"
id="settings__general-field-label-dblclick-autotype" {{#if fieldLabelDblClickAutoType}}checked{{/if}} />
<label for="settings__general-field-label-dblclick-autotype">{{res 'setGenFieldLabelDblClickAutoType'}}</label>
</div>
{{/if}}
<div>
<input type="checkbox" class="settings__input input-base settings__general-use-markdown" id="settings__general-use-markdown" {{#if useMarkdown}}checked{{/if}} />

View File

@ -3,6 +3,7 @@ Release notes
##### v1.15.0 (WIP)
`+` YubiKey integration in two modes: OATH and Challenge-Response
`+` configs are now encrypted with a key stored in keychain
`+` #1460: auto-type on double-clicking field labels
`+` #557: Argon2 speed improvements in desktop apps
`+` #1503: ARM64 Windows support
`+` #1480: option to create a portable installation