@@ -55,7 +55,7 @@ import { resolveCenteredFileLineScrollTop } from "./fileLineReveal";
5555import { DiffCommentAnnotation } from "../diffs/DiffCommentAnnotation" ;
5656import { projectFileCacheKey , projectFileEditorCacheKey } from "./fileContentRevision" ;
5757import { fileBreadcrumbs } from "./filePath" ;
58- import { isMarkdownPreviewFile , setMarkdownTaskChecked } from "./filePreviewMode" ;
58+ import { isMarkdownPreviewFile , resolveMarkdownTaskPreviewUpdate } from "./filePreviewMode" ;
5959import { FileSaveCoordinator } from "./fileSaveCoordinator" ;
6060import {
6161 confirmProjectFileQueryData ,
@@ -704,6 +704,7 @@ function RenderedMarkdownSurface({
704704 cwd,
705705 relativePath,
706706 contents,
707+ truncated,
707708 threadRef,
708709 onPendingChange,
709710} : Omit <
@@ -715,6 +716,7 @@ function RenderedMarkdownSurface({
715716 | "wordWrap"
716717 | "onPostRender"
717718> & {
719+ truncated : boolean ;
718720 threadRef : ScopedThreadRef ;
719721} ) {
720722 const saveCoordinator = useFileSaveCoordinator ( {
@@ -731,15 +733,24 @@ function RenderedMarkdownSurface({
731733 cwd = { cwd }
732734 threadRef = { threadRef }
733735 className = "mx-auto max-w-4xl px-6 py-5"
734- onTaskListChange = { ( { markerOffset, checked } ) => {
735- const currentContents =
736- getOptimisticProjectFileQueryData ( environmentId , cwd , relativePath ) ?. contents ??
737- contents ;
738- const nextContents = setMarkdownTaskChecked ( currentContents , markerOffset , checked ) ;
739- if ( nextContents === currentContents ) return ;
740- setProjectFileQueryData ( environmentId , cwd , relativePath , nextContents ) ;
741- saveCoordinator . change ( nextContents ) ;
742- } }
736+ onTaskListChange = {
737+ truncated
738+ ? undefined
739+ : ( { markerOffset, checked } ) => {
740+ const currentContents =
741+ getOptimisticProjectFileQueryData ( environmentId , cwd , relativePath ) ?. contents ??
742+ contents ;
743+ const nextContents = resolveMarkdownTaskPreviewUpdate ( {
744+ markdown : currentContents ,
745+ markerOffset,
746+ checked,
747+ truncated,
748+ } ) ;
749+ if ( nextContents === null ) return ;
750+ setProjectFileQueryData ( environmentId , cwd , relativePath , nextContents ) ;
751+ saveCoordinator . change ( nextContents ) ;
752+ }
753+ }
743754 />
744755 </ ScrollArea >
745756 ) ;
@@ -970,7 +981,8 @@ export default function FilePreviewPanel({
970981 ) : null }
971982 { relativePath && file . data ?. truncated ? (
972983 < div className = "shrink-0 border-b border-warning/20 bg-warning-surface px-3 py-1.5 text-[11px] text-warning-foreground" >
973- Preview limited to the first 1 MB of a { file . data . byteLength . toLocaleString ( ) } byte file.
984+ Read-only preview limited to the first 1 MB of a { file . data . byteLength . toLocaleString ( ) } { " " }
985+ byte file.
974986 </ div >
975987 ) : null }
976988 < div className = "flex min-h-0 flex-1 overflow-hidden" >
@@ -1004,6 +1016,7 @@ export default function FilePreviewPanel({
10041016 relativePath = { relativePath }
10051017 threadRef = { threadRef }
10061018 contents = { file . data . contents }
1019+ truncated = { file . data . truncated }
10071020 onPendingChange = { onPendingChange }
10081021 />
10091022 ) : file . data . truncated ? (
0 commit comments