Merge branch 'develop' into future-2024-05-31
This commit is contained in:
commit
b2cbd507fe
44 changed files with 223 additions and 79 deletions
|
|
@ -46,6 +46,7 @@ type MfmProps = {
|
|||
enableEmojiMenuReaction?: boolean;
|
||||
isAnim?: boolean;
|
||||
linkNavigationBehavior?: MkABehavior;
|
||||
isBlock?: boolean;
|
||||
};
|
||||
|
||||
type MfmEvents = {
|
||||
|
|
@ -77,6 +78,8 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
return c.match(/^[0-9a-f]{3,6}$/i) ? c : null;
|
||||
};
|
||||
|
||||
const isBlock = props.isBlock ?? false;
|
||||
|
||||
const MkFormula = defineAsyncComponent(() => import('@/components/MkFormula.vue'));
|
||||
|
||||
/**
|
||||
|
|
@ -393,9 +396,9 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
}
|
||||
|
||||
case 'center': {
|
||||
return [h('bdi', h('div', {
|
||||
return [h('div', {
|
||||
style: 'text-align:center;',
|
||||
}, genEl(token.children, scale)))];
|
||||
}, h('bdi', genEl(token.children, scale)))];
|
||||
}
|
||||
|
||||
case 'url': {
|
||||
|
|
@ -431,7 +434,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
}
|
||||
|
||||
case 'blockCode': {
|
||||
return [h('bdi', h(MkCode, {
|
||||
return [h('bdi', { class: 'block' }, h(MkCode, {
|
||||
key: Math.random(),
|
||||
code: token.props.code,
|
||||
lang: token.props.lang ?? undefined,
|
||||
|
|
@ -447,13 +450,13 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
|
||||
case 'quote': {
|
||||
if (!props.nowrap) {
|
||||
return [h('bdi', h('div', {
|
||||
return [h('bdi', { class: 'block' }, h('div', {
|
||||
style: QUOTE_STYLE,
|
||||
}, genEl(token.children, scale, true)))];
|
||||
}, h('bdi',genEl(token.children, scale, true))))];
|
||||
} else {
|
||||
return [h('bdi', h('span', {
|
||||
return [h('span', {
|
||||
style: QUOTE_STYLE,
|
||||
}, genEl(token.children, scale, true)))];
|
||||
}, h('bdi',genEl(token.children, scale, true)))];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -504,7 +507,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
}
|
||||
|
||||
case 'mathBlock': {
|
||||
return [h('bdi', h(MkFormula, {
|
||||
return [h('bdi', { class: 'block' }, h(MkFormula, {
|
||||
formula: token.props.formula,
|
||||
block: true,
|
||||
}))];
|
||||
|
|
@ -518,7 +521,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
}
|
||||
|
||||
case 'plain': {
|
||||
return [h('span', genEl(token.children, scale, true))];
|
||||
return [h('bdi', h('span', genEl(token.children, scale, true)))];
|
||||
}
|
||||
|
||||
default: {
|
||||
|
|
@ -530,7 +533,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
}
|
||||
}).flat(Infinity) as (VNode | string)[];
|
||||
|
||||
return h('bdi', h('span', {
|
||||
return h('bdi', { ...( isBlock ? { class: 'block' } : {}) }, h('span', {
|
||||
// https://codeday.me/jp/qa/20190424/690106.html
|
||||
style: props.nowrap ? 'white-space: pre; word-wrap: normal; overflow: hidden; text-overflow: ellipsis;' : 'white-space: pre-wrap;',
|
||||
}, genEl(rootAst, props.rootScale ?? 1)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue