2020-01-16 18:14:03 +03:00
|
|
|
<KoenigCard
|
|
|
|
@icon="koenig/card-indicator-markdown"
|
|
|
|
@class={{concat (kg-style "container-card") " koenig-card-markdown-rendered"}}
|
|
|
|
@headerOffset={{this.headerOffset}}
|
|
|
|
@toolbar={{this.toolbar}}
|
|
|
|
@payload={{this.payload}}
|
|
|
|
@isSelected={{this.isSelected}}
|
|
|
|
@isEditing={{this.isEditing}}
|
|
|
|
@onEnterEdit={{action "enterEditMode"}}
|
|
|
|
@onLeaveEdit={{action "leaveEditMode"}}
|
|
|
|
@selectCard={{action this.selectCard}}
|
|
|
|
@deselectCard={{action this.deselectCard}}
|
|
|
|
@editCard={{action this.editCard}}
|
|
|
|
@saveCard={{action this.saveCard}}
|
2020-10-21 14:16:04 +03:00
|
|
|
@saveAsSnippet={{this.saveAsSnippet}}
|
2020-01-16 18:14:03 +03:00
|
|
|
@editor={{this.editor}}
|
|
|
|
>
|
|
|
|
{{#if this.isEditing}}
|
|
|
|
<GhEditor as |editor|>
|
|
|
|
<GhScrollTrigger
|
|
|
|
@triggerOffset={{hash bottom=this.bottomOffset}}
|
|
|
|
@enter={{action "topEntered"}}
|
|
|
|
@exit={{action "topExited"}}
|
|
|
|
@registerElement={{action "registerTop"}}
|
|
|
|
/>
|
2018-04-24 15:10:20 +03:00
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhMarkdownEditor
|
|
|
|
@markdown={{readonly this.payload.markdown}}
|
|
|
|
@onChange={{action "updateMarkdown"}}
|
|
|
|
@autofocus={{true}}
|
|
|
|
@enableSideBySide={{false}}
|
|
|
|
@enablePreview={{false}}
|
|
|
|
@enableHemingway={{false}}
|
|
|
|
@options={{hash status=false}}
|
|
|
|
@uploadedImageUrls={{editor.uploadedImageUrls}}
|
|
|
|
@onImageFilesSelected={{action editor.uploadImages}}
|
|
|
|
@imageMimeTypes={{editor.imageMimeTypes}}
|
2018-04-19 16:33:51 +03:00
|
|
|
as |markdown|
|
2020-01-16 18:14:03 +03:00
|
|
|
>
|
2018-04-19 16:33:51 +03:00
|
|
|
{{markdown.editor}}
|
2020-01-16 18:14:03 +03:00
|
|
|
</GhMarkdownEditor>
|
2018-04-19 16:33:51 +03:00
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhScrollTrigger
|
|
|
|
@enter={{action "bottomEntered"}}
|
|
|
|
@exit={{action "bottomExited"}}
|
|
|
|
@registerElement={{action "registerBottom"}}
|
|
|
|
/>
|
2018-04-24 15:10:20 +03:00
|
|
|
|
2018-04-19 16:33:51 +03:00
|
|
|
{{!-- files are dragged over editor pane --}}
|
|
|
|
{{#if editor.isDraggedOver}}
|
|
|
|
<div class="drop-target gh-editor-drop-target">
|
|
|
|
<div class="drop-target-message">
|
|
|
|
<h3>Drop image(s) here to upload</h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{!-- files have been dropped ready to be uploaded --}}
|
|
|
|
{{#if editor.droppedFiles}}
|
2020-01-16 18:14:03 +03:00
|
|
|
<GhUploader
|
|
|
|
@files={{editor.droppedFiles}}
|
|
|
|
@accept={{editor.imageMimeTypes}}
|
|
|
|
@extensions={{editor.imageExtensions}}
|
|
|
|
@onComplete={{action editor.uploadComplete}}
|
|
|
|
@onCancel={{action editor.uploadCancelled}}
|
2018-04-19 16:33:51 +03:00
|
|
|
as |upload|
|
2020-01-16 18:14:03 +03:00
|
|
|
>
|
2018-04-19 16:33:51 +03:00
|
|
|
<div class="gh-editor-image-upload {{if upload.errors "-error"}}">
|
|
|
|
<div class="gh-editor-image-upload-content">
|
|
|
|
{{#if upload.errors}}
|
|
|
|
<h3>Upload failed</h3>
|
|
|
|
|
|
|
|
{{#each upload.errors as |error|}}
|
|
|
|
<div class="failed">{{error.fileName}} - {{error.message}}</div>
|
|
|
|
{{/each}}
|
|
|
|
|
|
|
|
<button class="gh-btn gh-btn-grey gh-btn-icon" {{action upload.cancel}}>
|
|
|
|
<span>{{svg-jar "close"}} Close</span>
|
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
|
2020-08-10 13:16:03 +03:00
|
|
|
<h3>Uploading {{gh-pluralize upload.files.length "image"}}...</h3>
|
2018-04-19 16:33:51 +03:00
|
|
|
{{upload.progressBar}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-16 18:14:03 +03:00
|
|
|
</GhUploader>
|
2018-04-19 16:33:51 +03:00
|
|
|
{{/if}}
|
2020-01-16 18:14:03 +03:00
|
|
|
</GhEditor>
|
2018-07-18 16:34:11 +03:00
|
|
|
|
2020-01-16 18:14:03 +03:00
|
|
|
{{#if this.preventClick}}
|
2018-07-18 16:34:11 +03:00
|
|
|
<div class="absolute absolute--fill z-max"></div>
|
|
|
|
{{/if}}
|
2018-02-13 21:00:54 +03:00
|
|
|
{{else}}
|
2020-01-16 18:14:03 +03:00
|
|
|
{{this.renderedMarkdown}}
|
2018-06-20 14:43:51 +03:00
|
|
|
<div class="absolute absolute--fill z-999"></div>
|
2018-02-13 21:00:54 +03:00
|
|
|
{{/if}}
|
2020-01-16 18:14:03 +03:00
|
|
|
</KoenigCard>
|