2018-02-13 21:00:54 +03:00
|
|
|
{{#koenig-card
|
2018-04-25 12:11:48 +03:00
|
|
|
icon="koenig/card-indicator-markdown"
|
2018-04-20 17:43:20 +03:00
|
|
|
class=(concat (kg-style "container-card") " koenig-card-markdown-rendered")
|
2018-04-03 20:34:01 +03:00
|
|
|
toolbar=toolbar
|
2018-02-13 21:00:54 +03:00
|
|
|
isSelected=isSelected
|
|
|
|
isEditing=isEditing
|
|
|
|
onEnterEdit=(action "enterEditMode")
|
2018-03-15 20:54:15 +03:00
|
|
|
onLeaveEdit=(action "leaveEditMode")
|
2018-02-13 21:00:54 +03:00
|
|
|
selectCard=(action selectCard)
|
|
|
|
editCard=(action editCard)
|
|
|
|
}}
|
|
|
|
{{#if isEditing}}
|
2018-04-19 16:33:51 +03:00
|
|
|
{{#gh-editor as |editor|}}
|
2018-04-24 15:10:20 +03:00
|
|
|
{{gh-scroll-trigger
|
|
|
|
triggerOffset=(hash bottom=bottomOffset)
|
|
|
|
enter=(action "topEntered")
|
|
|
|
exit=(action "topExited")
|
|
|
|
registerElement=(action "registerTop")
|
|
|
|
}}
|
|
|
|
|
2018-04-19 16:33:51 +03:00
|
|
|
{{#gh-markdown-editor
|
|
|
|
markdown=(readonly payload.markdown)
|
|
|
|
onChange=(action "updateMarkdown")
|
|
|
|
enableSideBySide=false
|
|
|
|
enablePreview=false
|
|
|
|
enableHemingway=false
|
|
|
|
options=(hash status=false)
|
|
|
|
uploadedImageUrls=editor.uploadedImageUrls
|
|
|
|
onImageFilesSelected=(action editor.uploadImages)
|
|
|
|
imageMimeTypes=editor.imageMimeTypes
|
|
|
|
as |markdown|
|
|
|
|
}}
|
|
|
|
{{markdown.editor}}
|
|
|
|
{{/gh-markdown-editor}}
|
|
|
|
|
2018-04-24 15:10:20 +03:00
|
|
|
{{gh-scroll-trigger
|
|
|
|
enter=(action "bottomEntered")
|
|
|
|
exit=(action "bottomExited")
|
|
|
|
registerElement=(action "registerBottom")
|
|
|
|
}}
|
|
|
|
|
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}}
|
|
|
|
{{#gh-uploader
|
|
|
|
files=editor.droppedFiles
|
|
|
|
accept=editor.imageMimeTypes
|
|
|
|
extensions=editor.imageExtensions
|
|
|
|
onComplete=(action editor.uploadComplete)
|
|
|
|
onCancel=(action editor.uploadCancelled)
|
|
|
|
as |upload|
|
|
|
|
}}
|
|
|
|
<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}}
|
|
|
|
|
|
|
|
<h3>Uploading {{pluralize upload.files.length "image"}}...</h3>
|
|
|
|
{{upload.progressBar}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/gh-uploader}}
|
|
|
|
{{/if}}
|
|
|
|
{{/gh-editor}}
|
2018-02-13 21:00:54 +03:00
|
|
|
{{else}}
|
|
|
|
{{renderedMarkdown}}
|
|
|
|
{{/if}}
|
|
|
|
{{/koenig-card}}
|