Merge branch 'develop' into feature/config-dropdir

This commit is contained in:
Trivernis 2023-12-27 14:11:42 +01:00
commit 8b31c12607
7 changed files with 72 additions and 15 deletions

View file

@ -76,7 +76,7 @@
"@nestjs/core": "10.2.10",
"@nestjs/testing": "10.2.10",
"@peertube/http-signature": "1.7.0",
"@sharkey/sfm-js": "0.24.0",
"@sharkey/sfm-js": "0.24.1",
"@simplewebauthn/server": "8.3.5",
"@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.1.10",

View file

@ -22,7 +22,7 @@
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@sharkey/sfm-js": "0.24.0",
"@sharkey/sfm-js": "0.24.1",
"@syuilo/aiscript": "0.16.0",
"@phosphor-icons/web": "^2.0.3",
"@twemoji/parser": "15.0.0",
@ -51,6 +51,7 @@
"insert-text-at-cursor": "0.3.0",
"is-file-animated": "1.0.2",
"json5": "2.2.3",
"katex": "0.16.9",
"matter-js": "0.19.0",
"misskey-js": "workspace:*",
"photoswipe": "5.4.3",

View file

@ -0,0 +1,33 @@
<!--
SPDX-FileCopyrightText: dakkar, MoshiBar, and other Sharkey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div v-if="block" :class="$style.block" v-html="renderedFormula"></div>
<span v-else v-html="renderedFormula"></span>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import katex from 'katex';
import 'katex/dist/katex.min.css';
const props = defineProps<{
formula: string;
block: boolean;
}>();
const renderedFormula = computed(() =>
katex.renderToString(props.formula, {
throwOnError: false,
trust: false,
displayMode: props.block,
} as any));
</script>
<style lang="scss" module>
.block {
text-align: center;
}
</style>

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { VNode, h } from 'vue';
import { VNode, h, defineAsyncComponent } from 'vue';
import * as mfm from '@sharkey/sfm-js';
import * as Misskey from 'misskey-js';
import MkUrl from '@/components/global/MkUrl.vue';
@ -61,6 +61,8 @@ export default function(props: MfmProps) {
const useAnim = defaultStore.state.advancedMfm && defaultStore.state.animatedMfm ? true : props.isAnim ? true : false;
const MkFormula = defineAsyncComponent(() => import('@/components/MkFormula.vue'));
/**
* Gen Vue Elements from MFM AST
* @param ast MFM AST
@ -410,11 +412,17 @@ export default function(props: MfmProps) {
}
case 'mathInline': {
return [h('code', token.props.formula)];
return [h(MkFormula, {
formula: token.props.formula,
block: false,
})];
}
case 'mathBlock': {
return [h('code', token.props.formula)];
return [h(MkFormula, {
formula: token.props.formula,
block: true,
})];
}
case 'search': {

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkFolder>
<MkFolder>
<template #icon><i class="ti ti-message-off"></i></template>
<template #icon><i class="ph-x-square ph-bold ph-lg"></i></template>
<template #label>{{ i18n.ts.hardWordMute }}</template>
<XWordMute :muted="$i!.hardMutedWords" @save="saveHardMutedWords"/>
@ -216,11 +216,11 @@ async function toggleBlockItem(item) {
}
async function saveMutedWords(mutedWords: (string | string[])[]) {
await os.api('i/update', { mutedWords });
await os.apiWithDialog('i/update', { mutedWords });
}
async function saveHardMutedWords(hardMutedWords: (string | string[])[]) {
await os.api('i/update', { hardMutedWords });
await os.apiWithDialog('i/update', { hardMutedWords });
}
const headerActions = computed(() => []);

View file

@ -101,7 +101,7 @@ export class Autocomplete {
if (isMention && this.onlyType.includes('user')) {
const username = text.substring(mentionIndex + 1);
if (username !== '' && username.match(/^[a-zA-Z0-9_.]+$/)) {
if (username !== '' && username.match(/^[a-zA-Z0-9_]+$/)) {
this.open('user', username);
opened = true;
} else if (username === '') {