Merge pull request #519 from Nikhil569/main

feat: shows image if url return a image
This commit is contained in:
Anoop M D 2023-10-11 03:33:08 +05:30 committed by GitHub
commit 5682c47d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,10 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
return safeStringifyJSON(data);
}
if (mode.includes('image')) {
return item.requestSent.url;
}
// final fallback
if (typeof data === 'string') {
return data;
@ -103,6 +107,8 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
className="h-full bg-white"
/>
);
} else if (mode.includes('image')) {
return <img src={item.requestSent.url} alt="image" />;
}
return <CodeEditor collection={collection} theme={storedTheme} onRun={onRun} value={value} mode={mode} readOnly />;

View File

@ -60,6 +60,8 @@ export const getCodeMirrorModeBasedOnContentType = (contentType) => {
return 'application/xml';
} else if (contentType.includes('yaml')) {
return 'application/yaml';
} else if (contentType.includes('image')) {
return 'application/image';
} else {
return 'application/text';
}