2020-01-16 18:14:03 +03:00
|
|
|
<KoenigCard
|
|
|
|
@tagName="figure"
|
|
|
|
@class={{concat (kg-style "media-card") " " (kg-style "breakout" size="wide") " flex flex-column"}}
|
|
|
|
@isSelected={{this.isSelected}}
|
|
|
|
@isEditing={{this.isEditing}}
|
|
|
|
@selectCard={{action this.selectCard}}
|
|
|
|
@deselectCard={{action this.deselectCard}}
|
|
|
|
@editCard={{action this.editCard}}
|
|
|
|
@toolbar={{this.toolbar}}
|
|
|
|
@hasEditMode={{false}}
|
|
|
|
@addParagraphAfterCard={{this.addParagraphAfterCard}}
|
|
|
|
@moveCursorToPrevSection={{this.moveCursorToPrevSection}}
|
|
|
|
@moveCursorToNextSection={{this.moveCursorToNextSection}}
|
|
|
|
@editor={{this.editor}}
|
|
|
|
@onSelect={{action "didSelect"}}
|
|
|
|
@onDeselect={{action "didDeselect"}}
|
2018-08-29 20:17:49 +03:00
|
|
|
as |card|
|
2020-01-16 18:14:03 +03:00
|
|
|
>
|
|
|
|
<GhUploader
|
|
|
|
@files={{this.files}}
|
|
|
|
@accept={{this.imageMimeTypes}}
|
|
|
|
@extensions={{this.imageExtensions}}
|
|
|
|
@onUploadStart={{action "addImage"}}
|
|
|
|
@onUploadSuccess={{action "setImageSrc"}}
|
|
|
|
@onUploadFailure={{action "uploadFailed"}}
|
|
|
|
@onFailed={{action "handleErrors"}}
|
2018-08-29 20:17:49 +03:00
|
|
|
as |uploader|
|
2020-01-16 18:14:03 +03:00
|
|
|
>
|
|
|
|
<div class="relative{{unless this.images " bg-whitegrey-l2"}}">
|
|
|
|
{{#if this.imageRows}}
|
2018-12-11 13:05:59 +03:00
|
|
|
<div class="flex flex-column" data-gallery>
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#each this.imageRows as |row index|}}
|
2018-12-11 13:05:59 +03:00
|
|
|
<div class="flex flex-row justify-center" data-row="{{index}}">
|
2018-08-29 20:17:49 +03:00
|
|
|
{{#each row as |image|}}
|
2018-12-11 13:05:59 +03:00
|
|
|
<div
|
|
|
|
style={{image.style}}
|
2018-12-11 15:13:15 +03:00
|
|
|
class="relative hide-child {{image.classes}}"
|
2018-12-11 13:05:59 +03:00
|
|
|
data-image
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
src={{or image.previewSrc image.src}}
|
|
|
|
width={{image.width}}
|
|
|
|
height={{image.height}}
|
|
|
|
class="w-100 h-100 db pe-none"
|
|
|
|
>
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#unless this.koenigDragDropHandler.isDragging}}
|
2018-12-11 15:13:15 +03:00
|
|
|
<div class="bg-image-overlay-top child pe-none {{image.overlayClasses}}">
|
2018-12-11 13:05:59 +03:00
|
|
|
<div class="flex flex-row-reverse">
|
|
|
|
<button class="bg-white-90 pl3 pr3 br3 pe-auto" {{action "deleteImage" image}}>
|
|
|
|
{{svg-jar "koenig/kg-trash" class="fill-darkgrey w4 h4"}}
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-08-29 20:17:49 +03:00
|
|
|
</div>
|
2018-12-11 13:05:59 +03:00
|
|
|
{{/unless}}
|
2018-08-29 20:17:49 +03:00
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#if (or uploader.isUploading (is-empty this.imageRows))}}
|
|
|
|
<div class="relative miw-100 flex items-center {{if (is-empty this.imageRows) "kg-media-placeholder ba b--whitegrey" "absolute absolute--fill bg-white-50"}}">
|
|
|
|
{{#if this.isDraggedOver}}
|
2018-08-29 20:17:49 +03:00
|
|
|
<span class="db center sans-serif fw7 f7 middarkgrey">
|
|
|
|
Drop 'em like it's hot 🔥
|
|
|
|
</span>
|
|
|
|
{{else if uploader.isUploading}}
|
|
|
|
{{uploader.progressBar}}
|
2020-01-16 18:14:03 +03:00
|
|
|
{{else if (is-empty this.imageRows)}}
|
2018-08-29 20:17:49 +03:00
|
|
|
<button class="flex flex-column items-center center sans-serif fw4 f7 middarkgrey pa8 pt6 pb6 kg-image-button" onclick={{action "triggerFileDialog"}}>
|
|
|
|
{{svg-jar "gallery-placeholder" class="kg-placeholder-gallery nudge-bottom--10"}}
|
|
|
|
<span class="mt2 midgrey">Click to select up to 9 images</span>
|
|
|
|
</button>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
2020-01-16 18:14:03 +03:00
|
|
|
{{else if this.isDraggedOver}}
|
2018-08-29 20:17:49 +03:00
|
|
|
<div class="absolute absolute--fill flex items-center bg-black-60 pe-none">
|
|
|
|
<span class="db center sans-serif fw7 f7 white">
|
|
|
|
Drop to add up to 9 images
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#if (and this.errorMessage (not this.isDraggedOver))}}
|
2018-08-29 20:17:49 +03:00
|
|
|
<div class="absolute absolute--fill flex items-center bg-black-60">
|
|
|
|
<span class="db center sans-serif fw7 f7 pl2 pr2 bg-red white">
|
2020-01-16 18:14:03 +03:00
|
|
|
{{this.errorMessage}}.
|
2018-08-29 20:17:49 +03:00
|
|
|
<button onclick={{action "clearErrorMessage"}} style="text-decoration: underline !important">
|
|
|
|
Dismiss
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="display:none">
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhFileInput @multiple={{true}} @action={{action "setFiles"}} @accept={{this.imageMimeTypes}} />
|
2018-08-29 20:17:49 +03:00
|
|
|
</div>
|
2020-01-16 18:14:03 +03:00
|
|
|
</GhUploader>
|
2018-08-29 20:17:49 +03:00
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#if (or this.isSelected (clean-basic-html this.payload.caption))}}
|
|
|
|
<card.CaptionInput
|
|
|
|
@caption={{this.payload.caption}}
|
|
|
|
@update={{action "updateCaption"}}
|
|
|
|
@placeholder="Type caption for gallery (optional)"
|
|
|
|
/>
|
2018-08-29 20:17:49 +03:00
|
|
|
{{/if}}
|
2020-01-16 18:14:03 +03:00
|
|
|
</KoenigCard>
|