1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 07:35:35 +02:00
Files
misskey/packages/frontend/src/utility/mfm-function-picker.ts
かっこかり ece4efcefe fix(frontend): mfmFunctionPickerを使用して挿入する際のハンドリングを改善 (#17018)
* fix(frontend): mfmFunctionPickerを使用して絵文字を挿入する際のハンドリングを改善

* fix

* Update MkPostForm.vue

* Update Changelog

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2026-01-08 21:08:27 +09:00

30 lines
664 B
TypeScript

/*
* 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();
},
});
}