import ComposerBody from 'flarum/components/ComposerBody'; import Alert from 'flarum/components/Alert'; import Button from 'flarum/components/Button'; import icon from 'flarum/helpers/icon'; import extractText from 'flarum/utils/extractText'; function minimizeComposerIfFullScreen(e) { if (app.composer.isFullScreen()) { app.composer.minimize(); e.stopPropagation(); } } /** * The `ReplyComposer` component displays the composer content for replying to a * discussion. * * ### Props * * - All of the props of ComposerBody * - `discussion` */ export default class ReplyComposer extends ComposerBody { init() { super.init(); this.editor.props.preview = e => { minimizeComposerIfFullScreen(e); m.route(app.route.discussion(this.props.discussion, 'reply')); }; } static initProps(props) { super.initProps(props); props.placeholder = props.placeholder || extractText(app.translator.trans('core.forum.composer_reply.body_placeholder')); props.submitLabel = props.submitLabel || app.translator.trans('core.forum.composer_reply.submit_button'); props.confirmExit = props.confirmExit || extractText(app.translator.trans('core.forum.composer_reply.discard_confirmation')); } headerItems() { const items = super.headerItems(); const discussion = this.props.discussion; const routeAndMinimize = function(element, isInitialized) { if (isInitialized) return; $(element).on('click', minimizeComposerIfFullScreen); m.route.apply(this, arguments); }; items.add('title', (