fix code quality issues
This commit is contained in:
parent
9ffa56aa1b
commit
b6f6c3ea18
27 changed files with 63 additions and 64 deletions
|
@ -62,12 +62,12 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
const validTime = (t: string | boolean | null | undefined) => {
|
||||
if (t == null) return null;
|
||||
if (typeof t === 'boolean') return null;
|
||||
return t.match(/^[0-9.]+s$/) ? t : null;
|
||||
return RegExp(/^[0-9.]+s$/).exec(t) ? t : null;
|
||||
};
|
||||
|
||||
const validColor = (c: unknown): string | null => {
|
||||
if (typeof c !== 'string') return null;
|
||||
return c.match(/^[0-9a-f]{3,6}$/i) ? c : null;
|
||||
return RegExp(/^[0-9a-f]{3,6}$/i).exec(c) ? c : null;
|
||||
};
|
||||
|
||||
const useAnim = defaultStore.state.advancedMfm && defaultStore.state.animatedMfm;
|
||||
|
@ -356,7 +356,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
case 'mention': {
|
||||
return [h(MkMention, {
|
||||
key: Math.random(),
|
||||
host: (token.props.host == null && props.author && props.author.host != null ? props.author.host : token.props.host) ?? host,
|
||||
host: (token.props.host == null && props.author?.host ? props.author.host : token.props.host) ?? host,
|
||||
username: token.props.username,
|
||||
})];
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ function onTabClick(t: Tab, ev: MouseEvent): void {
|
|||
|
||||
function renderTab() {
|
||||
const tabEl = props.tab ? tabRefs[props.tab] : undefined;
|
||||
if (tabEl && tabHighlightEl.value && tabHighlightEl.value.parentElement) {
|
||||
if (tabEl && tabHighlightEl.value?.parentElement) {
|
||||
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
||||
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
||||
const parentRect = tabHighlightEl.value.parentElement.getBoundingClientRect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue