2018-01-17 16:27:37 +03:00
|
|
|
{{#if post}}
|
|
|
|
{{#gh-editor
|
|
|
|
tagName="section"
|
|
|
|
class="gh-editor gh-view"
|
|
|
|
navIsClosed=navIsClosed
|
|
|
|
as |editor|
|
|
|
|
}}
|
2018-06-04 16:35:36 +03:00
|
|
|
<header class="gh-editor-header br2 pe-none {{editor.headerClass}} {{if infoMessage "bg-white-90"}}">
|
|
|
|
<div class="flex items-center br2 h9 pa2 pl4 pr4 pe-auto {{unless infoMessage "bg-white-90"}}">
|
2018-07-20 17:53:21 +03:00
|
|
|
<div class="flex items-baseline">
|
2018-07-24 15:11:17 +03:00
|
|
|
<span class="fw4 darkgrey-l2">
|
2018-07-20 17:53:21 +03:00
|
|
|
{{gh-editor-post-status
|
|
|
|
post=post
|
|
|
|
isSaving=(or autosave.isRunning saveTasks.isRunning)
|
|
|
|
}}
|
|
|
|
</span>
|
2018-05-15 15:47:50 +03:00
|
|
|
</div>
|
|
|
|
{{#gh-scheduled-post-countdown post=post as |post countdown|}}
|
|
|
|
<time datetime="{{post.publishedAtUTC}}" class="green f8 nudge-bottom--1 ml3" data-test-schedule-countdown>
|
|
|
|
Post will go live {{countdown}}.
|
|
|
|
</time>
|
|
|
|
{{/gh-scheduled-post-countdown}}
|
2018-01-17 16:27:37 +03:00
|
|
|
</div>
|
2018-05-15 15:47:50 +03:00
|
|
|
|
|
|
|
{{#if infoMessage}}
|
2018-05-24 15:33:26 +03:00
|
|
|
<div class="gh-koenig-info miw88 flex flex-auto justify-center" style="pointer-events: auto">
|
2018-05-15 15:47:50 +03:00
|
|
|
<div class="midgrey inline-flex tracked-1 center pa1 pl4 pr4 br3 justify-center items-start {{if (eq editor.headerClass "gh-editor-header-small") "bg-white-90"}}">
|
|
|
|
{{svg-jar "idea" class="w7 h7 fill-blue"}}
|
|
|
|
<p class="ma0 pa0 ml1 nudge-top--2">
|
|
|
|
{{infoMessage}}
|
|
|
|
<button type="button" class="blue fw5" {{action (mut infoMessage "")}}>Got it</button>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
|
2018-05-24 15:33:26 +03:00
|
|
|
<section class="view-actions br2 {{unless infoMessage "bg-white-90"}}" style="pointer-events: auto">
|
2018-01-17 16:27:37 +03:00
|
|
|
{{#unless post.isNew}}
|
2018-02-07 12:42:46 +03:00
|
|
|
{{#if session.user.isContributor}}
|
|
|
|
{{gh-task-button "Save"
|
|
|
|
task=save
|
|
|
|
runningText="Saving"
|
|
|
|
class="gh-btn gh-btn-blue gh-btn-icon contributor-save-button"
|
|
|
|
data-test-contributor-save=true}}
|
|
|
|
{{else}}
|
|
|
|
{{gh-publishmenu
|
|
|
|
post=post
|
2018-03-27 20:06:55 +03:00
|
|
|
postStatus=post.status
|
2018-02-07 12:42:46 +03:00
|
|
|
saveTask=save
|
|
|
|
setSaveType=(action "setSaveType")
|
|
|
|
onOpen=(action "cancelAutosave")}}
|
|
|
|
{{/if}}
|
2018-01-17 16:27:37 +03:00
|
|
|
{{/unless}}
|
|
|
|
|
|
|
|
<button type="button" class="post-settings" title="Settings" {{action "openSettingsMenu" target=ui}} data-test-psm-trigger>
|
2018-03-19 12:57:31 +03:00
|
|
|
{{svg-jar "settings"}}
|
2018-01-17 16:27:37 +03:00
|
|
|
</button>
|
|
|
|
</section>
|
|
|
|
</header>
|
|
|
|
|
2018-01-18 18:36:01 +03:00
|
|
|
{{#if useKoenig}}
|
2018-01-30 13:01:07 +03:00
|
|
|
{{!--
|
|
|
|
gh-koenig-editor acts as a wrapper around the title input and
|
|
|
|
koenig editor canvas to support Ghost-specific editor behaviour
|
|
|
|
--}}
|
|
|
|
{{gh-koenig-editor
|
|
|
|
title=(readonly post.titleScratch)
|
|
|
|
titlePlaceholder="Story Title"
|
|
|
|
onTitleChange=(action "updateTitleScratch")
|
|
|
|
onTitleBlur=(action (perform saveTitle))
|
|
|
|
body=(readonly post.scratch)
|
|
|
|
bodyPlaceholder="Begin writing your story..."
|
|
|
|
bodyAutofocus=shouldFocusEditor
|
|
|
|
onBodyChange=(action "updateScratch")
|
2018-05-01 17:55:51 +03:00
|
|
|
headerOffset=editor.headerHeight
|
2018-05-24 15:30:50 +03:00
|
|
|
scrollContainerSelector=".gh-koenig-editor"
|
|
|
|
scrollOffsetTopSelector=".gh-editor-header-small"
|
|
|
|
scrollOffsetBottomSelector=".gh-mobile-nav-bar"
|
2018-06-14 18:55:02 +03:00
|
|
|
onEditorCreated=(action "setKoenigEditor")
|
2018-07-20 17:53:21 +03:00
|
|
|
onWordCountChange=(action "updateWordCount")
|
2018-01-30 13:01:07 +03:00
|
|
|
}}
|
2018-01-17 16:27:37 +03:00
|
|
|
|
2018-01-18 18:36:01 +03:00
|
|
|
{{else}}
|
|
|
|
|
|
|
|
{{!--
|
|
|
|
NOTE: title is part of the markdown editor container so that it has
|
|
|
|
access to the markdown editor's "focus" action
|
|
|
|
--}}
|
|
|
|
{{#gh-markdown-editor
|
|
|
|
tabindex="2"
|
|
|
|
placeholder="Begin writing your story..."
|
|
|
|
autofocus=shouldFocusEditor
|
|
|
|
uploadedImageUrls=editor.uploadedImageUrls
|
2018-04-18 17:52:45 +03:00
|
|
|
markdown=(readonly markdown)
|
2018-01-18 18:36:01 +03:00
|
|
|
isFullScreen=editor.isFullScreen
|
2018-04-18 17:52:45 +03:00
|
|
|
onChange=(action "updateMarkdown")
|
2018-01-18 18:36:01 +03:00
|
|
|
onFullScreenToggle=(action editor.toggleFullScreen)
|
|
|
|
onPreviewToggle=(action editor.togglePreview)
|
|
|
|
onSplitScreenToggle=(action editor.toggleSplitScreen)
|
|
|
|
onImageFilesSelected=(action editor.uploadImages)
|
|
|
|
imageMimeTypes=editor.imageMimeTypes
|
|
|
|
as |markdown|
|
2018-01-17 16:27:37 +03:00
|
|
|
}}
|
2018-01-18 18:36:01 +03:00
|
|
|
<div class="gh-markdown-editor-pane">
|
2018-02-28 14:44:03 +03:00
|
|
|
{{gh-textarea
|
2018-01-18 18:36:01 +03:00
|
|
|
class="gh-editor-title"
|
|
|
|
placeholder="Post Title"
|
|
|
|
tabindex="1"
|
|
|
|
autoExpand=".gh-markdown-editor-pane"
|
2018-02-28 14:44:03 +03:00
|
|
|
value=(readonly post.titleScratch)
|
|
|
|
input=(action "updateTitleScratch" value="target.value")
|
|
|
|
focus-out=(action (perform saveTitle))
|
2018-01-18 18:36:01 +03:00
|
|
|
keyEvents=(hash
|
2018-02-28 14:44:03 +03:00
|
|
|
Tab=(action markdown.focus 'bottom')
|
|
|
|
Enter=(action markdown.focus 'top')
|
2018-01-18 18:36:01 +03:00
|
|
|
)
|
|
|
|
data-test-editor-title-input=true
|
|
|
|
}}
|
|
|
|
{{markdown.editor}}
|
|
|
|
</div>
|
2018-01-17 16:27:37 +03:00
|
|
|
|
2018-01-18 18:36:01 +03:00
|
|
|
{{#if markdown.isSplitScreen}}
|
|
|
|
<div class="gh-markdown-editor-preview">
|
|
|
|
<h1 class="gh-markdown-editor-preview-title">{{post.titleScratch}}</h1>
|
|
|
|
<div class="gh-markdown-editor-preview-content"></div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2018-01-17 16:27:37 +03:00
|
|
|
|
2018-01-18 18:36:01 +03:00
|
|
|
{{gh-tour-item "using-the-editor"
|
|
|
|
target=".gh-editor-footer"
|
|
|
|
throbberAttachment="top left"
|
|
|
|
throbberOffset="0 20%"
|
|
|
|
popoverTriangleClass="bottom"
|
|
|
|
}}
|
|
|
|
{{/gh-markdown-editor}}
|
|
|
|
|
|
|
|
{{!-- TODO: put tool/status bar in here so that scroll area can be fixed --}}
|
|
|
|
<footer class="gh-editor-footer"></footer>
|
|
|
|
|
|
|
|
{{!-- 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>
|
2018-01-17 16:27:37 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-18 18:36:01 +03:00
|
|
|
{{/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}}>
|
2018-03-19 12:57:31 +03:00
|
|
|
<span>{{svg-jar "close"}} Close</span>
|
2018-01-18 18:36:01 +03:00
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
|
|
|
|
<h3>Uploading {{pluralize upload.files.length "image"}}...</h3>
|
|
|
|
{{upload.progressBar}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/gh-uploader}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{/if}} {{!-- end Koenig conditional --}}
|
2018-07-23 14:19:45 +03:00
|
|
|
|
2018-07-24 15:11:17 +03:00
|
|
|
{{#if wordCount}}
|
|
|
|
<div class="absolute flex items-center br3 bg-white-90 {{if editor.headerClass "right-4 bottom-2 h7 pa1 pl2 pr2" "right-6 bottom-6 h9 pa1 pl4 pr4"}}">
|
|
|
|
<span class="midgrey {{if editor.headerClass "f-supersmall" "f8"}}">
|
|
|
|
{{pluralize wordCount.wordCount "word"}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2018-01-17 16:27:37 +03:00
|
|
|
{{/gh-editor}}
|
|
|
|
|
|
|
|
{{#if showDeletePostModal}}
|
|
|
|
{{gh-fullscreen-modal "delete-post"
|
|
|
|
model=(hash post=post onSuccess=(route-action 'redirectToContentScreen'))
|
|
|
|
close=(action "toggleDeletePostModal")
|
|
|
|
modifier="action wide"}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if showLeaveEditorModal}}
|
|
|
|
{{gh-fullscreen-modal "leave-editor"
|
|
|
|
confirm=(action "leaveEditor")
|
|
|
|
close=(action "toggleLeaveEditorModal")
|
|
|
|
modifier="action wide"}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if showReAuthenticateModal}}
|
|
|
|
{{gh-fullscreen-modal "re-authenticate"
|
|
|
|
close=(action "toggleReAuthenticateModal")
|
|
|
|
modifier="action wide"}}
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#liquid-wormhole}}
|
|
|
|
{{gh-post-settings-menu
|
|
|
|
post=post
|
|
|
|
showSettingsMenu=ui.showSettingsMenu
|
|
|
|
deletePost=(action "toggleDeletePostModal")
|
|
|
|
updateSlug=updateSlug
|
|
|
|
savePost=savePost
|
|
|
|
}}
|
|
|
|
{{/liquid-wormhole}}
|
|
|
|
{{/if}}
|
|
|
|
|
2018-05-24 15:30:50 +03:00
|
|
|
{{outlet}}
|