@@ -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