From 71321e46af3069245b2af66f28e64974537b6cd1 Mon Sep 17 00:00:00 2001
From: touti <bitbucket@io0oi.net>
Date: Fri, 10 Sep 2021 16:13:13 +0200
Subject: [PATCH] =?UTF-8?q?assurer=20onAjaxLoad=20pour=20surligner=20les?=
 =?UTF-8?q?=20mots=20m=C3=AAme=20lors=20d'un=20rechagrment=20des=20element?=
 =?UTF-8?q?s=20trouv=C3=A9s=20lors=20d'une=20recherche=20issue=20#4217?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/surligne.php | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ecrire/inc/surligne.php b/ecrire/inc/surligne.php
index 12ca3feea7..44e9a9fffd 100644
--- a/ecrire/inc/surligne.php
+++ b/ecrire/inc/surligne.php
@@ -74,9 +74,10 @@ function surligner_mots($page, $surcharge_surligne = '') {
 			$script = "
       <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js')) . "'></script>
       <script type='text/javascript'>/*<![CDATA[*/
-      if (window.jQuery)
-        (function(\$){\$(function(){
-          \$(document).SearchHighlight({
+      if (window.jQuery) {
+       var highlighter = function() {
+		 jQuery(function($){
+		  \$(document).SearchHighlight({
             tag_name:'" . (html5_permis() ? 'mark' : 'span') . "',
             style_name:'spip_surligne',
             exact:'whole',
@@ -86,10 +87,13 @@ function surligner_mots($page, $surcharge_surligne = '') {
             nohighlight:'.pas_surlignable'" .
 				($surcharge_surligne ? ",
             keys:'$surcharge_surligne'" : '') . ',
-            min_length: 3
-          })
-        });
-      })(jQuery);
+            min_length: 3            
+          });
+		});
+	  }
+		 highlighter();
+		 onAjaxLoad(highlighter);
+     }(jQuery);
       /*]]>*/</script>
       ';
 			// on l'insere juste avant </head>, sinon tout en bas
-- 
GitLab