Skip to content

Commit eb44ed5

Browse files
authored
Fix ReadOnly scenario for classroom mode (codesandbox#3332)
* Fix ReadOnly scenario for classroom mode * Add condition
1 parent e39c793 commit eb44ed5

File tree

1 file changed

+11
-0
lines changed
  • packages/app/src/app/overmind/effects/vscode

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ export class VSCodeEffect {
157157
]).then(() => this.loadEditor(window.monaco, container));
158158
});
159159

160+
options.reaction(
161+
state =>
162+
!state.live.isLive ||
163+
state.live.roomInfo?.mode === 'open' ||
164+
(state.live.roomInfo?.mode === 'classroom' &&
165+
state.live.isCurrentEditor),
166+
canEdit => {
167+
this.setReadOnly(!canEdit);
168+
}
169+
);
170+
160171
return this.initialized;
161172
}
162173

0 commit comments

Comments
 (0)