Ghost/ghost/admin/app/templates/components/gh-editor.hbs
Kevin Ansfield 62553cdf92 Replace jQuery-based uploader.js with ember components
no issue
- adds `gh-image-uploader` that handles image uploads in a fully ember fashion and with no dependency on `uploader.js`
- adds `gh-image-uploader-with-preview` that can fully replace the old `gh-uploader`
- replace uses of `gh-uploader` in PSM & TSM with `gh-image-uploader-with-preview`
- updates the editor preview image handling to use the new `gh-image-uploader-with-preview` component
- updates the image upload modal to use `gh-image-uploader` (utilises the `saveButton=false` flag which means the preview has to be handled externally to avoid auto-replacement when typing a URL)
- removes all old `uploader.js` related code
- adds custom `RequestEntityTooLargeError` and `UnsupportedMediaTypeError` errors to our `ajax` service
2016-04-05 12:03:20 +01:00

51 lines
2.6 KiB
Handlebars

<section class="entry-markdown js-entry-markdown {{if markdownActive 'active'}}">
<header class="floatingheader">
<span class="desktop-tabs"><a class="markdown-help-label" href="" title="Markdown Help" {{action (route-action "toggleMarkdownHelpModal")}}>Markdown</a></span>
<span class="mobile-tabs">
<a href="#" {{action 'selectTab' 'markdown'}} class="{{if markdownActive 'active'}}">Markdown</a>
<a href="#" {{action 'selectTab' 'preview'}} class="{{if previewActive 'active'}}">Preview</a>
</span>
<a class="markdown-help-icon" href="" title="Markdown Help" {{action (route-action "toggleMarkdownHelpModal")}}><i class="icon-markdown"></i></a>
</header>
<section id="entry-markdown-content" class="entry-markdown-content">
{{gh-ed-editor classNames="markdown-editor js-markdown-editor"
tabindex="1"
spellcheck="true"
value=value
setEditor=(action "setEditor")
updateScrollInfo=(action "updateScrollInfo")
toggleCopyHTMLModal=(action "toggleCopyHTMLModal")
onFocusIn=editorFocused
height=height
focus=shouldFocusEditor
readonly=editorDisabled}}
</section>
</section>
<section class="entry-preview js-entry-preview {{if previewActive 'active'}}">
<header class="floatingheader">
<span class="desktop-tabs"><a target="_blank" href="{{previewUrl}}">Preview</a></span>
<span class="mobile-tabs">
<a href="#" {{action 'selectTab' 'markdown'}} class="{{if markdownActive 'active'}}">Markdown</a>
<a href="#" {{action 'selectTab' 'preview'}} class="{{if previewActive 'active'}}">Preview</a>
</span>
<span class="entry-word-count">{{gh-count-words value}}</span>
</header>
<section class="entry-preview-content js-entry-preview-content">
{{gh-ed-preview classNames="rendered-markdown js-rendered-markdown"
markdown=value
scrollPosition=scrollPosition
updateHeight=(action "updateHeight")
uploadStarted=(action "disableEditor")
uploadFinished=(action "enableEditor")
updateImageSrc=(action "handleImgUpload")}}
</section>
</section>
{{#if showCopyHTMLModal}}
{{gh-fullscreen-modal "copy-html"
model=copyHTMLModalContent
close=(action "toggleCopyHTMLModal")
modifier="action"}}
{{/if}}