mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
feat(filesystem): refactor local filesystem handling to use mounts instead of root paths, enhancing mount management and path normalization
This commit is contained in:
parent
a7a758f26e
commit
30b55a9baa
16 changed files with 421 additions and 80 deletions
|
|
@ -31,6 +31,12 @@ export function SourceCodeEditor({
|
|||
const { resolvedTheme } = useTheme();
|
||||
const onSaveRef = useRef(onSave);
|
||||
const monacoRef = useRef<any>(null);
|
||||
const normalizedModelPath = (() => {
|
||||
const raw = (path || "local-file.txt").trim();
|
||||
const withLeadingSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
||||
// Monaco model paths should be stable and POSIX-like across platforms.
|
||||
return withLeadingSlash.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
||||
})();
|
||||
|
||||
useEffect(() => {
|
||||
onSaveRef.current = onSave;
|
||||
|
|
@ -82,7 +88,7 @@ export function SourceCodeEditor({
|
|||
return (
|
||||
<div className="h-full w-full overflow-hidden bg-sidebar [&_.monaco-editor]:!bg-sidebar [&_.monaco-editor_.margin]:!bg-sidebar [&_.monaco-editor_.monaco-editor-background]:!bg-sidebar [&_.monaco-editor-background]:!bg-sidebar [&_.monaco-scrollable-element_.scrollbar_.slider]:rounded-full [&_.monaco-scrollable-element_.scrollbar_.slider]:bg-foreground/25 [&_.monaco-scrollable-element_.scrollbar_.slider:hover]:bg-foreground/40">
|
||||
<MonacoEditor
|
||||
path={path}
|
||||
path={normalizedModelPath}
|
||||
language={language}
|
||||
value={value}
|
||||
theme={resolvedTheme === "dark" ? "surfsense-dark" : "surfsense-light"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue