Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: focus on composer TEXTAREA when iPad has a physical keyboard

Samcdf34657f6c5
diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6
index c15bd51d3c2..c27db9ed14e 100644
--- a/app/assets/javascripts/discourse/components/composer-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6
@@ -30,7 +30,8 @@ import {
validateUploadedFiles,
authorizesOneOrMoreImageExtensions,
formatUsername,
- clipboardData
+ clipboardData,
+ safariHacksDisabled
} from "discourse/lib/utilities";
import {
cacheShortUploadUrl,
@@ -201,7 +202,10 @@ export default Ember.Component.extend({
}
// Focus on the body unless we have a title
- if (!this.get("composer.canEditTitle") && !this.capabilities.isIOS) {
+ if (
+ !this.get("composer.canEditTitle") &&
+ (!this.capabilities.isIOS || safariHacksDisabled())
+ ) {
this.$(".d-editor-input").putCursorAtEnd();
}
diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6
index 4b67908d999..bc9240d53ef 100644
--- a/app/assets/javascripts/discourse/components/d-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/d-editor.js.es6
@@ -12,7 +12,8 @@ import { findRawTemplate } from "discourse/lib/raw-templates";
import { siteDir } from "discourse/lib/text-direction";
import {
determinePostReplaceSelection,
- clipboardData
+ clipboardData,
+ safariHacksDisabled
} from "discourse/lib/utilities";
import toMarkdown from "discourse/lib/to-markdown";
import deprecated from "discourse-common/lib/deprecated";
@@ -524,7 +525,7 @@ export default Ember.Component.extend({
const $textarea = this.$("textarea.d-editor-input");
const textarea = $textarea[0];
const oldScrollPos = $textarea.scrollTop();
- if (!this.capabilities.isIOS) {
+ if (!this.capabilities.isIOS || safariHacksDisabled()) {
$textarea.focus();
}
textarea.selectionStart = from;
diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6
index 7ef2397a4fa..8156df8e42b 100644
--- a/app/assets/javascripts/discourse/controllers/composer.js.es6
+++ b/app/assets/javascripts/discourse/controllers/composer.js.es6
@@ -12,7 +12,8 @@ import { getOwner } from "discourse-common/lib/get-owner";
import {
escapeExpression,
uploadIcon,
- authorizesOneOrMoreExtensions
+ authorizesOneOrMoreExtensions,
+ safariHacksDisabled
} from "discourse/lib/utilities";
import { emojiUnescape } from "discourse/lib/text";
import { shortDate } from "discourse/lib/formatter";
@@ -137,7 +138,7 @@ export default Ember.Controller.extend({
"model.composeState"
)
focusTarget(replyingToTopic, creatingPM, usernames, composeState) {
- if (this.capabilities.isIOS) {
+ if (this.capabilities.isIOS && !safariHacksDisabled()) {
return "none";
}