From af8f3feb8cb00ee3a1aaa41d9d8d1d99617f2305 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 22 May 2024 14:32:10 +0900 Subject: [PATCH 1/3] chore(frontend)!: do not show url preview if URL is in brackets --- packages/frontend/src/scripts/extract-url-from-mfm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/scripts/extract-url-from-mfm.ts b/packages/frontend/src/scripts/extract-url-from-mfm.ts index d5654ba850f8..e60e28c57f80 100644 --- a/packages/frontend/src/scripts/extract-url-from-mfm.ts +++ b/packages/frontend/src/scripts/extract-url-from-mfm.ts @@ -11,8 +11,8 @@ import { unique } from '@/scripts/array.js'; const removeHash = (x: string) => x.replace(/#[^#]*$/, ''); export function extractUrlFromMfm(nodes: mfm.MfmNode[], respectSilentFlag = true): string[] { - const urlNodes = mfm.extract(nodes, (node) => { - return (node.type === 'url') || (node.type === 'link' && (!respectSilentFlag || !node.props.silent)); + const urlNodes = mfm.extract(nodes, (node): node is (mfm.MfmNode & {props:{url:string}}) => { + return (node.type === 'url' && !node.props.brackets) || (node.type === 'link' && (!respectSilentFlag || !node.props.silent)); }); const urls: string[] = unique(urlNodes.map(x => x.props.url)); From 10ad0a2f7037d0cd0dabb6c74565a3c8bc460dd3 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 22 May 2024 14:33:45 +0900 Subject: [PATCH 2/3] =?UTF-8?q?docs(changelog):=20MFM=E5=86=85=E3=81=A7URL?= =?UTF-8?q?=E3=82=92`<>`=E3=81=A7=E5=9B=B2=E3=81=A3=E3=81=9F=E9=9A=9B?= =?UTF-8?q?=E3=81=AB=E3=80=81URL=E3=83=97=E3=83=AC=E3=83=93=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=AA=E3=82=8A=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bdc1d135a68..befa4d760376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ - Enhance: `Ui:C:postForm` および `Ui:C:postFormButton` に `localOnly` と `visibility` を設定できるように - Enhance: AiScriptを0.18.0にバージョンアップ - Enhance: 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように +- Enhance: MFM内でURLを`<>`で囲った際に、URLプレビューが表示されないようになりました - Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: ローカルURLのプレビューポップアップが左上に表示される From 1d405d741f7f7b1783f674fb025054eb83de19ea Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Wed, 22 May 2024 14:35:46 +0900 Subject: [PATCH 3/3] fix: unnecessary changes --- packages/frontend/src/scripts/extract-url-from-mfm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/extract-url-from-mfm.ts b/packages/frontend/src/scripts/extract-url-from-mfm.ts index e60e28c57f80..c2e05d3b058e 100644 --- a/packages/frontend/src/scripts/extract-url-from-mfm.ts +++ b/packages/frontend/src/scripts/extract-url-from-mfm.ts @@ -11,7 +11,7 @@ import { unique } from '@/scripts/array.js'; const removeHash = (x: string) => x.replace(/#[^#]*$/, ''); export function extractUrlFromMfm(nodes: mfm.MfmNode[], respectSilentFlag = true): string[] { - const urlNodes = mfm.extract(nodes, (node): node is (mfm.MfmNode & {props:{url:string}}) => { + const urlNodes = mfm.extract(nodes, (node) => { return (node.type === 'url' && !node.props.brackets) || (node.type === 'link' && (!respectSilentFlag || !node.props.silent)); }); const urls: string[] = unique(urlNodes.map(x => x.props.url));