@@ -11,18 +11,21 @@ require([
11
11
12
12
$ ( function ( ) {
13
13
const engineField = $ ( '#catalog_search_engine' ) ,
14
- commentContainer = $ ( '#row_catalog_search_engine p' ) ;
14
+ commentContainer = $ ( '#row_catalog_search_engine p' ) ,
15
+ defaultText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ,
16
+ unsupportedText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
17
+ 'It is recommended to use OpenSearch as a search engine instead.' ) ,
18
+ updateCommentText = ( ) => {
19
+ const engineValue = engineField . val ( ) ,
20
+ newCommentText = [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ?
21
+ unsupportedText : defaultText ;
15
22
16
- engineField . change ( ( ) => {
17
- const engineValue = engineField . val ( ) ;
18
- let commentText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ;
23
+ if ( commentContainer . text ( ) !== newCommentText ) {
24
+ commentContainer . text ( newCommentText ) ;
25
+ }
26
+ } ;
19
27
20
- if ( [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ) {
21
- commentText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
22
- 'It is recommended to use OpenSearch as a search engine instead.' ) ;
23
- }
24
-
25
- commentContainer . text ( commentText ) ;
26
- } ) ;
28
+ engineField . change ( updateCommentText ) ;
29
+ updateCommentText ( ) ;
27
30
} ) ;
28
31
} ) ;
0 commit comments