File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
packages/app/src/app/overmind/effects/vscode Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -157,16 +157,22 @@ 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- ) ;
160+ // Only set the read only state when the editor is initialized.
161+ this . initialized . then ( ( ) => {
162+ // ReadOnly mode is derivative, it's based on a couple conditions, of which the
163+ // most important one is Live. If you're in a classroom live session as spectator,
164+ // you should not be allowed to edit.
165+ options . reaction (
166+ state =>
167+ ! state . live . isLive ||
168+ state . live . roomInfo ?. mode === 'open' ||
169+ ( state . live . roomInfo ?. mode === 'classroom' &&
170+ state . live . isCurrentEditor ) ,
171+ canEdit => {
172+ this . setReadOnly ( ! canEdit ) ;
173+ }
174+ ) ;
175+ } ) ;
170176
171177 return this . initialized ;
172178 }
You can’t perform that action at this time.
0 commit comments