Automatically focus on composer textarea on iOS. closes flarum/core#995

This commit is contained in:
Sheldon Fernandes 2016-09-03 23:11:56 +09:30 committed by Toby Zerner
parent 9059b7ad79
commit ed0691a071
3 changed files with 10 additions and 14 deletions

View File

@ -20163,6 +20163,7 @@ System.register('flarum/components/Composer', ['flarum/Component', 'flarum/utils
if (this.isFullScreen()) {
this.$().css('top', $(window).scrollTop());
this.showBackdrop();
this.component.focus();
}
}
}, {
@ -26249,18 +26250,15 @@ System.register('flarum/components/ReplyPlaceholder', ['flarum/Component', 'flar
);
}
function triggerClick(e) {
$(this).trigger('click');
e.preventDefault();
}
var reply = function reply() {
DiscussionControls.replyAction.call(_this2.props.discussion, true);
DiscussionControls.replyAction.call(_this2.props.discussion, true).then(function (newComponent) {
newComponent.focus();
});
};
return m(
'article',
{ className: 'Post ReplyPlaceholder', onclick: reply, onmousedown: triggerClick },
{ className: 'Post ReplyPlaceholder', onclick: reply },
m(
'header',
{ className: 'Post-header' },

View File

@ -362,6 +362,7 @@ class Composer extends Component {
if (this.isFullScreen()) {
this.$().css('top', $(window).scrollTop());
this.showBackdrop();
this.component.focus();
}
}

View File

@ -31,17 +31,14 @@ export default class ReplyPlaceholder extends Component {
);
}
function triggerClick(e) {
$(this).trigger('click');
e.preventDefault();
}
const reply = () => {
DiscussionControls.replyAction.call(this.props.discussion, true);
DiscussionControls.replyAction.call(this.props.discussion, true).then(function (newComponent) {
newComponent.focus();
});
};
return (
<article className="Post ReplyPlaceholder" onclick={reply} onmousedown={triggerClick}>
<article className="Post ReplyPlaceholder" onclick={reply}>
<header className="Post-header">
{avatar(app.session.user, {className: 'PostUser-avatar'})}{' '}
{app.translator.trans('core.forum.post_stream.reply_placeholder')}