This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/templates/components/d-editor.hbs
Joffrey JAFFEUX 0431942f3d
DEV: select-kit 2 (#7998)
This new iteration of select-kit focuses on following best principales and disallowing mutations inside select-kit components. A best effort has been made to avoid breaking changes, however if you content was a flat array, eg: ["foo", "bar"] You will need to set valueProperty=null and nameProperty=null on the component.

Also almost every component should have an `onChange` handler now to decide what to do with the updated data. **select-kit will not mutate your data by itself anymore**
2020-02-03 14:22:14 +01:00

55 lines
1.7 KiB
Handlebars

<div class='d-editor-container'>
<div class="d-editor-textarea-wrapper {{if disabled "disabled"}}">
<div class='d-editor-button-bar'>
{{#each toolbar.groups as |group|}}
{{#each group.buttons as |b|}}
{{#if b.popupMenu}}
{{toolbar-popup-menu-options
content=popupMenuOptions
onChange=onPopupMenuAction
onExpand=(action b.action b)
class=b.className
options=(hash
popupTitle=b.title
icon=b.icon
)
}}
{{else}}
{{d-button
action=b.action
type="button"
actionParam=b
translatedTitle=b.title
label=b.label
icon=b.icon
class=b.className}}
{{/if}}
{{/each}}
{{#unless group.lastGroup}}
<div class='d-editor-spacer'></div>
{{/unless}}
{{/each}}
</div>
{{conditional-loading-spinner condition=loading}}
{{textarea
autocomplete="discourse"
tabindex=tabindex
value=value
class="d-editor-input"
placeholder=placeholderTranslated
disabled=disabled
input=change}}
{{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'}}">
<div class="d-editor-preview">{{{preview}}}</div>
{{plugin-outlet name="editor-preview" classNames="d-editor-plugin"}}
</div>
</div>
{{emoji-picker active=emojiPickerIsActive isEditorFocused=isEditorFocused emojiSelected=(action 'emojiSelected')}}