diff --git a/ui/src/diary/diary-add-note.tsx b/ui/src/diary/diary-add-note.tsx index f27302a52f..9075214c3f 100644 --- a/ui/src/diary/diary-add-note.tsx +++ b/ui/src/diary/diary-add-note.tsx @@ -129,7 +129,7 @@ export default function DiaryAddNote() { const data = JSONToInlines(editor?.getJSON(), false, true); const values = getValues(); - const noteContent = constructStory(data); + const noteContent = constructStory(data, true); const now = Date.now(); const cacheId = { author: window.our, diff --git a/ui/src/types/channel.ts b/ui/src/types/channel.ts index a19e098d6d..631dd0803e 100644 --- a/ui/src/types/channel.ts +++ b/ui/src/types/channel.ts @@ -552,7 +552,10 @@ export const emptyReply: Reply = { }, }; -export function constructStory(data: (Inline | Block)[]): Story { +export function constructStory( + data: (Inline | Block)[], + codeAsBlock?: boolean +): Story { const isBlock = (c: Inline | Block) => [ 'image', @@ -564,6 +567,7 @@ export function constructStory(data: (Inline | Block)[]): Story { 'header', 'rule', 'cite', + codeAsBlock ? 'code' : '', ].some((k) => typeof c !== 'string' && k in c); const postContent: Story = []; let index = 0;