From 152e3329600ba349c7341f8b000e7332baf107a1 Mon Sep 17 00:00:00 2001 From: chmod77 Date: Fri, 13 Dec 2024 09:44:32 +0300 Subject: [PATCH] feat: Remove the default search dialog if it exists (on CMD + K) Signed-off-by: chmod77 --- docs/_static/custom.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/_static/custom.js b/docs/_static/custom.js index 573b21e6fd..dd58574656 100644 --- a/docs/_static/custom.js +++ b/docs/_static/custom.js @@ -1,10 +1,17 @@ -window.addEventListener("DOMContentLoaded", function() { - // Select all elements with class "external" - var externalLinks = document.querySelectorAll("a.external"); +window.addEventListener("DOMContentLoaded", function () { + // Select all elements with class "external" + var externalLinks = document.querySelectorAll("a.external"); - // Loop through each element with class "external" - externalLinks.forEach(function(link) { - // Set the target attribute to "_blank" - link.setAttribute("target", "_blank"); - }); + // Loop through each element with class "external" + externalLinks.forEach(function (link) { + // Set the target attribute to "_blank" + link.setAttribute("target", "_blank"); + }); + + // Remove the default search dialog if it exists (on CMD + K) + // This collides with Algolia's search dialog + const searchDialog = document.getElementById("pst-search-dialog"); + if (searchDialog) { + searchDialog.remove(); + } });