diff --git a/packages/backend/package.json b/packages/backend/package.json index cda2da911c..0321936165 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -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", diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 275a6ad025..496a083aa9 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -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", diff --git a/packages/frontend/src/components/MkFormula.vue b/packages/frontend/src/components/MkFormula.vue new file mode 100644 index 0000000000..039cef8da8 --- /dev/null +++ b/packages/frontend/src/components/MkFormula.vue @@ -0,0 +1,33 @@ + + + + + + + diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index 60d12fdcde..83b7ef2e78 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -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': { diff --git a/packages/frontend/src/pages/settings/mute-block.vue b/packages/frontend/src/pages/settings/mute-block.vue index 6419d23a7a..a996a03cce 100644 --- a/packages/frontend/src/pages/settings/mute-block.vue +++ b/packages/frontend/src/pages/settings/mute-block.vue @@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -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(() => []); diff --git a/packages/frontend/src/scripts/autocomplete.ts b/packages/frontend/src/scripts/autocomplete.ts index 6f3d3ba8e1..2a9a42ace5 100644 --- a/packages/frontend/src/scripts/autocomplete.ts +++ b/packages/frontend/src/scripts/autocomplete.ts @@ -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 === '') { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 193d294f2b..4a9777ea2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,8 +110,8 @@ importers: specifier: 1.7.0 version: 1.7.0 '@sharkey/sfm-js': - specifier: 0.24.0 - version: 0.24.0 + specifier: 0.24.1 + version: 0.24.1 '@simplewebauthn/server': specifier: 8.3.5 version: 8.3.5 @@ -676,8 +676,8 @@ importers: specifier: 5.1.0 version: 5.1.0(rollup@4.9.1) '@sharkey/sfm-js': - specifier: 0.24.0 - version: 0.24.0 + specifier: 0.24.1 + version: 0.24.1 '@syuilo/aiscript': specifier: 0.16.0 version: 0.16.0 @@ -759,6 +759,9 @@ importers: json5: specifier: 2.2.3 version: 2.2.3 + katex: + specifier: 0.16.9 + version: 0.16.9 matter-js: specifier: 0.19.0 version: 0.19.0 @@ -5853,8 +5856,8 @@ packages: string-argv: 0.3.1 dev: true - /@sharkey/sfm-js@0.24.0: - resolution: {integrity: sha512-OkrStlAj6MK0KHylLCc6I9IE1D9UjaV32bWo731o05Mny2R1JmkdoFTof92XTkJ4CKmvSk2oXlLBAt3jQ4Ghlg==, tarball: https://git.joinsharkey.org/api/packages/Sharkey/npm/%40sharkey%2Fsfm-js/-/0.24.0/sfm-js-0.24.0.tgz} + /@sharkey/sfm-js@0.24.1: + resolution: {integrity: sha512-STBMI34OEXjS94+/uUk9MtJLoKzF6TqZbS6BZRZ8bo4NEq2rTH330R6Q90xSJI1FY6RIV7kxepIG8cjUumY4kA==, tarball: https://git.joinsharkey.org/api/packages/Sharkey/npm/%40sharkey%2Fsfm-js/-/0.24.1/sfm-js-0.24.1.tgz} dependencies: '@twemoji/parser': 15.0.0 dev: false @@ -10336,6 +10339,11 @@ packages: engines: {node: '>= 10'} dev: false + /commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + dev: false + /commander@9.5.0: resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} engines: {node: ^12.20.0 || >=14} @@ -14483,6 +14491,13 @@ packages: safe-buffer: 5.2.1 dev: false + /katex@0.16.9: + resolution: {integrity: sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==} + hasBin: true + dependencies: + commander: 8.3.0 + dev: false + /keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} dependencies: