mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-01 06:53:11 +02:00
Http response events (#326)
This commit is contained in:
@@ -13,7 +13,7 @@ export function languageFromContentType(
|
||||
return 'xml';
|
||||
}
|
||||
if (justContentType.includes('html')) {
|
||||
const detected = detectFromContent(content);
|
||||
const detected = languageFromContent(content);
|
||||
if (detected === 'xml') {
|
||||
// If it's detected as XML, but is already HTML, don't change it
|
||||
return 'html';
|
||||
@@ -22,16 +22,16 @@ export function languageFromContentType(
|
||||
}
|
||||
if (justContentType.includes('javascript')) {
|
||||
// Sometimes `application/javascript` returns JSON, so try detecting that
|
||||
return detectFromContent(content, 'javascript');
|
||||
return languageFromContent(content, 'javascript');
|
||||
}
|
||||
if (justContentType.includes('markdown')) {
|
||||
return 'markdown';
|
||||
}
|
||||
|
||||
return detectFromContent(content, 'text');
|
||||
return languageFromContent(content, 'text');
|
||||
}
|
||||
|
||||
function detectFromContent(
|
||||
export function languageFromContent(
|
||||
content: string | null,
|
||||
fallback?: EditorProps['language'],
|
||||
): EditorProps['language'] {
|
||||
|
||||
Reference in New Issue
Block a user