Display persistant command input on server buffer
This commit changes the composer to not be read-only on the server buffer, which tells the user that they can send commands from that view. On the server buffer, the placeholder is changed to "Type a command (see /help)", which indicates to the user that this buffer only accepts commands, and gives them a hint for how to learn what commands are available. Implements: https://todo.sr.ht/~emersion/gamja/38
This commit is contained in:
parent
b11f58b975
commit
0b59cf92b9
2 changed files with 13 additions and 5 deletions
|
@ -143,7 +143,7 @@ export default class Composer extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.props.readOnly && event.key !== "/") {
|
||||
if (this.props.readOnly || (this.props.commandOnly && event.key !== "/")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,11 @@ export default class Composer extends Component {
|
|||
className = "read-only";
|
||||
}
|
||||
|
||||
let placeholder = "Type a message";
|
||||
if (this.props.commandOnly) {
|
||||
placeholder = "Type a command (see /help)";
|
||||
}
|
||||
|
||||
return html`
|
||||
<form
|
||||
id="composer"
|
||||
|
@ -214,7 +219,7 @@ export default class Composer extends Component {
|
|||
ref=${this.textInput}
|
||||
value=${this.state.text}
|
||||
autocomplete="off"
|
||||
placeholder="Type a message"
|
||||
placeholder=${placeholder}
|
||||
enterkeyhint="send"
|
||||
onKeyDown=${this.handleInputKeyDown}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue