File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 66use A17 \Twill \Services \Blocks \BlockCollection ;
77use A17 \Twill \Services \Forms \InlineRepeater ;
88use A17 \Twill \View \Components \Blocks \TwillBlockComponent ;
9+ use Illuminate \Support \Arr ;
910use Illuminate \Support \Collection ;
1011use Illuminate \Support \Facades \File ;
1112use Illuminate \Support \Facades \Storage ;
@@ -307,7 +308,7 @@ public function readBlocksFromDirectory(
307308 /**
308309 * Gets all the crop configs, also those of component blocks.
309310 */
310- public function getAllCropConfigs (): array
311+ public function getAllCropConfigs ($ prefixKey = false ): array
311312 {
312313 if (! $ this ->cropConfigs ) {
313314 $ this ->cropConfigs = config ()->get ('twill.block_editor.crops ' );
@@ -325,6 +326,10 @@ public function getAllCropConfigs(): array
325326 }
326327 }
327328
329+ if ($ prefixKey ) {
330+ return Arr::prependKeysWith ($ this ->cropConfigs , 'block_ ' );
331+ }
332+
328333 return $ this ->cropConfigs ;
329334 }
330335}
Original file line number Diff line number Diff line change 205205 window['{{ config (' twill.js_namespace' ) } } '].STORE.parents = {!! json_encode ($parents ?? []) ! !}
206206
207207 @if (isset ($item ) && classHasTrait ($item , \A17 \Twill \Models \Behaviors \HasMedias:: class ) )
208- window['{{ config (' twill.js_namespace' ) } } '].STORE.medias.crops = {!! json_encode (($item -> getMediasParams ()) + \A17 \Twill \Facades \TwillBlocks:: getAllCropConfigs () + (config (' twill.settings.crops' ) ?? [])) ! !}
208+ window['{{ config (' twill.js_namespace' ) } } '].STORE.medias.crops = {!! json_encode (($item -> getMediasParams ()) + \A17 \Twill \Facades \TwillBlocks:: getAllCropConfigs (true ) + (config (' twill.settings.crops' ) ?? [])) ! !}
209209 @else
210- window['{{ config (' twill.js_namespace' ) } } '].STORE.medias.crops = {!! json_encode (\A17 \Twill \Facades \TwillBlocks:: getAllCropConfigs () + (config (' twill.settings.crops' ) ?? [])) ! !}
210+ window['{{ config (' twill.js_namespace' ) } } '].STORE.medias.crops = {!! json_encode (\A17 \Twill \Facades \TwillBlocks:: getAllCropConfigs (true ) + (config (' twill.settings.crops' ) ?? [])) ! !}
211211 @endif
212212 window['{{ config (' twill.js_namespace' ) } } '].STORE.medias.selected = {}
213213
Original file line number Diff line number Diff line change 33 type =" a17-mediafield-translated"
44 :attributes =" {
55 label: '{{ $label } } ',
6- cropContext: '{{ $name } } ',
6+ cropContext: '{{ ! $renderForBlocks ? $name : ' block_ ' . $name } } ',
77 max: {{ $max } } ,
88 widthMin: {{ $widthMin } } ,
99 heightMin: {{ $heightMin } } ,
3838 <a17-inputframe @if ($renderForBlocks ) :fixed-error-key =" $parent.blockFieldName !== undefined ? $parent.blockFieldName('{{ $name } } ') : ''" @endif label =" {{ $label } }" name =" medias.{{ $name } }" @if ($required ) :required =" true" @endif @if ($fieldNote ) note =" {{ $fieldNote } }" @endif >
3939 @if ($multiple ) <a17-slideshow @else <a17-mediafield @endif
4040 {!! $formFieldName () ! !}
41- crop-context =" {{ $name } }"
41+ crop-context =" {{ ! $renderForBlocks ? $name : ' block_ ' . $name } }"
4242 :width-min =" {{ $widthMin } }"
4343 :height-min =" {{ $heightMin } }"
4444 @if ($multiple ) :max =" {{ $max } }" @endif
You can’t perform that action at this time.
0 commit comments