Skip to content

Commit

Permalink
UX: Maximize the preview space in composer
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX committed Dec 2, 2021
1 parent 7456a59 commit 7fe59e4
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{d-editor
{{#d-editor
value=composer.reply
placeholder=replyPlaceholder
previewUpdated=(action "previewUpdated")
Expand All @@ -19,6 +19,8 @@
disabled=disableTextarea
outletArgs=(hash composer=composer editorType="composer")
}}
{{yield}}
{{/d-editor}}

{{#if allowUpload}}
{{#if acceptsAllFormats}}
Expand Down
104 changes: 54 additions & 50 deletions app/assets/javascripts/discourse/app/templates/components/d-editor.hbs
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
<div class="d-editor-container">
<div class="d-editor-textarea-wrapper {{if disabled "disabled"}} {{if isEditorFocused "in-focus"}}">
<div class="d-editor-button-bar" role="toolbar">
{{#each toolbar.groups as |group|}}
{{#each group.buttons as |b|}}
{{#if b.popupMenu}}
{{toolbar-popup-menu-options
content=popupMenuOptions
onChange=onPopupMenuAction
onOpen=(action b.action b)
class=b.className
tabindex=-1
onKeydown=rovingButtonBar
options=(hash
<div class="d-editor-textarea-column">
{{yield}}

<div class="d-editor-textarea-wrapper {{if disabled "disabled"}} {{if isEditorFocused "in-focus"}}">
<div class="d-editor-button-bar" role="toolbar">
{{#each toolbar.groups as |group|}}
{{#each group.buttons as |b|}}
{{#if b.popupMenu}}
{{toolbar-popup-menu-options
content=popupMenuOptions
onChange=onPopupMenuAction
onOpen=(action b.action b)
class=b.className
tabindex=-1
onKeydown=rovingButtonBar
options=(hash
icon=b.icon
focusAfterOnChange=false
)
}}
{{else}}
{{d-button
action=b.action
type="button"
actionParam=b
translatedTitle=b.title
label=b.label
icon=b.icon
focusAfterOnChange=false
)
}}
{{else}}
{{d-button
action=b.action
type="button"
actionParam=b
translatedTitle=b.title
label=b.label
icon=b.icon
class=b.className
preventFocus=b.preventFocus
tabindex=b.tabindex
onKeyDown=rovingButtonBar
}}
{{/if}}
class=b.className
preventFocus=b.preventFocus
tabindex=b.tabindex
onKeyDown=rovingButtonBar
}}
{{/if}}
{{/each}}

{{#unless group.lastGroup}}
<div class="d-editor-spacer"></div>
{{/unless}}
{{/each}}
</div>

{{#unless group.lastGroup}}
<div class="d-editor-spacer"></div>
{{/unless}}
{{/each}}
{{conditional-loading-spinner condition=loading}}
{{d-textarea
autocomplete="discourse"
tabindex=tabindex
value=value
class="d-editor-input"
placeholder=placeholderTranslated
aria-label=placeholderTranslated
disabled=disabled
input=change
focusIn=(action "focusIn")
focusOut=(action "focusOut")
}}
{{popup-input-tip validation=validation}}
{{plugin-outlet name="after-d-editor" tagName="" args=outletArgs}}
</div>

{{conditional-loading-spinner condition=loading}}
{{d-textarea
autocomplete="discourse"
tabindex=tabindex
value=value
class="d-editor-input"
placeholder=placeholderTranslated
aria-label=placeholderTranslated
disabled=disabled
input=change
focusIn=(action "focusIn")
focusOut=(action "focusOut")
}}
{{popup-input-tip validation=validation}}
{{plugin-outlet name="after-d-editor" tagName="" args=outletArgs}}
</div>

<div class="d-editor-preview-wrapper {{if forcePreview "force-preview"}}">
Expand Down
Loading

0 comments on commit 7fe59e4

Please sign in to comment.