mirror of https://github.com/keeweb/keeweb.git
fix 559: show all entries on auto-type
This commit is contained in:
parent
0fadcf564a
commit
fac7c41275
|
@ -15,18 +15,15 @@ AutoTypeFilter.prototype.getEntries = function() {
|
|||
text: this.text,
|
||||
autoType: true
|
||||
};
|
||||
let entries = this.appModel.getEntriesByFilter(filter);
|
||||
if (!this.ignoreWindowInfo && this.hasWindowInfo()) {
|
||||
this.prepareFilter();
|
||||
entries = new EntryCollection(entries
|
||||
.map(e => [e, this.getEntryRank(e)])
|
||||
.filter(e => e[1])
|
||||
.sort((x, y) => x[1] === y[1] ? x[0].title.localeCompare(y[0].title) : y[1] - x[1])
|
||||
.map(p => p[0]));
|
||||
} else {
|
||||
entries.sortEntries('title');
|
||||
this.prepareFilter();
|
||||
let entries = this.appModel.getEntriesByFilter(filter)
|
||||
.map(e => [e, this.getEntryRank(e)]);
|
||||
if (!this.ignoreWindowInfo) {
|
||||
entries = entries.filter(e => e[1]);
|
||||
}
|
||||
return entries;
|
||||
entries = entries.sort((x, y) => x[1] === y[1] ? x[0].title.localeCompare(y[0].title) : y[1] - x[1]);
|
||||
entries = entries.map(p => p[0]);
|
||||
return new EntryCollection(entries, {comparator: 'none'});
|
||||
};
|
||||
|
||||
AutoTypeFilter.prototype.hasWindowInfo = function() {
|
||||
|
|
|
@ -190,6 +190,7 @@ const AutoType = {
|
|||
return;
|
||||
}
|
||||
this.focusMainWindow();
|
||||
evt.filter.ignoreWindowInfo = true;
|
||||
this.selectEntryView = new AutoTypeSelectView({
|
||||
model: { filter: evt.filter }
|
||||
}).render();
|
||||
|
|
|
@ -5,9 +5,10 @@ const Comparators = require('../util/comparators');
|
|||
const EntryCollection = Backbone.Collection.extend({
|
||||
model: EntryModel,
|
||||
|
||||
comparator: function() {},
|
||||
comparator: null,
|
||||
|
||||
comparators: {
|
||||
'none': null,
|
||||
'title': Comparators.stringComparator('title', true),
|
||||
'-title': Comparators.stringComparator('title', false),
|
||||
'website': Comparators.stringComparator('url', true),
|
||||
|
@ -23,8 +24,9 @@ const EntryCollection = Backbone.Collection.extend({
|
|||
|
||||
defaultComparator: 'title',
|
||||
|
||||
initialize: function() {
|
||||
this.comparator = this.comparators[this.defaultComparator];
|
||||
initialize: function(models, options) {
|
||||
const comparatorName = options && options.comparator || this.defaultComparator;
|
||||
this.comparator = this.comparators[comparatorName];
|
||||
},
|
||||
|
||||
sortEntries: function(comparator) {
|
||||
|
|
|
@ -270,7 +270,6 @@
|
|||
"autoTypeHeader": "Auto-Type: Select",
|
||||
"autoTypeMsgNoWindow": "We were unable to get active window title, start typing to search",
|
||||
"autoTypeMsgMatchedByWindow": "Select a password for {}",
|
||||
"autoTypeClearFilter": "show all entries",
|
||||
"autoTypeNoMatches": "no matches",
|
||||
|
||||
"appSecWarn": "Not Secure!",
|
||||
|
|
|
@ -14,7 +14,6 @@ const AutoTypePopupView = Backbone.View.extend({
|
|||
|
||||
events: {
|
||||
'click .at-select__header-filter-clear': 'clearFilterText',
|
||||
'click .at-select__message-clear-filter': 'clearFilterWindow',
|
||||
'click .at-select__item': 'itemClicked'
|
||||
},
|
||||
|
||||
|
@ -35,11 +34,10 @@ const AutoTypePopupView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
render() {
|
||||
let topMessage, topClearFilterVisible;
|
||||
let topMessage;
|
||||
if (this.model.filter.title || this.model.filter.url) {
|
||||
topMessage = Locale.autoTypeMsgMatchedByWindow.replace('{}',
|
||||
this.model.filter.title || this.model.filter.url);
|
||||
topClearFilterVisible = !this.model.filter.ignoreWindowInfo;
|
||||
} else {
|
||||
topMessage = Locale.autoTypeMsgNoWindow;
|
||||
}
|
||||
|
@ -56,7 +54,6 @@ const AutoTypePopupView = Backbone.View.extend({
|
|||
this.renderTemplate({
|
||||
filterText: this.model.filter.text,
|
||||
topMessage: topMessage,
|
||||
topClearFilterVisible: topClearFilterVisible,
|
||||
itemsHtml: itemsHtml
|
||||
});
|
||||
document.activeElement.blur();
|
||||
|
@ -150,11 +147,6 @@ const AutoTypePopupView = Backbone.View.extend({
|
|||
this.render();
|
||||
},
|
||||
|
||||
clearFilterWindow() {
|
||||
this.model.filter.ignoreWindowInfo = true;
|
||||
this.render();
|
||||
},
|
||||
|
||||
itemClicked(e) {
|
||||
const itemEl = $(e.target).closest('.at-select__item');
|
||||
const id = itemEl.data('id');
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
</div>
|
||||
<div class="at-select__message">
|
||||
<div class="at-select__message-text">{{topMessage}}</div>
|
||||
{{#if topClearFilterVisible}}<a class="at-select__message-clear-filter">{{res 'autoTypeClearFilter'}}</a>{{/if}}
|
||||
</div>
|
||||
<div class="at-select__items">
|
||||
<div class="scroller">
|
||||
|
|
|
@ -6,6 +6,7 @@ Release notes
|
|||
`*` Dropbox API V2
|
||||
`+` entry templates
|
||||
`+` support cloud providers in iOS homescreen apps
|
||||
`+` auto-type improvements
|
||||
`+` mobile field editing improvements
|
||||
`+` file path hint in recent files list
|
||||
`+` cacheConfigSettings config option
|
||||
|
|
Loading…
Reference in New Issue