Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-29 20:20:29 +01:00
cf50a7deb3
* Apply prettier * applied prettier for similar-topics-validator Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
45 Zeilen
1.008 B
JavaScript
45 Zeilen
1.008 B
JavaScript
/* eslint no-undef: 0 */
|
|
|
|
import computed from "discourse-common/utils/decorators";
|
|
import { siteDir, isRTL, isLTR } from "discourse/lib/text-direction";
|
|
import WizardI18n from "../lib/wizard-i18n";
|
|
|
|
export default Ember.TextField.extend({
|
|
attributeBindings: [
|
|
"autocorrect",
|
|
"autocapitalize",
|
|
"autofocus",
|
|
"maxLength",
|
|
"dir",
|
|
],
|
|
|
|
@computed
|
|
dir() {
|
|
if (Wizard.SiteSettings.support_mixed_text_direction) {
|
|
let val = this.value;
|
|
if (val) {
|
|
return isRTL(val) ? "rtl" : "ltr";
|
|
} else {
|
|
return siteDir();
|
|
}
|
|
}
|
|
},
|
|
|
|
keyUp() {
|
|
if (Wizard.SiteSettings.support_mixed_text_direction) {
|
|
let val = this.value;
|
|
if (isRTL(val)) {
|
|
this.set("dir", "rtl");
|
|
} else if (isLTR(val)) {
|
|
this.set("dir", "ltr");
|
|
} else {
|
|
this.set("dir", siteDir());
|
|
}
|
|
}
|
|
},
|
|
|
|
@computed("placeholderKey")
|
|
placeholder(placeholderKey) {
|
|
return placeholderKey ? WizardI18n(placeholderKey) : "";
|
|
},
|
|
});
|