mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-22 10:39:41 +08:00
Misc typescript tweaks (#36523)
Some minor refactors, disable one obsolete lint rule, fix another. The tribute type issue is not fully fixed and I'm pretty sure it must be an error in their types.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {emojiKeys, emojiHTML, emojiString} from './emoji.ts';
|
||||
import {html, htmlRaw} from '../utils/html.ts';
|
||||
import type {TributeCollection} from 'tributejs';
|
||||
import type {MentionValue} from '../types.ts';
|
||||
|
||||
export async function attachTribute(element: HTMLElement) {
|
||||
const {default: Tribute} = await import(/* webpackChunkName: "tribute" */'tributejs');
|
||||
@@ -28,7 +29,7 @@ export async function attachTribute(element: HTMLElement) {
|
||||
},
|
||||
};
|
||||
|
||||
const mentionCollection: TributeCollection<Record<string, any>> = {
|
||||
const mentionCollection: TributeCollection<MentionValue> = {
|
||||
values: window.config.mentionValues,
|
||||
requireLeadingSpace: true,
|
||||
menuItemTemplate: (item) => {
|
||||
@@ -44,7 +45,10 @@ export async function attachTribute(element: HTMLElement) {
|
||||
};
|
||||
|
||||
const tribute = new Tribute({
|
||||
collection: [emojiCollection as TributeCollection<any>, mentionCollection],
|
||||
collection: [
|
||||
emojiCollection as TributeCollection<any>,
|
||||
mentionCollection as TributeCollection<any>,
|
||||
],
|
||||
noMatchTemplate: () => '',
|
||||
});
|
||||
tribute.attach(element);
|
||||
|
||||
Reference in New Issue
Block a user