mirror of https://github.com/Fabio286/antares.git
refactor: disabled autofocus for scheduler timing modal
This commit is contained in:
parent
f312cf5f85
commit
0891e7be8c
|
@ -132,19 +132,29 @@ function isHTML (str: string) {
|
||||||
'wbr'
|
'wbr'
|
||||||
];
|
];
|
||||||
const doc = new DOMParser().parseFromString(str, 'text/html');
|
const doc = new DOMParser().parseFromString(str, 'text/html');
|
||||||
|
const lowerStr = str.toLowerCase();
|
||||||
if (Array.from(doc.body.childNodes).some(node => node.nodeType === 1))
|
if (Array.from(doc.body.childNodes).some(node => node.nodeType === 1))
|
||||||
return tags.some((tag) => str.includes(`<${tag}>`));
|
return tags.some((tag) => lowerStr.includes(`<${tag}>`));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSVG (str: string) {
|
||||||
|
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
||||||
|
const lowerStr = str.toLowerCase();
|
||||||
|
const errorNode = doc.querySelector('parsererror');
|
||||||
|
if (!errorNode)
|
||||||
|
return lowerStr.includes('<svg');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function isXML (str: string) {
|
function isXML (str: string) {
|
||||||
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
||||||
const errorNode = doc.querySelector('parsererror');
|
const errorNode = doc.querySelector('parsererror');
|
||||||
return !errorNode;
|
return !errorNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMarkdown (str: string) {
|
function isMD (str: string) {
|
||||||
const mdChecks = [
|
const mdChecks = [
|
||||||
'# ',
|
'# ',
|
||||||
'`',
|
'`',
|
||||||
|
@ -168,15 +178,15 @@ function isMarkdown (str: string) {
|
||||||
export function langDetector (str: string) {
|
export function langDetector (str: string) {
|
||||||
if (!str.trim().length)
|
if (!str.trim().length)
|
||||||
return 'text';
|
return 'text';
|
||||||
|
|
||||||
if (isJSON(str))
|
if (isJSON(str))
|
||||||
return 'json';
|
return 'json';
|
||||||
if (isHTML(str))
|
if (isHTML(str))
|
||||||
return 'html';
|
return 'html';
|
||||||
|
if (isSVG(str))
|
||||||
|
return 'svg';
|
||||||
if (isXML(str))
|
if (isXML(str))
|
||||||
return 'xml';
|
return 'xml';
|
||||||
if (isMarkdown(str))
|
if (isMD(str))
|
||||||
return 'markdown';
|
return 'markdown';
|
||||||
|
|
||||||
return 'text';
|
return 'text';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
:confirm-text="t('word.confirm')"
|
:confirm-text="t('word.confirm')"
|
||||||
size="400"
|
size="400"
|
||||||
|
:disable-autofocus="true"
|
||||||
@confirm="confirmOptionsChange"
|
@confirm="confirmOptionsChange"
|
||||||
@hide="$emit('hide')"
|
@hide="$emit('hide')"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue