Skip to content

Commit

Permalink
added tiptap editory html text wrapped into tiptap class
Browse files Browse the repository at this point in the history
  • Loading branch information
AravindRam-Ranium committed Jul 1, 2024
1 parent aac15fc commit 014151e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Livewire/ConsentOptionFormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function getFormSchema(): array
foreach($this->user->collections as $consentOption){

$fields = [
Forms\Components\Placeholder::make('text')->label('')->content(new HtmlString($consentOption->text)),
Forms\Components\Placeholder::make('text')->label('')->content($this->tipTapEditorContent($consentOption)),
Forms\Components\Checkbox::make("consents.$consentOption->id")
->label($consentOption->label)
->required($consentOption->is_mandatory)
Expand Down Expand Up @@ -228,4 +228,9 @@ public function submit(): void

$this->redirect(request()->session()->get('url.saved'));
}

public function tipTapEditorContent($consentOption)
{
return new HtmlString('<div class="tiptap-editor"><div class="ProseMirror">'.$consentOption->text.'</div></div>');
}
}
7 changes: 6 additions & 1 deletion src/Livewire/ConsentOptionPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function getFormSchema(): array
$formFields = [Placeholder::make('welcome')->label('')->content(new HtmlString("Hi {$this->user->firstname},<br>Please read these terms and conditions carefully, we will email a copy to {$this->user->email}"))];

$fields = [
Placeholder::make('text')->label('')->content(new HtmlString($consentOption->text)),
Placeholder::make('text')->label('')->content($this->tipTapEditorContent()),
Checkbox::make("consents.$consentOption->id")
->label($consentOption->label)
->required($consentOption->is_mandatory)
Expand Down Expand Up @@ -122,6 +122,11 @@ protected function getFormSchema(): array
return $formFields;
}

public function tipTapEditorContent()
{
return new HtmlString('<div class="tiptap-editor"><div class="ProseMirror">'.$this->consentOption->text.'</div></div>');
}

public function render()
{
return view('user-consent::livewire.consent-option-preview');
Expand Down

0 comments on commit 014151e

Please sign in to comment.