mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
f983e93090
closes https://github.com/TryGhost/Product/issues/3449 - added drop handler to the whole editor pane area (to match previous editor) that uses the external API plugin to pass files through to the editor when dropped - allows images/files to be dropped outside of the main editor canvas which is especially helpful when creating images in a new post
81 lines
3.6 KiB
Handlebars
81 lines
3.6 KiB
Handlebars
<div class="gh-koenig-editor relative w-100 vh-100 overflow-x-hidden overflow-y-auto z-0" {{did-insert this.registerElement}} ...attributes>
|
|
{{!-- full height content pane --}}
|
|
{{!-- template-lint-disable no-invalid-interactive no-passed-in-event-handlers --}}
|
|
<div
|
|
class="gh-koenig-editor-pane flex flex-column mih-100"
|
|
{{on "mousedown" this.trackMousedown}}
|
|
{{on "mouseup" this.focusEditor}}
|
|
{{on "dragover" this.editorPaneDragover}}
|
|
{{on "drop" this.editorPaneDrop}}
|
|
>
|
|
<GhEditorFeatureImage
|
|
@image={{@featureImage}}
|
|
@updateImage={{@setFeatureImage}}
|
|
@clearImage={{@clearFeatureImage}}
|
|
@alt={{@featureImageAlt}}
|
|
@updateAlt={{@setFeatureImageAlt}}
|
|
@caption={{@featureImageCaption}}
|
|
@updateCaption={{@setFeatureImageCaption}}
|
|
@forceButtonDisplay={{or (not @title) (eq @title "(Untitled)") this.titleIsHovered this.titleIsFocused}}
|
|
@isHidden={{or (not @cardOptions.post.showTitleAndFeatureImage) false}}
|
|
/>
|
|
|
|
<div class="gh-editor-title-container page-improvements">
|
|
{{#if (and (not @cardOptions.post.showTitleAndFeatureImage) (not @featureImage))}}
|
|
<span class="gh-editor-hidden-indicator" data-tooltip="Post title is hidden on page">
|
|
{{svg-jar "eye-closed"}}
|
|
</span>
|
|
{{/if}}
|
|
|
|
<GhTextarea
|
|
@class="gh-editor-title {{if (and (not @cardOptions.post.showTitleAndFeatureImage) (not this.titleIsFocused)) "faded"}}"
|
|
@placeholder={{@titlePlaceholder}}
|
|
@shouldFocus={{or @titleAutofocus false}}
|
|
@tabindex="1"
|
|
@autoExpand=".gh-koenig-editor"
|
|
@value={{readonly this.title}}
|
|
@input={{this.updateTitle}}
|
|
@focus-out={{optional @onTitleBlur}}
|
|
@keyDown={{this.onTitleKeydown}}
|
|
@didCreateTextarea={{this.registerTitleElement}}
|
|
{{on "focus" (fn (mut this.titleIsFocused) true)}}
|
|
{{on "blur" (fn (mut this.titleIsFocused) false)}}
|
|
{{on "mouseover" (fn (mut this.titleIsHovered) true)}}
|
|
{{on "mouseleave" (fn (mut this.titleIsHovered) false)}}
|
|
{{on "paste" this.cleanPastedTitle}}
|
|
data-test-editor-title-input={{true}}
|
|
/>
|
|
</div>
|
|
|
|
<KoenigLexicalEditor
|
|
@lexical={{@body}}
|
|
@cardConfig={{@cardOptions}}
|
|
@onChange={{@onBodyChange}}
|
|
@registerAPI={{this.registerEditorAPI}}
|
|
@cursorDidExitAtTop={{this.focusTitle}}
|
|
@updateWordCount={{@updateWordCount}}
|
|
/>
|
|
|
|
{{!-- <KoenigEditor
|
|
@mobiledoc={{@body}}
|
|
@placeholder={{@bodyPlaceholder}}
|
|
@spellcheck={{true}}
|
|
@onChange={{@onBodyChange}}
|
|
@didCreateEditor={{this.onEditorCreated}}
|
|
@cursorDidExitAtTop={{this.focusTitle}}
|
|
@headerOffset={{@headerOffset}}
|
|
@dropTargetSelector=".gh-koenig-editor-pane"
|
|
@scrollContainerSelector={{@scrollContainerSelector}}
|
|
@scrollOffsetTopSelector={{@scrollOffsetTopSelector}}
|
|
@scrollOffsetBottomSelector={{@scrollOffsetBottomSelector}}
|
|
@wordCountDidChange={{@onWordCountChange}}
|
|
@snippets={{@snippets}}
|
|
@saveSnippet={{@saveSnippet}}
|
|
@updateSnippet={{@updateSnippet}}
|
|
@deleteSnippet={{@deleteSnippet}}
|
|
@cardOptions={{@cardOptions}}
|
|
@postType={{@postType}}
|
|
/> --}}
|
|
</div>
|
|
</div>
|