You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-19 05:22:13 +03:00
implement editor placeholder
This commit is contained in:
@@ -54,6 +54,16 @@ export default class BasicMessageEditor extends React.Component {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
if (this.props.placeholder) {
|
||||
const {isEmpty} = this.props.model;
|
||||
if (isEmpty) {
|
||||
this._editorRef.style.setProperty("--placeholder", `'${this.props.placeholder}'`);
|
||||
this._editorRef.classList.add("mx_BasicMessageComposer_inputEmpty");
|
||||
} else {
|
||||
this._editorRef.classList.remove("mx_BasicMessageComposer_inputEmpty");
|
||||
this._editorRef.style.removeProperty("--placeholder");
|
||||
}
|
||||
}
|
||||
this.setState({autoComplete: this.props.model.autoComplete});
|
||||
this.historyManager.tryPush(this.props.model, caret, inputType, diff);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ export default class SendMessageComposer extends React.Component {
|
||||
model={this.model}
|
||||
room={this.props.room}
|
||||
label={_t("Send message")}
|
||||
placeholder={this.props.placeholder}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user