diff --git a/common/common.scss b/common/common.scss index 48b2d98..566f22e 100644 --- a/common/common.scss +++ b/common/common.scss @@ -275,9 +275,20 @@ html.composer-open .custom-homepage #main-outlet { max-width: 46em; } - input { + .btn-primary { + align-self: end; + min-height: 2.5em; + } + + #custom-homepage-input { width: 100%; margin: 0; + resize: none; + border-radius: var(--d-button-border-radius); + &:focus { + outline: none; + border-color: var(--primary-high); + } } } diff --git a/javascripts/discourse/components/custom-homepage.gjs b/javascripts/discourse/components/custom-homepage.gjs index e67574e..cae9522 100644 --- a/javascripts/discourse/components/custom-homepage.gjs +++ b/javascripts/discourse/components/custom-homepage.gjs @@ -1,5 +1,4 @@ import Component from "@glimmer/component"; -import { Input } from "@ember/component"; import { on } from "@ember/modifier"; import { action } from "@ember/object"; import didInsert from "@ember/render-modifiers/modifiers/did-insert"; @@ -8,10 +7,13 @@ import DButton from "discourse/components/d-button"; import bodyClass from "discourse/helpers/body-class"; import i18n from "discourse-common/helpers/i18n"; import HomepageButtons from "../components/homepage-buttons"; +import SimpleTextareaInteractor from "../lib/simple-textarea-interactor"; export default class CustomHomepage extends Component { @service hiddenSubmit; + textareaInteractor = null; + @action updateInputValue(event) { this.hiddenSubmit.inputValue = event.target.value; @@ -19,25 +21,30 @@ export default class CustomHomepage extends Component { @action handleKeyDown(event) { - if (event.key === "Enter") { + if (event.key === "Enter" && !event.shiftKey) { this.hiddenSubmit.submitToBot(); } } + @action + initializeTextarea(element) { + this.textareaInteractor = new SimpleTextareaInteractor(element); + } +