mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
Merge pull request #215
feat: replace text inputs with code editor in JSON tools
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { escapeJson } from './service';
|
import { escapeJson } from './service';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
@@ -88,7 +88,12 @@ export default function EscapeJsonTool({
|
|||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput title="Input JSON" value={input} onChange={setInput} />
|
<ToolCodeInput
|
||||||
|
title="Input JSON"
|
||||||
|
value={input}
|
||||||
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
<ToolTextResult
|
<ToolTextResult
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { convertJsonToXml } from './service';
|
import { convertJsonToXml } from './service';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
@@ -84,7 +84,12 @@ export default function JsonToXml({ title }: ToolComponentProps) {
|
|||||||
compute={compute}
|
compute={compute}
|
||||||
exampleCards={exampleCards}
|
exampleCards={exampleCards}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput title="Input Json" value={input} onChange={setInput} />
|
<ToolCodeInput
|
||||||
|
title="Input Json"
|
||||||
|
value={input}
|
||||||
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
<ToolTextResult title="Output XML" value={result} extension={'xml'} />
|
<ToolTextResult title="Output XML" value={result} extension={'xml'} />
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { minifyJson } from './service';
|
import { minifyJson } from './service';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
@@ -60,10 +60,11 @@ export default function MinifyJson({ title }: ToolComponentProps) {
|
|||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput
|
<ToolCodeInput
|
||||||
title={t('minify.inputTitle')}
|
title={t('minify.inputTitle')}
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { beautifyJson } from './service';
|
import { beautifyJson } from './service';
|
||||||
import ToolInfo from '@components/ToolInfo';
|
import ToolInfo from '@components/ToolInfo';
|
||||||
@@ -130,10 +130,11 @@ export default function PrettifyJson({ title }: ToolComponentProps) {
|
|||||||
title={title}
|
title={title}
|
||||||
input={input}
|
input={input}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput
|
<ToolCodeInput
|
||||||
title={t('prettify.inputTitle')}
|
title={t('prettify.inputTitle')}
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { stringifyJson } from './service';
|
import { stringifyJson } from './service';
|
||||||
import { ToolComponentProps } from '@tools/defineTool';
|
import { ToolComponentProps } from '@tools/defineTool';
|
||||||
@@ -103,10 +103,11 @@ export default function StringifyJson({ title }: ToolComponentProps) {
|
|||||||
compute={compute}
|
compute={compute}
|
||||||
exampleCards={exampleCards}
|
exampleCards={exampleCards}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput
|
<ToolCodeInput
|
||||||
title="JavaScript Object/Array"
|
title="JavaScript Object/Array"
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { convertTsvToJson } from './service';
|
import { convertTsvToJson } from './service';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
@@ -216,7 +216,12 @@ export default function TsvToJson({
|
|||||||
exampleCards={exampleCards}
|
exampleCards={exampleCards}
|
||||||
getGroups={getGroups}
|
getGroups={getGroups}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput title="Input TSV" value={input} onChange={setInput} />
|
<ToolCodeInput
|
||||||
|
title="Input TSV"
|
||||||
|
value={input}
|
||||||
|
onChange={setInput}
|
||||||
|
language="tsv"
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
<ToolTextResult title="Output JSON" value={result} extension={'json'} />
|
<ToolTextResult title="Output JSON" value={result} extension={'json'} />
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ToolTextInput from '@components/input/ToolTextInput';
|
import ToolCodeInput from '@components/input/ToolCodeInput';
|
||||||
import ToolTextResult from '@components/result/ToolTextResult';
|
import ToolTextResult from '@components/result/ToolTextResult';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
import { validateJson } from './service';
|
import { validateJson } from './service';
|
||||||
@@ -65,10 +65,11 @@ export default function ValidateJson({ title }: ToolComponentProps) {
|
|||||||
<ToolContent
|
<ToolContent
|
||||||
title={title}
|
title={title}
|
||||||
inputComponent={
|
inputComponent={
|
||||||
<ToolTextInput
|
<ToolCodeInput
|
||||||
title={t('validateJson.inputTitle')}
|
title={t('validateJson.inputTitle')}
|
||||||
value={input}
|
value={input}
|
||||||
onChange={setInput}
|
onChange={setInput}
|
||||||
|
language="json"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
resultComponent={
|
resultComponent={
|
||||||
|
Reference in New Issue
Block a user