Fix EditorData cache
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
b2e85211a7
commit
96cf0b7dd5
|
@ -51,6 +51,7 @@ class FormResource extends JsonResource
|
||||||
'has_nami_field' => $this->getFields()->hasNamiField(),
|
'has_nami_field' => $this->getFields()->hasNamiField(),
|
||||||
'export' => $this->export,
|
'export' => $this->export,
|
||||||
'needs_prevention' => $this->needs_prevention,
|
'needs_prevention' => $this->needs_prevention,
|
||||||
|
'prevention_text' => $this->prevention_text,
|
||||||
'links' => [
|
'links' => [
|
||||||
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
||||||
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
||||||
|
|
|
@ -18,7 +18,7 @@ class EditorData extends Data implements Editorable
|
||||||
public function placeholder(string $search, string $replacement): self
|
public function placeholder(string $search, string $replacement): self
|
||||||
{
|
{
|
||||||
$replacedBlocks = str(json_encode($this->blocks))->replace('{' . $search . '}', $replacement);
|
$replacedBlocks = str(json_encode($this->blocks))->replace('{' . $search . '}', $replacement);
|
||||||
$this->blocks = json_decode($replacedBlocks);
|
$this->blocks = json_decode($replacedBlocks, true);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,15 @@ class EditorData extends Data implements Editorable
|
||||||
|
|
||||||
public function append(Editorable $editorable): self
|
public function append(Editorable $editorable): self
|
||||||
{
|
{
|
||||||
$this->blocks = array_merge($this->blocks, $editorable->toEditorData()->blocks);
|
return self::from([
|
||||||
|
...$this->toArray(),
|
||||||
return $this;
|
'blocks' => array_merge($this->blocks, $editorable->toEditorData()->blocks),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function replaceWithList(string $blockContent, array $replacements): self
|
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') {
|
if (data_get($block, 'type') !== 'paragraph') {
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
@ -71,8 +72,10 @@ class EditorData extends Data implements Editorable
|
||||||
return $block;
|
return $block;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
|
return self::from([
|
||||||
return $this;
|
...$this->toArray(),
|
||||||
|
'blocks' => $blocks,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toEditorData(): EditorData
|
public function toEditorData(): EditorData
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
<f-text id="name" v-model="single.name" class="grow" label="Name" required></f-text>
|
<f-text id="name" v-model="single.name" class="grow" label="Name" required></f-text>
|
||||||
<f-switch id="is_active" v-model="single.is_active" name="is_active" label="Aktiv"></f-switch>
|
<f-switch id="is_active" v-model="single.is_active" name="is_active" label="Aktiv"></f-switch>
|
||||||
<f-switch id="is_private" v-model="single.is_private" name="is_private" label="Privat"></f-switch>
|
<f-switch id="is_private" v-model="single.is_private" name="is_private" label="Privat"></f-switch>
|
||||||
<f-switch id="needs_prevention" v-model="single.needs_prevention" name="needs_prevention" label="Prävention"></f-switch>
|
|
||||||
</div>
|
</div>
|
||||||
<f-singlefile
|
<f-singlefile
|
||||||
id="header_image"
|
id="header_image"
|
||||||
|
|
Loading…
Reference in New Issue