From 4fe3b29e90d12567a8e854734ec2d3dd9f8e9905 Mon Sep 17 00:00:00 2001 From: sten Date: Thu, 14 Jun 2018 10:41:57 +0200 Subject: [PATCH] fix image-extended copyright text not reloaded and image path broken --- CHANGELOG.md | 5 +++++ resources/js/sir-trevor/blocks/image_extended.js | 2 +- src/Controllers/ImageController.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d75ec15..914f1df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# [1.0.3] 14-06-2018 +## Updated +- Updated extended_image to add a slash before the image path to render the image correctly in javascript. +- Fix copyright bug: the text was not shown in the input after reloading the page. + # [1.0.2] 16-05-2018 ## Updated - Updated README diff --git a/resources/js/sir-trevor/blocks/image_extended.js b/resources/js/sir-trevor/blocks/image_extended.js index acf7213..54c9098 100644 --- a/resources/js/sir-trevor/blocks/image_extended.js +++ b/resources/js/sir-trevor/blocks/image_extended.js @@ -12,7 +12,7 @@ SirTrevor.Blocks.ImageExtended = SirTrevor.Blocks.Image.extend({ loadData: function(data){ $(this.editor).html($('', { src: function () { if (data.image) { return data.image } else { return data.file.url } }})).show(); - $(this.editor).append($('', {type: 'text', class: 'copyright', name: 'text', placeholder: 'Copyright', value: data.copyright})); + $(this.editor).append($('', {type: 'text', class: 'copyright', name: 'copyright', placeholder: 'Copyright', value: data.copyright})); }, onBlockRender: function(){ diff --git a/src/Controllers/ImageController.php b/src/Controllers/ImageController.php index 1843a90..637ecaf 100644 --- a/src/Controllers/ImageController.php +++ b/src/Controllers/ImageController.php @@ -18,7 +18,7 @@ public static function upload(Request $request) $path = $file->store($config['upload_directory']); }; - $publicPath = str_replace('public', 'storage', $path); + $publicPath = '/'.str_replace('public', 'storage', $path); return ['image' => $publicPath]; }