diff --git a/app/Form/Resources/FormResource.php b/app/Form/Resources/FormResource.php
index 818d36b2..69437e42 100644
--- a/app/Form/Resources/FormResource.php
+++ b/app/Form/Resources/FormResource.php
@@ -51,6 +51,7 @@ class FormResource extends JsonResource
'has_nami_field' => $this->getFields()->hasNamiField(),
'export' => $this->export,
'needs_prevention' => $this->needs_prevention,
+ 'prevention_text' => $this->prevention_text,
'links' => [
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
diff --git a/app/Lib/Editor/EditorData.php b/app/Lib/Editor/EditorData.php
index 7794eb31..094b3fb7 100644
--- a/app/Lib/Editor/EditorData.php
+++ b/app/Lib/Editor/EditorData.php
@@ -18,7 +18,7 @@ class EditorData extends Data implements Editorable
public function placeholder(string $search, string $replacement): self
{
$replacedBlocks = str(json_encode($this->blocks))->replace('{' . $search . '}', $replacement);
- $this->blocks = json_decode($replacedBlocks);
+ $this->blocks = json_decode($replacedBlocks, true);
return $this;
}
@@ -42,14 +42,15 @@ class EditorData extends Data implements Editorable
public function append(Editorable $editorable): self
{
- $this->blocks = array_merge($this->blocks, $editorable->toEditorData()->blocks);
-
- return $this;
+ return self::from([
+ ...$this->toArray(),
+ 'blocks' => array_merge($this->blocks, $editorable->toEditorData()->blocks),
+ ]);
}
public function replaceWithList(string $blockContent, array $replacements): self
{
- $this->blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) {
+ $blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) {
if (data_get($block, 'type') !== 'paragraph') {
return $block;
}
@@ -71,8 +72,10 @@ class EditorData extends Data implements Editorable
return $block;
})->toArray();
-
- return $this;
+ return self::from([
+ ...$this->toArray(),
+ 'blocks' => $blocks,
+ ]);
}
public function toEditorData(): EditorData
diff --git a/resources/js/views/form/Index.vue b/resources/js/views/form/Index.vue
index 45160c0e..01f147f6 100644
--- a/resources/js/views/form/Index.vue
+++ b/resources/js/views/form/Index.vue
@@ -43,7 +43,6 @@
-