diff --git a/src/pages/MemoList.tsx b/src/pages/MemoList.tsx
index d35509f..24305e1 100644
--- a/src/pages/MemoList.tsx
+++ b/src/pages/MemoList.tsx
@@ -100,6 +100,16 @@ export function MemoList(): JSX.Element {
}
};
+ const removeHtmlTags = (htmlString: string): string => {
+ // 新しい行で
タグを置き換える
+ const newlineRegex = /
/gi;
+ htmlString = htmlString.replace(newlineRegex, ' ');
+
+ // DOMParserを使用してHTML文字列からHTMLタグを取り除く
+ const doc = new DOMParser().parseFromString(htmlString, 'text/html');
+ return doc.body.textContent || "";
+ };
+
useEffect(() => {
getMemoList();
}, [loginUser, getMemoList]);
@@ -189,7 +199,7 @@ export function MemoList(): JSX.Element {
const [reorderedItem] = items.splice(result.source.index, 1);
items.splice(result.destination.index, 0, reorderedItem);
- setMemoList(items);
+ setMemoList(items);
};
@@ -336,7 +346,7 @@ export function MemoList(): JSX.Element {
width: '80%',
display: 'inline-block' // インライン要素でも幅を適用させる
}}>
- {truncateText(memo.content, 100)}
+ {truncateText(removeHtmlTags(memo.content), 100)}
>
}