Merge pull request #5033 from robintown/escape-composer-placeholder

Escape single quotes in composer placeholder
This commit is contained in:
Travis Ralston 2020-07-21 19:06:10 -06:00 committed by GitHub
commit 5dd5d4922f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,9 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
}; };
private showPlaceholder() { private showPlaceholder() {
this.editorRef.current.style.setProperty("--placeholder", `'${this.props.placeholder}'`); // escape single quotes
const placeholder = this.props.placeholder.replace(/'/g, '\\\'');
this.editorRef.current.style.setProperty("--placeholder", `'${placeholder}'`);
this.editorRef.current.classList.add("mx_BasicMessageComposer_inputEmpty"); this.editorRef.current.classList.add("mx_BasicMessageComposer_inputEmpty");
} }