mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Update @github/text-expander-element to 2.9.0 (#33435)
				
					
				
			Update and use their newly exported types. Tested, works. The import path is a bit suboptimal, to be fixed once https://github.com/github/text-expander-element/pull/75 is merged and released. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		| @@ -6,21 +6,9 @@ import {createElementFromAttrs, createElementFromHTML} from '../../utils/dom.ts' | ||||
| import {getIssueColor, getIssueIcon} from '../issue.ts'; | ||||
| import {debounce} from 'perfect-debounce'; | ||||
| import type TextExpanderElement from '@github/text-expander-element'; | ||||
| import type {TextExpanderChangeEvent, TextExpanderResult} from '@github/text-expander-element/dist/text-expander-element.d.ts'; | ||||
|  | ||||
| type TextExpanderProvideResult = { | ||||
|   matched: boolean, | ||||
|   fragment?: HTMLElement, | ||||
| } | ||||
|  | ||||
| type TextExpanderChangeEvent = Event & { | ||||
|   detail?: { | ||||
|     key: string, | ||||
|     text: string, | ||||
|     provide: (result: TextExpanderProvideResult | Promise<TextExpanderProvideResult>) => void, | ||||
|   } | ||||
| } | ||||
|  | ||||
| async function fetchIssueSuggestions(key: string, text: string): Promise<TextExpanderProvideResult> { | ||||
| async function fetchIssueSuggestions(key: string, text: string): Promise<TextExpanderResult> { | ||||
|   const issuePathInfo = parseIssueHref(window.location.href); | ||||
|   if (!issuePathInfo.ownerName) { | ||||
|     const repoOwnerPathInfo = parseRepoOwnerPathInfo(window.location.pathname); | ||||
| @@ -59,7 +47,7 @@ export function initTextExpander(expander: TextExpanderElement) { | ||||
|     return keyStart > lineStart; | ||||
|   }; | ||||
|  | ||||
|   const debouncedIssueSuggestions = debounce(async (key: string, text: string): Promise<TextExpanderProvideResult> => { | ||||
|   const debouncedIssueSuggestions = debounce(async (key: string, text: string): Promise<TextExpanderResult> => { | ||||
|     // https://github.com/github/text-expander-element/issues/71 | ||||
|     // Upstream bug: when using "multiword+promise", TextExpander will get wrong "key" position. | ||||
|     // To reproduce, comment out the "shouldShowIssueSuggestions" check, use the "await sleep" below, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user