Skip to content

Commit 427b70b

Browse files
MarkdownRenderer Bug Fixes (#471)
1 parent bf339d2 commit 427b70b

3 files changed

Lines changed: 10 additions & 22 deletions

File tree

workbench-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"@milkdown/crepe": "^7.7.0",
4242
"@milkdown/kit": "^7.7.0",
4343
"@milkdown/react": "^7.7.0",
44-
"@milkdown/theme-nord": "^7.7.0",
4544
"@reduxjs/toolkit": "^1.9.7",
4645
"@rjsf/core": "^5.21.1",
4746
"@rjsf/fluentui-rc": "^5.21.1",

workbench-app/pnpm-lock.yaml

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workbench-app/src/components/Conversations/ContentRenderers/MarkdownEditorRenderer.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ const useStyles = makeStyles({
2929
},
3030
'& .ProseMirror': {
3131
margin: '10px 0 0 0',
32-
padding: '14px 20px 20px 80px',
32+
padding: '14px 20px 20px 70px',
33+
},
34+
'& [data-milkdown-root="true"]': {
35+
height: '100%',
36+
width: '100%',
3337
},
3438
},
3539
toolbar: {
3640
display: 'flex',
3741
justifyContent: 'space-between',
3842
alignItems: 'center',
39-
paddingLeft: '80px',
43+
paddingLeft: '70px',
4044
},
4145
filenameContainer: {
4246
display: 'flex',
@@ -136,7 +140,10 @@ const MilkdownEditor: React.FC<MilkdownEditorProps> = ({
136140
const handleSave = React.useCallback(() => {
137141
if (!onSave || !editorInstance || !hasUnsavedChanges) return;
138142
const currentContent = editorInstance.getMarkdown();
139-
onSave(currentContent);
143+
// Replace <br> tags with unicode line separator to prevent parser issues.
144+
const parsedContent = currentContent.replace(/<br\s*\/?>|<br>/gi, '\u2028');
145+
146+
onSave(parsedContent);
140147
// Note: We don't reset hasUnsavedChanges here because the parent component
141148
// should update the content prop which will trigger the useEffect above
142149
}, [onSave, editorInstance, hasUnsavedChanges]);

0 commit comments

Comments
 (0)