mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
feat: Add support for toggling readonly mode. (#8750)
* feat: Add methods for toggling and inspecting the readonly state of a workspace. * refactor: Use the new readonly setters/getters in place of checking the injection options. * fix: Fix bug that allowed dragging blocks from a flyout onto a readonly workspace. * feat: Toggle a `blocklyReadOnly` class when readonly status is changed. * chore: Placate the linter. * chore: Placate the compiler.
This commit is contained in:
@@ -144,7 +144,7 @@ export class WorkspaceComment {
|
||||
* workspace is read-only.
|
||||
*/
|
||||
isEditable(): boolean {
|
||||
return this.isOwnEditable() && !this.workspace.options.readOnly;
|
||||
return this.isOwnEditable() && !this.workspace.isReadOnly();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ export class WorkspaceComment {
|
||||
* workspace is read-only.
|
||||
*/
|
||||
isMovable() {
|
||||
return this.isOwnMovable() && !this.workspace.options.readOnly;
|
||||
return this.isOwnMovable() && !this.workspace.isReadOnly();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ export class WorkspaceComment {
|
||||
return (
|
||||
this.isOwnDeletable() &&
|
||||
!this.isDeadOrDying() &&
|
||||
!this.workspace.options.readOnly
|
||||
!this.workspace.isReadOnly()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user