From 9b7be6e7356d19281b1b4c408645bede989fec84 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 30 Jun 2023 21:02:03 +0800 Subject: [PATCH] Fix initializeToolTips&Popovers. --- .../Bootstrap/BootstrapScriptContributor.cs | 6 ----- .../bootstrap/dom-event-handlers.js | 26 +++++++++++-------- .../bootstrap.enable.popovers.everywhere.js | 5 ---- .../bootstrap.enable.tooltips.everywhere.js | 5 ---- 4 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 npm/packs/bootstrap/src/bootstrap.enable.popovers.everywhere.js delete mode 100644 npm/packs/bootstrap/src/bootstrap.enable.tooltips.everywhere.js diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Bootstrap/BootstrapScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Bootstrap/BootstrapScriptContributor.cs index 01850ccaf9..121a7f75b9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Bootstrap/BootstrapScriptContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Bootstrap/BootstrapScriptContributor.cs @@ -11,11 +11,5 @@ public class BootstrapScriptContributor : BundleContributor public override void ConfigureBundle(BundleConfigurationContext context) { context.Files.AddIfNotContains("/libs/bootstrap/js/bootstrap.bundle.js"); - context.Files.AddIfNotContains("/libs/bootstrap/js/bootstrap.enable.tooltips.everywhere.js"); - - if (context.FileProvider.GetFileInfo("/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js").Exists) - { - context.Files.AddIfNotContains("/libs/bootstrap/js/bootstrap.enable.popovers.everywhere.js"); - } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js index 7f469e9179..619ca7afa0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js @@ -56,15 +56,19 @@ } abp.dom.initializers.initializeToolTips = function ($tooltips) { - $tooltips.tooltip({ - container: 'body' - }); + for (var i = 0; i < $tooltips.length; i++) { + new bootstrap.Tooltip($tooltips[i], { + container: `body` + }); + } } abp.dom.initializers.initializePopovers = function ($popovers) { - $popovers.popover({ - container: 'body' - }); + for (var i = 0; i < $popovers.length; i++) { + new bootstrap.Popover($popovers[i], { + container: `body` + }); + } } abp.dom.initializers.initializeTimeAgos = function ($timeagos) { @@ -192,8 +196,8 @@ } abp.dom.onNodeAdded(function (args) { - abp.dom.initializers.initializeToolTips(args.$el.findWithSelf('[data-toggle="tooltip"]')); - abp.dom.initializers.initializePopovers(args.$el.findWithSelf('[data-toggle="popover"]')); + abp.dom.initializers.initializeToolTips(args.$el.findWithSelf('[data-bs-toggle="tooltip"]')); + abp.dom.initializers.initializePopovers(args.$el.findWithSelf('[data-bs-toggle="popover"]')); abp.dom.initializers.initializeTimeAgos(args.$el.findWithSelf('.timeago')); abp.dom.initializers.initializeForms(args.$el.findWithSelf('form'), true); abp.dom.initializers.initializeScript(args.$el); @@ -201,7 +205,7 @@ }); abp.dom.onNodeRemoved(function (args) { - args.$el.findWithSelf('[data-toggle="tooltip"]').each(function () { + args.$el.findWithSelf('[data-bs-toggle="tooltip"]').each(function () { $('#' + $(this).attr('aria-describedby')).remove(); }); }); @@ -211,8 +215,8 @@ }); $(function () { - abp.dom.initializers.initializeToolTips($('[data-toggle="tooltip"]')); - abp.dom.initializers.initializePopovers($('[data-toggle="popover"]')); + abp.dom.initializers.initializeToolTips($('[data-bs-toggle="tooltip"]')); + abp.dom.initializers.initializePopovers($('[data-bs-toggle="popover"]')); abp.dom.initializers.initializeTimeAgos($('.timeago')); abp.dom.initializers.initializeDatepickers($(document)); abp.dom.initializers.initializeForms($('form')); diff --git a/npm/packs/bootstrap/src/bootstrap.enable.popovers.everywhere.js b/npm/packs/bootstrap/src/bootstrap.enable.popovers.everywhere.js deleted file mode 100644 index a02a2a7a5e..0000000000 --- a/npm/packs/bootstrap/src/bootstrap.enable.popovers.everywhere.js +++ /dev/null @@ -1,5 +0,0 @@ -(function () { - [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')).map(function (popoverTriggerEl) { - return new bootstrap.Popover(popoverTriggerEl) - }) -})(); diff --git a/npm/packs/bootstrap/src/bootstrap.enable.tooltips.everywhere.js b/npm/packs/bootstrap/src/bootstrap.enable.tooltips.everywhere.js deleted file mode 100644 index 5a2b42a1d1..0000000000 --- a/npm/packs/bootstrap/src/bootstrap.enable.tooltips.everywhere.js +++ /dev/null @@ -1,5 +0,0 @@ -(function () { - [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(function (tooltipTriggerEl) { - return new bootstrap.Tooltip(tooltipTriggerEl) - }); -})();