Feat: クリックイベントを発生させるMFM構文を追加 (#12798)
* Update MkMisskeyFlavoredMarkdown.ts * fix MkMisskeyFlavoredMarkdown.ts * Update MkAsUi.vue * Update ui.ts * Fix MkMisskeyFlavoredMarkdown.ts * Update CHANGELOG.md * fix ui.ts * revert CHANGELOG.md * Update CHANGELOG.md
This commit is contained in:
@@ -47,6 +47,7 @@ export type AsUiMfm = AsUiComponentBase & {
|
||||
bold?: boolean;
|
||||
color?: string;
|
||||
font?: 'serif' | 'sans-serif' | 'monospace';
|
||||
onClickEv?: (evId: string) => void
|
||||
};
|
||||
|
||||
export type AsUiButton = AsUiComponentBase & {
|
||||
@@ -230,6 +231,8 @@ function getMfmOptions(def: values.Value | undefined): Omit<AsUiMfm, 'id' | 'typ
|
||||
if (color) utils.assertString(color);
|
||||
const font = def.value.get('font');
|
||||
if (font) utils.assertString(font);
|
||||
const onClickEv = def.value.get('onClickEv');
|
||||
if (onClickEv) utils.assertFunction(onClickEv);
|
||||
|
||||
return {
|
||||
text: text?.value,
|
||||
@@ -237,6 +240,9 @@ function getMfmOptions(def: values.Value | undefined): Omit<AsUiMfm, 'id' | 'typ
|
||||
bold: bold?.value,
|
||||
color: color?.value,
|
||||
font: font?.value,
|
||||
onClickEv: (evId: string) => {
|
||||
if (onClickEv) call(onClickEv, values.STR(evId));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user