File tree Expand file tree Collapse file tree 4 files changed +46
-5
lines changed
app/src/app/overmind/namespaces/editor
codesandbox-api/src/actions Expand file tree Collapse file tree 4 files changed +46
-5
lines changed Original file line number Diff line number Diff line change @@ -743,6 +743,24 @@ export const previewActionReceived: Action<any> = (
743743 } ) ;
744744 break ;
745745 }
746+
747+ case 'source.module.set-code' : {
748+ const sandbox = state . editor . currentSandbox ;
749+ const module = effects . utils . resolveModule (
750+ action . path . replace ( / ^ \/ / , '' ) ,
751+ sandbox . modules ,
752+ sandbox . directories
753+ ) ;
754+
755+ if ( module ) {
756+ actions . editor . codeChanged ( {
757+ moduleShortid : module . shortid ,
758+ code : action . code ,
759+ } ) ;
760+ effects . vscode . setModuleCode ( module ) ;
761+ }
762+ break ;
763+ }
746764 }
747765} ;
748766
Original file line number Diff line number Diff line change 1- import { Action } from './ ' ;
1+ import { Action } from '.' ;
22
33export interface GlyphOptions {
44 line : number ;
Original file line number Diff line number Diff line change 1- import { Action } from '../ ' ;
1+ import { Action } from '..' ;
22
3- export function add ( dependencyName : string ) {
3+ export interface AddDependencyAction extends Action {
4+ dependency : string ;
5+ }
6+
7+ export function add ( dependencyName : string ) : AddDependencyAction {
48 return {
59 type : 'action' ,
610 action : 'source.dependencies.add' ,
Original file line number Diff line number Diff line change 1- import { Action } from '../ ' ;
1+ import { Action } from '..' ;
22
3- export function rename ( path : string , title : string ) {
3+ export interface ModuleRenameAction extends Action {
4+ path : string ;
5+ title : string ;
6+ }
7+
8+ export interface ModuleSetCode extends Action {
9+ path : string ;
10+ code : string ;
11+ }
12+
13+ export function rename ( path : string , title : string ) : ModuleRenameAction {
414 return {
515 type : 'action' ,
616 action : 'source.module.rename' ,
717 path,
818 title,
919 } ;
1020}
21+
22+ export function setCode ( path : string , code : string ) : ModuleSetCode {
23+ return {
24+ type : 'action' ,
25+ action : 'source.module.set-code' ,
26+ path,
27+ code,
28+ } ;
29+ }
You can’t perform that action at this time.
0 commit comments