Skip to content

Commit

Permalink
fix: isInEditor flag was not set for child blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyvr committed Jan 16, 2025
1 parent 8e2b0ee commit a6460e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Blocks/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public function __construct()

public function renderer($context = 'front-end'): Renderer
{
if ($context === 'editor') {
$this->isInEditor = true;
}

return new Renderer($this, $context);
}

Expand Down
4 changes: 4 additions & 0 deletions src/Blocks/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public function render(): string
? 'class="'.$this->blockClassName().' paver__block paver__sortable-item parent" data-id="'.$this->block->getId().'" data-block="'.htmlspecialchars($this->block->toJson(), ENT_QUOTES, 'UTF-8').'"'
: 'class="'.$this->blockClassName().'"';

if($this->isEditorContext()) {
$this->block->isInEditor = true;
}

$content = '<div '.$attributeString.'>';
$content .= $this->renderToolbar();
$content .= (string) $this->block->render();
Expand Down

0 comments on commit a6460e4

Please sign in to comment.