Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/cloud/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,16 @@ const Editor = ({

const [commentState, commentActions] = useCommentManagerState(doc.id)

// Fix: Refresh CodeMirror when comments sidebar opens/closes to fix cursor position
useEffect(() => {
if (editorRef.current != null) {
// Small delay to ensure DOM has updated
setTimeout(() => {
editorRef.current!.refresh()
}, 0)
}
}, [commentState.mode])

const { openModal, openContextModal } = useModal()

const otherUsers = useMemo(() => {
Expand Down
24 changes: 23 additions & 1 deletion src/cloud/lib/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ const fetchCorrectMdThemeName = (theme: string, appTheme: string) => {
}
if (theme === 'default') {
if (appTheme === 'light') {
return null
// Fix: Return 'default' theme instead of null to ensure code block styling
return 'default'
}
return 'material-darker'
}
Expand Down Expand Up @@ -186,6 +187,27 @@ const generatePrintToPdfHTML = (
pre code {
white-space: pre-wrap;
}
/* Fix: Ensure code blocks have proper contrast in exported PDF/HTML */
.CodeMirror {
background-color: #f5f5f5 !important;
color: #333 !important;
padding: 1em !important;
border-radius: 4px !important;
}
.CodeMirror .cm-s-default {
background-color: #f5f5f5 !important;
color: #333 !important;
}
/* Ensure code text is readable */
pre .CodeMirror-lines {
color: #333 !important;
}
/* Fix for dark themes in light mode exports */
.light .CodeMirror,
.light .CodeMirror-cursor {
background-color: #f5f5f5 !important;
color: #333 !important;
}
</style>
</head>
<body>
Expand Down