blob: 5580435db192df5ad205e0b8f91924d42c771207 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { MFM_TAGS } from '@@/js/const.js';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
/**
* MFMの装飾のリストを表示する
*/
export function mfmFunctionPicker(anchorElement: HTMLElement | EventTarget | null, onChosen: (tag: string) => void, onClosed?: () => void) {
os.popupMenu([{
text: i18n.ts.addMfmFunction,
type: 'label',
}, ...MFM_TAGS.map(tag => ({
text: tag,
icon: 'ti ti-icons',
action: () => {
onChosen(tag);
},
}))], anchorElement, {
onClosed: () => {
if (onClosed) onClosed();
},
});
}
|