mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 05:33:29 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
041298b3f8 | ||
|
|
b400940f0e |
@@ -1,5 +1,6 @@
|
||||
import type { HttpRequest} from '@yaakapp-internal/models';
|
||||
import { createWorkspaceModel, patchModelById } from '@yaakapp-internal/models';
|
||||
import type { HttpRequest } from '@yaakapp-internal/models';
|
||||
import { patchModelById } from '@yaakapp-internal/models';
|
||||
import { createRequestAndNavigate } from '../lib/createRequestAndNavigate';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { showToast } from '../lib/toast';
|
||||
@@ -26,7 +27,7 @@ export function useImportCurl() {
|
||||
let verb;
|
||||
if (overwriteRequestId == null) {
|
||||
verb = 'Created';
|
||||
await createWorkspaceModel(importedRequest);
|
||||
await createRequestAndNavigate(importedRequest);
|
||||
} else {
|
||||
verb = 'Updated';
|
||||
await patchModelById(importedRequest.model, overwriteRequestId, (r: HttpRequest) => ({
|
||||
|
||||
@@ -11,7 +11,7 @@ export function languageFromContentType(
|
||||
} else if (justContentType.includes('xml')) {
|
||||
return 'xml';
|
||||
} else if (justContentType.includes('html')) {
|
||||
const detected = detectFromContent(content, 'html');
|
||||
const detected = detectFromContent(content);
|
||||
if (detected === 'xml') {
|
||||
// If it's detected as XML, but is already HTML, don't change it
|
||||
return 'html';
|
||||
@@ -19,7 +19,8 @@ export function languageFromContentType(
|
||||
return detected;
|
||||
}
|
||||
} else if (justContentType.includes('javascript')) {
|
||||
return 'javascript';
|
||||
// Sometimes `application/javascript` returns JSON, so try detecting that
|
||||
return detectFromContent(content, 'javascript');
|
||||
}
|
||||
|
||||
return detectFromContent(content, 'text');
|
||||
@@ -27,7 +28,7 @@ export function languageFromContentType(
|
||||
|
||||
function detectFromContent(
|
||||
content: string | null,
|
||||
fallback: EditorProps['language'],
|
||||
fallback?: EditorProps['language'],
|
||||
): EditorProps['language'] {
|
||||
if (content == null) return 'text';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user