Remove ability to prettify YAML (doesn't need it)

This commit is contained in:
Gregory Schier 2019-08-09 13:10:20 -04:00
parent 3f02e84d4c
commit baedfd2aef

View File

@ -20,7 +20,6 @@ import DropdownItem from '../base/dropdown/dropdown-item';
import { query as queryXPath } from 'insomnia-xpath'; import { query as queryXPath } from 'insomnia-xpath';
import deepEqual from 'deep-equal'; import deepEqual from 'deep-equal';
import zprint from 'zprint-clj'; import zprint from 'zprint-clj';
import YAML from 'yaml';
const TAB_KEY = 9; const TAB_KEY = 9;
const TAB_SIZE = 4; const TAB_SIZE = 4;
@ -421,14 +420,6 @@ class CodeEditor extends React.Component {
} }
} }
_prettifyYAML(code) {
try {
return YAML.stringify(YAML.parse(code), null, this._indentChars());
} catch (e) {
return code;
}
}
static _prettifyEDN(code) { static _prettifyEDN(code) {
try { try {
return zprint(code, null); return zprint(code, null);
@ -781,8 +772,6 @@ class CodeEditor extends React.Component {
code = this._prettifyXML(code); code = this._prettifyXML(code);
} else if (CodeEditor._isEDN(this.props.mode)) { } else if (CodeEditor._isEDN(this.props.mode)) {
code = CodeEditor._prettifyEDN(code); code = CodeEditor._prettifyEDN(code);
} else if (CodeEditor._isYAML(this.props.mode)) {
code = this._prettifyYAML(code);
} else { } else {
code = this._prettifyJSON(code); code = this._prettifyJSON(code);
} }
@ -813,12 +802,7 @@ class CodeEditor extends React.Component {
_canPrettify() { _canPrettify() {
const { mode } = this.props; const { mode } = this.props;
return ( return CodeEditor._isJSON(mode) || CodeEditor._isXML(mode) || CodeEditor._isEDN(mode);
CodeEditor._isJSON(mode) ||
CodeEditor._isXML(mode) ||
CodeEditor._isEDN(mode) ||
CodeEditor._isYAML(mode)
);
} }
_showFilterHelp() { _showFilterHelp() {
@ -891,8 +875,6 @@ class CodeEditor extends React.Component {
contentTypeName = 'JSON'; contentTypeName = 'JSON';
} else if (CodeEditor._isXML(mode)) { } else if (CodeEditor._isXML(mode)) {
contentTypeName = 'XML'; contentTypeName = 'XML';
} else if (CodeEditor._isYAML(mode)) {
contentTypeName = 'YAML';
} else if (CodeEditor._isEDN(mode)) { } else if (CodeEditor._isEDN(mode)) {
contentTypeName = 'EDN'; contentTypeName = 'EDN';
} }