修复在文件编辑时一直按撤销会导致文件内容变空白
This commit is contained in:
@@ -1563,38 +1563,44 @@ export function FileWorkspacePanel() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex-1 min-h-0">
|
<div className="flex-1 min-h-0">
|
||||||
<MonacoEditor
|
{activeFileTab.loading ? (
|
||||||
beforeMount={defineMonacoThemes}
|
<div className="h-full flex items-center justify-center text-xs text-muted-foreground">
|
||||||
onMount={handleEditorMount}
|
{t("loadingEditor")}
|
||||||
path={buildMonacoModelPath(activeFileTab.path, activeFileTab.id)}
|
</div>
|
||||||
value={renderedContent}
|
) : (
|
||||||
onChange={(value) => {
|
<MonacoEditor
|
||||||
if (!isFileTab) return
|
beforeMount={defineMonacoThemes}
|
||||||
updateActiveFileContent(value ?? "")
|
onMount={handleEditorMount}
|
||||||
}}
|
path={buildMonacoModelPath(activeFileTab.path, activeFileTab.id)}
|
||||||
language={activeFileTab.language}
|
value={renderedContent}
|
||||||
theme={editorTheme}
|
onChange={(value) => {
|
||||||
loading={
|
if (!isFileTab) return
|
||||||
<div className="h-full flex items-center justify-center text-xs text-muted-foreground">
|
updateActiveFileContent(value ?? "")
|
||||||
{t("loadingEditor")}
|
}}
|
||||||
</div>
|
language={activeFileTab.language}
|
||||||
}
|
theme={editorTheme}
|
||||||
options={{
|
loading={
|
||||||
readOnly: !canEdit,
|
<div className="h-full flex items-center justify-center text-xs text-muted-foreground">
|
||||||
minimap: { enabled: false },
|
{t("loadingEditor")}
|
||||||
automaticLayout: true,
|
</div>
|
||||||
fontSize: 13,
|
}
|
||||||
lineNumbersMinChars,
|
options={{
|
||||||
lineDecorationsWidth: 10,
|
readOnly: !canEdit,
|
||||||
wordWrap: "off",
|
minimap: { enabled: false },
|
||||||
scrollBeyondLastLine: false,
|
automaticLayout: true,
|
||||||
scrollBeyondLastColumn: 8,
|
fontSize: 13,
|
||||||
renderLineHighlight: "line",
|
lineNumbersMinChars,
|
||||||
scrollbar: {
|
lineDecorationsWidth: 10,
|
||||||
horizontal: "auto",
|
wordWrap: "off",
|
||||||
},
|
scrollBeyondLastLine: false,
|
||||||
}}
|
scrollBeyondLastColumn: 8,
|
||||||
/>
|
renderLineHighlight: "line",
|
||||||
|
scrollbar: {
|
||||||
|
horizontal: "auto",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user