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:
Aaron Dodson
2025-01-30 13:47:36 -08:00
committed by GitHub
parent c88ebf1ede
commit 343c2f51f3
11 changed files with 54 additions and 21 deletions

View File

@@ -78,7 +78,7 @@ export class BlockDragStrategy implements IDragStrategy {
return (
this.block.isOwnMovable() &&
!this.block.isDeadOrDying() &&
!this.workspace.options.readOnly &&
!this.workspace.isReadOnly() &&
// We never drag blocks in the flyout, only create new blocks that are
// dragged.
!this.block.isInFlyout

View File

@@ -29,7 +29,7 @@ export class CommentDragStrategy implements IDragStrategy {
return (
this.comment.isOwnMovable() &&
!this.comment.isDeadOrDying() &&
!this.workspace.options.readOnly
!this.workspace.isReadOnly()
);
}