Skip to content

Commit

Permalink
fix(textareafield): allow paste images in textareas
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Dec 30, 2020
1 parent a915517 commit 8b8b244
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions inc/field/textareafield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function getRenderedHtml($canEdit = true): string {
$html = '';
$html .= Html::textarea([
'name' => $fieldName,
'editor_id' => "$fieldName$rand",
'rand' => $rand,
'value' => $value,
'rows' => 5,
Expand All @@ -103,6 +104,15 @@ public function getRenderedHtml($canEdit = true): string {
'enable_fileupload' => false,
'uploads' => $this->uploads,
]);
// The following file upload area is needed to allow embedded pics in the tetarea
$html .= '<div style="display:none;">';
Html::file(['editor_id' => "$fieldName$rand",
'filecontainer' => "filecontainer$rand",
'onlyimages' => true,
'showtitle' => false,
'multiple' => true,
'display' => false]);
$html .= '</div>';
$html .= Html::scriptBlock("$(function() {
pluginFormcreatorInitializeTextarea('$fieldName', '$rand');
});");
Expand Down

0 comments on commit 8b8b244

Please sign in to comment.