EDITOR: changed editor tabs to have their own editor mode (#1372)

This commit is contained in:
G4mingJon4s
2024-06-13 04:19:40 +02:00
committed by GitHub
parent 805ca06922
commit bec6e82d7f
11 changed files with 34 additions and 18 deletions
+4 -3
View File
@@ -44,7 +44,7 @@ function Root(props: IProps): React.ReactElement {
const rerender = useRerender();
const editorRef = useRef<IStandaloneCodeEditor | null>(null);
const { options, updateRAM, startUpdatingRAM, finishUpdatingRAM } = useScriptEditorContext();
const { updateRAM, startUpdatingRAM, finishUpdatingRAM } = useScriptEditorContext();
let decorations: monaco.editor.IEditorDecorationsCollection | undefined;
@@ -194,6 +194,7 @@ function Root(props: IProps): React.ReactElement {
props.hostname,
new monaco.Position(0, 0),
makeModel(props.hostname, filename, code),
props.vim,
);
openScripts.push(newScript);
currentScript = newScript;
@@ -375,7 +376,7 @@ function Root(props: IProps): React.ReactElement {
const { statusBarRef } = useVimEditor({
editor: editorRef.current,
vim: options.vim,
vim: currentScript !== null ? currentScript.vimMode : props.vim,
onSave: save,
onOpenNextTab,
onOpenPreviousTab,
@@ -423,7 +424,7 @@ function Root(props: IProps): React.ReactElement {
// Called every time script editor is opened
export function ScriptEditorRoot(props: IProps) {
return (
<ScriptEditorContextProvider vim={props.vim}>
<ScriptEditorContextProvider>
<Root {...props} />
</ScriptEditorContextProvider>
);