Skip to content

Commit

Permalink
Refactor image file handling and update SummerNote configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Dec 15, 2023
1 parent c75fcd4 commit 11404be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/UseCase/Post/Update/UpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ public function run(string $slug = null): string|Response
return $this->controller->redirect(['post/index']);
}

$imageFile = file_exists(Yii::getAlias('@uploads') . '/' . $post->image_file)
? '/uploads' . '/' . $post->image_file : '';
$imageFile = match($post->image_file !== null && $post->image_file !== '') {
true => '/uploads' . '/' . $post->image_file,
default => '',
};

return $this->controller->render(
'_form',
Expand Down
3 changes: 2 additions & 1 deletion src/UseCase/Post/view/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@

$configSummerNote = [
'config' => [
'blockTags' => ['blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
'focus' => true,
'height' => 200,
'lineHeights' => ['0.2', '0.3', '0.4', '0.5', '0.6', '0.8', '1.0', '1.2', '1.4', '1.5', '2.0', '3.0'],
'maxHeight' => null,
'minHeight' => null,
'placeholder' => 'Write here...',
'toolbar' => [
['style', ['style']],
['style', ['block', 'inline']],
['font', ['bold', 'underline', 'clear', 'strikethrough', 'superscript', 'subscript']],
['fontsize', ['fontsize']],
['fontname', ['fontname']],
Expand Down

0 comments on commit 11404be

Please sign in to comment.