From 81c5829e1b2c5c53abe82913d4029c18798b552d Mon Sep 17 00:00:00 2001 From: Derrick Pelletier Date: Fri, 3 Nov 2017 15:01:21 -0700 Subject: [PATCH] quickEdit support (#2392) --- lib/components/term.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/components/term.js b/lib/components/term.js index 3233ead3..e22dbab5 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -129,9 +129,15 @@ export default class Term extends PureComponent { } } - onMouseUp() { - // handle copying selected text - if (this.props.copyOnSelect && this.term.hasSelection()) { + onMouseUp(e) { + if (this.props.quickEdit && e.button === 2) { + if (this.term.hasSelection()) { + clipboard.writeText(this.term.getSelection()); + this.term.clearSelection(); + } else { + document.execCommand('paste'); + } + } else if (this.props.copyOnSelect && this.term.hasSelection()) { clipboard.writeText(this.term.getSelection()); } }