Hide surround with behind a setting
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
e90f5ddf5b
commit
b330dd55a0
3 changed files with 8 additions and 1 deletions
|
@ -418,6 +418,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
};
|
||||
|
||||
private onKeyDown = (event: React.KeyboardEvent) => {
|
||||
const surroundWith = SettingsStore.getValue("MessageComposerInput.surroundWith");
|
||||
const selectionRange = getRangeForSelection(this.editorRef.current, this.props.model, document.getSelection());
|
||||
// trim the range as we want it to exclude leading/trailing spaces
|
||||
selectionRange.trim();
|
||||
|
@ -475,7 +476,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
});
|
||||
handled = true;
|
||||
// autocomplete or enter to send below shouldn't have any modifier keys pressed.
|
||||
} else if (document.getSelection().type != "Caret") {
|
||||
} else if (surroundWith && document.getSelection().type != "Caret") {
|
||||
if (event.key === '(') {
|
||||
this.historyManager.ensureLastChangesPushed(this.props.model);
|
||||
this.modifiedFlag = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue