1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-26 07:39:04 +02:00
This commit is contained in:
antelle 2019-09-08 11:32:31 +02:00
parent 7f20e6cc46
commit 56fbc14893
3 changed files with 17 additions and 2 deletions

View File

@ -14,9 +14,10 @@ const FieldViewAutocomplete = FieldViewText.extend({
startEdit() { startEdit() {
FieldViewText.prototype.startEdit.call(this); FieldViewText.prototype.startEdit.call(this);
const fieldRect = this.input[0].getBoundingClientRect(); const fieldRect = this.input[0].getBoundingClientRect();
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
this.autocomplete = $('<div class="details__field-autocomplete"></div>').appendTo('body'); this.autocomplete = $('<div class="details__field-autocomplete"></div>').appendTo('body');
this.autocomplete.css({ this.autocomplete.css({
top: fieldRect.bottom, top: fieldRect.bottom + shadowSpread,
left: fieldRect.left, left: fieldRect.left,
width: fieldRect.width - 2 width: fieldRect.width - 2
}); });

View File

@ -33,9 +33,22 @@ const FieldViewDate = FieldViewText.extend({
weekdaysShort: Locale.weekdaysShort weekdaysShort: Locale.weekdaysShort
} }
}); });
this.picker.adjustPosition = this.adjustPickerPosition.bind(this);
_.defer(this.picker.show.bind(this.picker)); _.defer(this.picker.show.bind(this.picker));
}, },
adjustPickerPosition(...args) {
window.Pikaday = Pikaday;
Pikaday.prototype.adjustPosition.apply(this.picker, args);
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
if (shadowSpread) {
const isOnTop = this.picker.el.classList.contains('top-aligned');
const offset = isOnTop ? -shadowSpread : shadowSpread;
const newTop = parseInt(this.picker.el.style.top) + offset;
this.picker.el.style.top = `${newTop}px`;
}
},
fieldValueBlur(e) { fieldValueBlur(e) {
if (!this.picker) { if (!this.picker) {
FieldViewText.prototype.fieldValueBlur.call(this, e); FieldViewText.prototype.fieldValueBlur.call(this, e);

View File

@ -38,11 +38,12 @@ const FieldViewTags = FieldViewText.extend({
startEdit() { startEdit() {
FieldViewText.prototype.startEdit.call(this); FieldViewText.prototype.startEdit.call(this);
const fieldRect = this.input[0].getBoundingClientRect(); const fieldRect = this.input[0].getBoundingClientRect();
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
this.tagsAutocomplete = $('<div class="details__field-autocomplete"></div>').appendTo( this.tagsAutocomplete = $('<div class="details__field-autocomplete"></div>').appendTo(
'body' 'body'
); );
this.tagsAutocomplete.css({ this.tagsAutocomplete.css({
top: fieldRect.bottom, top: fieldRect.bottom + shadowSpread,
left: fieldRect.left, left: fieldRect.left,
width: fieldRect.width - 2 width: fieldRect.width - 2
}); });