diff --git a/resources/js/src/modules/ajax-message.ts b/resources/js/src/modules/ajax-message.ts index a9542651bb..1348ed3627 100644 --- a/resources/js/src/modules/ajax-message.ts +++ b/resources/js/src/modules/ajax-message.ts @@ -1,5 +1,4 @@ import $ from 'jquery'; -import tooltip from './tooltip.ts'; import highlightSql from './sql-highlight.ts'; /** @@ -115,9 +114,7 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) { $retval .delay(newTimeOut) .fadeOut('medium', function () { - if ($(this).is(':data(tooltip)')) { - $(this).uiTooltip('destroy'); - } + window.bootstrap.Tooltip.getInstance(this)?.dispose(); // Remove the notification $(this).remove(); @@ -132,7 +129,8 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) { * Add a tooltip to the notification to let the user know that they * can dismiss the ajax notification by clicking on it. */ - tooltip($retval, 'span', window.Messages.strDismiss); + window.bootstrap.Tooltip.getOrCreateInstance($retval.get(0), { title: window.Messages.strDismiss }) + .setContent({ '.tooltip-inner': window.Messages.strDismiss }); } // Hide spinner if this is not a loading message @@ -152,15 +150,13 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) { */ const ajaxRemoveMessage = function ($thisMessageBox: JQuery | boolean): void { if ($thisMessageBox !== undefined && typeof $thisMessageBox !== 'boolean' && $thisMessageBox instanceof $) { + window.bootstrap.Tooltip.getInstance($thisMessageBox.get(0))?.dispose(); + $thisMessageBox .stop(true, true) .fadeOut('medium'); - if ($thisMessageBox.is(':data(tooltip)')) { - $thisMessageBox.uiTooltip('destroy'); - } else { - $thisMessageBox.remove(); - } + $thisMessageBox.remove(); } }; diff --git a/resources/js/src/modules/functions.ts b/resources/js/src/modules/functions.ts index b357486ad3..a3617a2b94 100644 --- a/resources/js/src/modules/functions.ts +++ b/resources/js/src/modules/functions.ts @@ -1507,22 +1507,6 @@ export function dismissNotifications () { } }); - /** - * The below two functions hide the "Dismiss notification" tooltip when a user - * is hovering a link or button that is inside an ajax message - */ - $(document).on('mouseover', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () { - if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) { - $(this).parents('span.ajax_notification').uiTooltip('disable'); - } - }); - - $(document).on('mouseout', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () { - if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) { - $(this).parents('span.ajax_notification').uiTooltip('enable'); - } - }); - $(document).on('click', 'a.copyQueryBtn', function (event) { event.preventDefault(); var copyStatus = copyToClipboard($(this).attr('data-text')); @@ -1536,11 +1520,8 @@ export function dismissNotifications () { message = $(this).hasClass('copyQueryBtn') ? window.Messages.strCopyToClipboard : window.Messages.strEditQuery; } - tooltip( - $('.ajax_notification'), - 'span', - message - ); + window.bootstrap.Tooltip.getOrCreateInstance('.ajax_notification', { title: message }) + .setContent({ '.tooltip-inner': message }); }); $(document).on('mouseup', '.ajax_notification a', function (event) {