- Issue created by @d0t101101
- πΊπΈUnited States kevinquillen
One little trick here. We can certainly strip all carriage returns and new lines. But maybe it would be better to add a checkbox saying "Return response in HTML format."
Adding that to the underlying prompt will return HTML formatted text.
Then the snippet becomes:
$body = [ 'value' => str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),"",$body), 'format' => 'basic_html', ];
When doing that, this is the result:
We should also ask the user which text format to use (everyone has something different) and caveat the risk(s).
- πΊπΈUnited States d0t101101
Sounds good to me!
Regarding the "Return response in HTML format." checkbox, I would be curious to see how CKEditor5 behaves on first render/resave with such an option (i.e. does it change the body text in the DB), but that suppose would depend on the text format options each user has setup on their Drupal install under Admin > Configuration > Content Authoring > Text formats and editors.
Thanks again!
- πΊπΈUnited States kevinquillen
That screenshot is showing source mode. It looked fine when I viewed the page. I saved and viewed again, it remained unchanged.
- @kevinquillen opened merge request.
- πΊπΈUnited States kevinquillen
Ok, I think we are good to go here.
If the option is not selected, it wraps the result in a P tag.
-
kevinquillen β
committed f9299755 on 1.0.x
Issue #3342536 by kevinquillen, d0t101101: Content Generator & CKEditor
-
kevinquillen β
committed f9299755 on 1.0.x
- Status changed to Fixed
about 2 years ago 8:57pm 17 February 2023 - πΊπΈUnited States kevinquillen
The core of this issue is fixed, though more things could be done here (we should check if the selected Body field is acutally a formatted longtext or a plain string field, etc).
Automatically closed - issue fixed for 2 weeks with no activity.