Skip to content

Commit dc7ddae

Browse files
silverwindGiteaBot
andauthored
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 github/text-expander-element#75 is merged and released. Co-authored-by: Giteabot <[email protected]>
1 parent 4ffc54f commit dc7ddae

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@citation-js/plugin-software-formats": "0.6.1",
1111
"@github/markdown-toolbar-element": "2.2.3",
1212
"@github/relative-time-element": "4.4.5",
13-
"@github/text-expander-element": "2.8.0",
13+
"@github/text-expander-element": "2.9.0",
1414
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
1515
"@primer/octicons": "19.14.0",
1616
"@silverwind/vue3-calendar-heatmap": "2.0.6",

web_src/js/features/comp/TextExpander.ts

+3-15
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,9 @@ import {createElementFromAttrs, createElementFromHTML} from '../../utils/dom.ts'
66
import {getIssueColor, getIssueIcon} from '../issue.ts';
77
import {debounce} from 'perfect-debounce';
88
import type TextExpanderElement from '@github/text-expander-element';
9+
import type {TextExpanderChangeEvent, TextExpanderResult} from '@github/text-expander-element/dist/text-expander-element.d.ts';
910

10-
type TextExpanderProvideResult = {
11-
matched: boolean,
12-
fragment?: HTMLElement,
13-
}
14-
15-
type TextExpanderChangeEvent = Event & {
16-
detail?: {
17-
key: string,
18-
text: string,
19-
provide: (result: TextExpanderProvideResult | Promise<TextExpanderProvideResult>) => void,
20-
}
21-
}
22-
23-
async function fetchIssueSuggestions(key: string, text: string): Promise<TextExpanderProvideResult> {
11+
async function fetchIssueSuggestions(key: string, text: string): Promise<TextExpanderResult> {
2412
const issuePathInfo = parseIssueHref(window.location.href);
2513
if (!issuePathInfo.ownerName) {
2614
const repoOwnerPathInfo = parseRepoOwnerPathInfo(window.location.pathname);
@@ -59,7 +47,7 @@ export function initTextExpander(expander: TextExpanderElement) {
5947
return keyStart > lineStart;
6048
};
6149

62-
const debouncedIssueSuggestions = debounce(async (key: string, text: string): Promise<TextExpanderProvideResult> => {
50+
const debouncedIssueSuggestions = debounce(async (key: string, text: string): Promise<TextExpanderResult> => {
6351
// https://github.com/github/text-expander-element/issues/71
6452
// Upstream bug: when using "multiword+promise", TextExpander will get wrong "key" position.
6553
// To reproduce, comment out the "shouldShowIssueSuggestions" check, use the "await sleep" below,

0 commit comments

Comments
 (0)