kopia lustrzana https://github.com/shoelace-style/shoelace
				
				
				
			improve search results
							rodzic
							
								
									c368af633c
								
							
						
					
					
						commit
						ec63d4c528
					
				|  | @ -219,13 +219,7 @@ | ||||||
|         await searchIndex; |         await searchIndex; | ||||||
| 
 | 
 | ||||||
|         const hasQuery = query.length > 0; |         const hasQuery = query.length > 0; | ||||||
|         let matches = hasQuery ? searchIndex.search(`${query}`) : []; |         const matches = hasQuery ? searchIndex.search(`t:*${query}*^20 h:*${query}*^10 ${query}~1^5 *${query}*^0`) : []; | ||||||
| 
 |  | ||||||
|         // Fall back to a fuzzy search if no matches are found
 |  | ||||||
|         if (matches.length === 0 && hasQuery) { |  | ||||||
|           matches = searchIndex.search(`${query}~2`); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         const hasResults = hasQuery && matches.length > 0; |         const hasResults = hasQuery && matches.length > 0; | ||||||
|         siteSearch.classList.toggle('site-search--has-results', hasQuery && hasResults); |         siteSearch.classList.toggle('site-search--has-results', hasQuery && hasResults); | ||||||
|         siteSearch.classList.toggle('site-search--no-results', hasQuery && !hasResults); |         siteSearch.classList.toggle('site-search--no-results', hasQuery && !hasResults); | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis | ||||||
| - Fixed a bug that allowed `<sl-details>` to open and close when disabled using a screen reader [#658](https://github.com/shoelace-style/shoelace/issues/658) | - Fixed a bug that allowed `<sl-details>` to open and close when disabled using a screen reader [#658](https://github.com/shoelace-style/shoelace/issues/658) | ||||||
| - Implemented stricter linting to improve consistency and reduce errors, which resulted in many small refactors throughout the codebase [#647](https://github.com/shoelace-style/shoelace/pull/647) | - Implemented stricter linting to improve consistency and reduce errors, which resulted in many small refactors throughout the codebase [#647](https://github.com/shoelace-style/shoelace/pull/647) | ||||||
| - Improved accessibility of `<sl-dialog>` and `<sl-drawer>` by making the title an `<h2>` and adding a label to the close button | - Improved accessibility of `<sl-dialog>` and `<sl-drawer>` by making the title an `<h2>` and adding a label to the close button | ||||||
|  | - Improved search results in the documentation | ||||||
| - Refactored `<sl-format-byte>` to use `Intl.NumberFormat` so it supports localization | - Refactored `<sl-format-byte>` to use `Intl.NumberFormat` so it supports localization | ||||||
| - Refactored themes so utility styles are no longer injected as `<style>` elements to support stricter CSP rules [#571](https://github.com/shoelace-style/shoelace/issues/571) | - Refactored themes so utility styles are no longer injected as `<style>` elements to support stricter CSP rules [#571](https://github.com/shoelace-style/shoelace/issues/571) | ||||||
| - Restored the nicer animation on `<sl-spinner>` and verified it works in Safari | - Restored the nicer animation on `<sl-spinner>` and verified it works in Safari | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Cory LaViska
						Cory LaViska