@@ -126,26 +126,26 @@ window.RenderWiki = class RenderWiki extends Wiki {
126
126
if (
127
127
! $ (
128
128
`.doc-sidebar .sidebar-group[data-title="${ urlParams . get (
129
- "newWiki" ,
130
- ) } "] .add-sidebar-page`,
129
+ "newWiki"
130
+ ) } "] .add-sidebar-page`
131
131
) . length
132
132
) {
133
133
this . add_wiki_sidebar ( urlParams . get ( "newWiki" ) ) ;
134
134
135
135
$ (
136
136
$ (
137
137
`.sidebar-items > .list-unstyled .h6:contains(${ urlParams . get (
138
- "newWiki" ,
139
- ) } ) + .add-sidebar-page`,
140
- ) [ 0 ] ,
138
+ "newWiki"
139
+ ) } ) + .add-sidebar-page`
140
+ ) [ 0 ]
141
141
) . trigger ( "click" ) ;
142
142
} else
143
143
$ (
144
144
$ (
145
145
`.sidebar-items > .list-unstyled .h6:contains(${ urlParams . get (
146
- "newWiki" ,
147
- ) } ) + .add-sidebar-page`,
148
- ) [ 1 ] ,
146
+ "newWiki"
147
+ ) } ) + .add-sidebar-page`
148
+ ) [ 1 ]
149
149
) . trigger ( "click" ) ;
150
150
}
151
151
$ ( ".wiki-footer, .wiki-page-meta" ) . toggleClass ( "hide" ) ;
@@ -168,7 +168,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
168
168
{
169
169
scrollTop : offset ,
170
170
} ,
171
- 500 ,
171
+ 500
172
172
) ;
173
173
} ) ;
174
174
} ) ;
@@ -257,7 +257,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
257
257
$ ( ".edit-wiki-btn, .sidebar-edit-mode-btn" ) . on ( "click" , function ( ) {
258
258
if ( frappe . session . user === "Guest" )
259
259
window . location . assign (
260
- `/login?redirect-to=${ window . location . pathname } ` ,
260
+ `/login?redirect-to=${ window . location . pathname } `
261
261
) ;
262
262
else {
263
263
const urlParams = new URLSearchParams ( window . location . search ) ;
@@ -283,7 +283,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
283
283
const groupName = $ ( ".sidebar-item.active" ) . data ( "group-name" ) ;
284
284
$ ( ".edit-wiki-btn" ) . trigger ( "click" ) ;
285
285
$ (
286
- `.doc-sidebar .add-sidebar-page[data-group-name="${ groupName } "]` ,
286
+ `.doc-sidebar .add-sidebar-page[data-group-name="${ groupName } "]`
287
287
) . trigger ( "click" ) ;
288
288
} ) ;
289
289
@@ -308,7 +308,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
308
308
if ( newWikiPage . data ( "group-name" ) !== groupName ) {
309
309
// when new item is created in a different group as earlier
310
310
newSidebarItem . appendTo (
311
- $ ( this ) . parent ( ) . parent ( ) . children ( ".list-unstyled" ) ,
311
+ $ ( this ) . parent ( ) . parent ( ) . children ( ".list-unstyled" )
312
312
) ;
313
313
if ( urlParams . get ( "newWiki" ) !== groupName )
314
314
set_search_params ( "newWiki" , groupName ) ;
@@ -325,11 +325,11 @@ window.RenderWiki = class RenderWiki extends Wiki {
325
325
} else {
326
326
// fresh new item
327
327
active_items = $ (
328
- ".sidebar-item.active, .sidebar-item.active .active" ,
328
+ ".sidebar-item.active, .sidebar-item.active .active"
329
329
) . removeClass ( "active" ) ;
330
330
331
331
newSidebarItem . appendTo (
332
- $ ( this ) . parent ( ) . parent ( ) . children ( ".list-unstyled" ) ,
332
+ $ ( this ) . parent ( ) . parent ( ) . children ( ".list-unstyled" )
333
333
) ;
334
334
if ( ! $ ( ".wiki-editor" ) . is ( ":visible" ) ) toggleEditor ( ) ;
335
335
if ( urlParams . get ( "newWiki" ) !== groupName )
@@ -338,7 +338,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
338
338
339
339
$ ( this ) . parent ( ) . parent ( ) . each ( setSortable ) ;
340
340
e . stopPropagation ( ) ;
341
- } ,
341
+ }
342
342
) ;
343
343
}
344
344
@@ -367,7 +367,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
367
367
title : __ ( "Delete Wiki Page" ) ,
368
368
indicator : "red" ,
369
369
message : __ (
370
- `Are you sure you want to <b>delete</b> the Wiki Page <b>${ title } </b>?` ,
370
+ `Are you sure you want to <b>delete</b> the Wiki Page <b>${ title } </b>?`
371
371
) ,
372
372
primary_action : {
373
373
label : "Yes" ,
@@ -393,7 +393,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
393
393
} ,
394
394
} ,
395
395
} ) ;
396
- } ,
396
+ }
397
397
) ;
398
398
}
399
399
@@ -408,7 +408,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
408
408
$ ( ".revision-content" ) . html ( ) ,
409
409
$ ( ".from-markdown .wiki-content" )
410
410
. html ( )
411
- . replaceAll ( / < b r c l a s s = " P r o s e M i r r o r - t r a i l i n g B r e a k " > / g, "" ) ,
411
+ . replaceAll ( / < b r c l a s s = " P r o s e M i r r o r - t r a i l i n g B r e a k " > / g, "" )
412
412
) ;
413
413
$ ( ".previous-revision" ) . removeClass ( "hide" ) ;
414
414
} else {
@@ -450,11 +450,11 @@ window.RenderWiki = class RenderWiki extends Wiki {
450
450
if ( previousRevision . content )
451
451
$ ( ".revision-content" ) [ 0 ] . innerHTML = HtmlDiff . execute (
452
452
previousRevision . content ,
453
- currentRevision . content ,
453
+ currentRevision . content
454
454
) ;
455
455
else $ ( ".revision-content" ) [ 0 ] . innerHTML = currentRevision . content ;
456
456
$ (
457
- ".revision-time" ,
457
+ ".revision-time"
458
458
) [ 0 ] . innerHTML = `${ currentRevision . author } edited ${ currentRevision . revision_time } ` ;
459
459
currentRevisionIndex ++ ;
460
460
addHljsClass ( ) ;
@@ -472,10 +472,10 @@ window.RenderWiki = class RenderWiki extends Wiki {
472
472
$ ( ".previous-revision" ) . removeClass ( "hide" ) ;
473
473
$ ( ".revision-content" ) [ 0 ] . innerHTML = HtmlDiff . execute (
474
474
nextRevision . content ,
475
- currentRevision . content ,
475
+ currentRevision . content
476
476
) ;
477
477
$ (
478
- ".revision-time" ,
478
+ ".revision-time"
479
479
) [ 0 ] . innerHTML = `${ currentRevision . author } edited ${ currentRevision . revision_time } ` ;
480
480
currentRevisionIndex -- ;
481
481
addHljsClass ( ) ;
@@ -505,7 +505,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
505
505
$ ( ".doc-sidebar .sidebar-items" )
506
506
. children ( ".list-unstyled" )
507
507
. not ( ".hidden" )
508
- . first ( ) ,
508
+ . first ( )
509
509
) ;
510
510
511
511
$ ( ".web-sidebar ul" ) . each ( setSortable ) ;
@@ -537,7 +537,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
537
537
$ ( this )
538
538
. parent ( )
539
539
. append (
540
- $ ( `<ul class="list-unstyled" style="min-height:20px;"> </ul` ) ,
540
+ $ ( `<ul class="list-unstyled" style="min-height:20px;"> </ul` )
541
541
) ;
542
542
}
543
543
} ) ;
@@ -568,7 +568,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
568
568
// fixes html tags when they are sliced
569
569
return new DOMParser ( ) . parseFromString (
570
570
content . slice ( start , end ) ,
571
- "text/html" ,
571
+ "text/html"
572
572
) . body . innerHTML ;
573
573
}
574
574
@@ -599,27 +599,28 @@ window.RenderWiki = class RenderWiki extends Wiki {
599
599
600
600
frappe
601
601
. call ( {
602
- method : "wiki.wiki.doctype.wiki_page.search .search" ,
602
+ method : "frappe_search.core .search" ,
603
603
args : {
604
604
query : searchInput . val ( ) ,
605
605
path : window . location . pathname ,
606
606
space : search_scope ,
607
607
} ,
608
608
} )
609
609
. then ( ( res ) => {
610
- let results = res . message . docs || [ ] ;
610
+ let results = res . message . results || [ ] ;
611
611
let dropdown_html ;
612
612
if ( results . length === 0 ) {
613
613
dropdown_html = `<div style="margin: 1.5rem 9rem;">No results found</div>` ;
614
614
} else {
615
+ console . log ( results ) ;
615
616
dropdown_html = results
616
617
. map ( ( r ) => {
617
- return `<a class="dropdown-item" href="/${ r . route } ">
618
- <h6>${ r . title } </h6>
618
+ return `<a class="dropdown-item" href="/${ r . extras . route } ">
619
+ <h6>${ r . highlighted_title || r . title } </h6>
619
620
<div>${
620
621
res . message . search_engine === "frappe_web_search"
621
622
? r . content
622
- : trimContent ( r . content )
623
+ : trimContent ( r . highlighted_content || r . content )
623
624
} </div>
624
625
</a>
625
626
<div class='dropdown-border'></div>` ;
@@ -630,7 +631,7 @@ window.RenderWiki = class RenderWiki extends Wiki {
630
631
$dropdown_menu . addClass ( "show" ) ;
631
632
dropdownItems = $dropdown_menu . find ( ".dropdown-item" ) ;
632
633
} ) ;
633
- } , 500 ) ,
634
+ } , 500 )
634
635
) ;
635
636
636
637
$ ( "#dropdownMenuSearch, .mobile-search-icon" ) . on ( "click" , ( ) => {
0 commit comments