Merge pull request #7931 from prssanna/link-preview-fix

fix: fix for popovers never hiding
This commit is contained in:
mergify[bot] 2019-07-19 11:54:51 +00:00 committed by GitHub
commit f8bc9eec7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
frappe.ui.LinkPreview = class {
constructor() {
this.$links = [];
this.popovers_list = [];
this.LINK_CLASSES = 'a[data-doctype], input[data-fieldtype="Link"], .popover';
this.popover_timeout = null;
this.setup_events();
@ -104,7 +104,7 @@ frappe.ui.LinkPreview = class {
}
handle_popover_hide() {
$(document.body).on('mouseout', this.LINK_CLASSES, () => {
$(document).on('mouseout', this.LINK_CLASSES, () => {
// To allow popover to be hovered on
if (!$('.popover:hover').length) {
this.link_hovered = false;
@ -129,7 +129,7 @@ frappe.ui.LinkPreview = class {
}
clear_all_popovers() {
this.$links.forEach($el => $el.popover('hide'));
this.popovers_list.forEach($el => $el.hide());
}
get_preview_fields() {
@ -190,7 +190,7 @@ frappe.ui.LinkPreview = class {
$popover.addClass('link-preview-popover');
$popover.toggleClass('control-field-popover', this.is_link);
this.$links.push(this.element);
this.popovers_list.push(this.element.data('bs.popover'));
}