Skip to content

Commit accaff6

Browse files
fix changing code
1 parent f9bf2fa commit accaff6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ export const internal = internalActions;
1919

2020
export const onNavigateAway: Action = () => {};
2121

22+
export const test: Action<string> = ({ effects }, moduleShortid) => {
23+
effects.vscode.changeCode(moduleShortid, 'hehehe');
24+
};
25+
2226
export const addNpmDependency: AsyncAction<{
2327
name: string;
2428
version?: string;

packages/app/src/app/vscode/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,14 @@ class VSCodeManager {
321321
and server requires a full code update
322322
*/
323323
changeCode(moduleShortid: string, code: string) {
324-
context.monaco.editor.changeCode(code, moduleShortid);
324+
try {
325+
(window as any).CSEditor.editor
326+
.getActiveCodeEditor()
327+
.getModel(moduleShortid)
328+
.setValue(code);
329+
} catch (error) {
330+
console.log();
331+
}
325332
}
326333

327334
/**

0 commit comments

Comments
 (0)