Skip to content

Commit bc7762b

Browse files
committed
refactor(rich-editor): drop inline comments (TSDoc on the declarations instead)
Fold the image-upload toast note into the insert function's TSDoc and remove the remaining inline // comments.
1 parent 5751a0d commit bc7762b

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/mention/mention-node.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ function MentionChipView({ node, editor }: ReactNodeViewProps) {
135135
const iconStyle = getBareIconStyle(Icon)
136136
const navigable = editor.storage.mention?.navigable === true
137137
const workspaceId = typeof params.workspaceId === 'string' ? params.workspaceId : undefined
138-
// Only show the pointer / route on a kind that actually resolves to a page (e.g. not an integration).
139138
const path = navigable && workspaceId ? simLinkPath(workspaceId, kind, id) : null
140139

141140
const handleClick = (event: MouseEvent) => {

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export const RichMarkdownEditor = memo(function RichMarkdownEditor({
104104

105105
return (
106106
<LoadedRichMarkdownEditor
107-
// Remount on a new streaming context so the stream/settle state is re-established fresh.
108107
key={previewContextKey ? `${file.id}:${previewContextKey}` : file.id}
109108
file={file}
110109
workspaceId={workspaceId}
@@ -207,15 +206,17 @@ export function LoadedRichMarkdownEditor({
207206
const imageInputRef = useRef<HTMLInputElement>(null)
208207
const pendingImagePosRef = useRef<number | null>(null)
209208

210-
/** Upload then insert each image at `at` (paste caret / drop point), sequentially; held in a ref so handlers reach the latest. */
209+
/**
210+
* Upload then insert each image at `at` (paste caret / drop point), sequentially; held in a ref so
211+
* handlers reach the latest. A persistent (`duration: 0`) progress toast shows per image during the
212+
* upload and is dismissed once it settles, when the upload hook's own "Uploaded"/"Failed" toast takes over.
213+
*/
211214
const insertImagesRef = useRef<(images: File[], at: number) => Promise<void>>(() =>
212215
Promise.resolve()
213216
)
214217
insertImagesRef.current = async (images, at) => {
215218
let position = at
216219
for (const image of images) {
217-
// Persistent (`duration: 0`) progress toast, dismissed once the upload settles — the upload
218-
// hook then shows its own "Uploaded"/"Failed" toast.
219220
const uploadingToastId = toast.info(`Uploading "${image.name}"…`, { duration: 0 })
220221
const result = await uploadFile
221222
.mutateAsync({ workspaceId, file: image, folderId: file.folderId ?? null })
@@ -389,7 +390,6 @@ export function LoadedRichMarkdownEditor({
389390
streamRafRef.current = requestAnimationFrame(tick)
390391
return
391392
}
392-
// Drop a frame scheduled just before settle so it can't land afterward and clobber the final content.
393393
if (streamRafRef.current !== null) {
394394
cancelAnimationFrame(streamRafRef.current)
395395
streamRafRef.current = null
@@ -399,7 +399,6 @@ export function LoadedRichMarkdownEditor({
399399
if (isInitialSettle || wasStreamingRef.current) {
400400
wasStreamingRef.current = false
401401
settledRef.current = lockSettled(content)
402-
// Re-seed only if the settled body differs from the last streamed chunk (avoids a needless doc rebuild + selection loss).
403402
const body = splitFrontmatter(content).body
404403
if (body !== lastSyncedBodyRef.current) {
405404
lastSyncedBodyRef.current = body

0 commit comments

Comments
 (0)