From 29791f27bdf954fb39c81f823dadffb3dcce859d Mon Sep 17 00:00:00 2001 From: davidgoss Date: Tue, 16 Feb 2021 00:52:51 +0000 Subject: [PATCH] support yaml --- demo/ClipboardImporter.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/demo/ClipboardImporter.tsx b/demo/ClipboardImporter.tsx index 1fd52df0..c5872894 100644 --- a/demo/ClipboardImporter.tsx +++ b/demo/ClipboardImporter.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import * as yaml from 'yaml-js'; import styled from '../src/styled-components'; const Button = styled.button` @@ -36,9 +37,9 @@ export default class ClipboardImporter extends React.Component { if (!text) { return; } - const asJson = JSON.parse(text); - if (asJson) { - this.props.onPaste(asJson); + const fromYamlOrJson = yaml.load(text); + if (fromYamlOrJson) { + this.props.onPaste(fromYamlOrJson); } }) .catch(() => {