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 b05d7042ae
FIX: prevents events on toolbar when in form (#7567)
If a button is not of type button, pressing enter inside an `<input>` inside a `<form>` without the action attribute will trigger the first available `<button>` as most browsers default the type of an unspecified button to submit.

This commit also prevents d-editor-modal to be filled when it's hidden.
2019-05-17 11:14:09 +02:00

62 lines
2.0 KiB
Handlebars

<div class='d-editor-overlay hidden'></div>
<div class='d-editor-modals'>
{{#d-editor-modal class="insert-link" hidden=insertLinkHidden okAction=(action "insertLink")}}
<h3>{{i18n "composer.link_dialog_title"}}</h3>
{{text-field value=linkUrl placeholderKey="composer.link_url_placeholder" class="link-url"}}
{{text-field value=linkText placeholderKey="composer.link_optional_text" class="link-text"}}
{{/d-editor-modal}}
</div>
<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
onSelect=onPopupMenuAction
onExpand=(action b.action b)
title=b.title
headerIcon=b.icon
class=b.className
content=popupMenuOptions}}
{{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
change=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')}}