Fix copy-paste on input (#331)

If the input is active, we shouldn't override copy paste behavior
This commit is contained in:
Christopher Chedeau 2020-01-11 20:41:47 -08:00 committed by GitHub
parent d45f48e60f
commit dd2a7eb597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -295,6 +295,7 @@ export class App extends React.Component<{}, AppState> {
<div
className="container"
onCut={e => {
if (isInputLike(e.target)) return;
e.clipboardData.setData(
"text/plain",
JSON.stringify(
@ -308,6 +309,7 @@ export class App extends React.Component<{}, AppState> {
e.preventDefault();
}}
onCopy={e => {
if (isInputLike(e.target)) return;
e.clipboardData.setData(
"text/plain",
JSON.stringify(
@ -319,6 +321,7 @@ export class App extends React.Component<{}, AppState> {
e.preventDefault();
}}
onPaste={e => {
if (isInputLike(e.target)) return;
const paste = e.clipboardData.getData("text");
this.addElementsFromPaste(paste);
e.preventDefault();