mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 20:34:52 +00:00
FEATURE: focus on composer TEXTAREA when iPad has a physical keyboard
This disables a bunch of hacks that bypassed "focus" on iOS (cause focus events that involve a virtual keyboard on iOS cause browser havoc unless a physical keyboard is attached) Also will focus on title on new topic
This commit is contained in:
parent
6bc8382555
commit
cdf34657f6
@ -30,7 +30,8 @@ import {
|
|||||||
validateUploadedFiles,
|
validateUploadedFiles,
|
||||||
authorizesOneOrMoreImageExtensions,
|
authorizesOneOrMoreImageExtensions,
|
||||||
formatUsername,
|
formatUsername,
|
||||||
clipboardData
|
clipboardData,
|
||||||
|
safariHacksDisabled
|
||||||
} from "discourse/lib/utilities";
|
} from "discourse/lib/utilities";
|
||||||
import {
|
import {
|
||||||
cacheShortUploadUrl,
|
cacheShortUploadUrl,
|
||||||
@ -201,7 +202,10 @@ export default Ember.Component.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Focus on the body unless we have a title
|
// 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();
|
this.$(".d-editor-input").putCursorAtEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ import { findRawTemplate } from "discourse/lib/raw-templates";
|
|||||||
import { siteDir } from "discourse/lib/text-direction";
|
import { siteDir } from "discourse/lib/text-direction";
|
||||||
import {
|
import {
|
||||||
determinePostReplaceSelection,
|
determinePostReplaceSelection,
|
||||||
clipboardData
|
clipboardData,
|
||||||
|
safariHacksDisabled
|
||||||
} from "discourse/lib/utilities";
|
} from "discourse/lib/utilities";
|
||||||
import toMarkdown from "discourse/lib/to-markdown";
|
import toMarkdown from "discourse/lib/to-markdown";
|
||||||
import deprecated from "discourse-common/lib/deprecated";
|
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 = this.$("textarea.d-editor-input");
|
||||||
const textarea = $textarea[0];
|
const textarea = $textarea[0];
|
||||||
const oldScrollPos = $textarea.scrollTop();
|
const oldScrollPos = $textarea.scrollTop();
|
||||||
if (!this.capabilities.isIOS) {
|
if (!this.capabilities.isIOS || safariHacksDisabled()) {
|
||||||
$textarea.focus();
|
$textarea.focus();
|
||||||
}
|
}
|
||||||
textarea.selectionStart = from;
|
textarea.selectionStart = from;
|
||||||
|
@ -12,7 +12,8 @@ import { getOwner } from "discourse-common/lib/get-owner";
|
|||||||
import {
|
import {
|
||||||
escapeExpression,
|
escapeExpression,
|
||||||
uploadIcon,
|
uploadIcon,
|
||||||
authorizesOneOrMoreExtensions
|
authorizesOneOrMoreExtensions,
|
||||||
|
safariHacksDisabled
|
||||||
} from "discourse/lib/utilities";
|
} from "discourse/lib/utilities";
|
||||||
import { emojiUnescape } from "discourse/lib/text";
|
import { emojiUnescape } from "discourse/lib/text";
|
||||||
import { shortDate } from "discourse/lib/formatter";
|
import { shortDate } from "discourse/lib/formatter";
|
||||||
@ -137,7 +138,7 @@ export default Ember.Controller.extend({
|
|||||||
"model.composeState"
|
"model.composeState"
|
||||||
)
|
)
|
||||||
focusTarget(replyingToTopic, creatingPM, usernames, composeState) {
|
focusTarget(replyingToTopic, creatingPM, usernames, composeState) {
|
||||||
if (this.capabilities.isIOS) {
|
if (this.capabilities.isIOS && !safariHacksDisabled()) {
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user