mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-17 04:00:48 +01:00
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'
|
||||
];
|
||||
const doc = new DOMParser().parseFromString(str, 'text/html');
|
||||
const lowerStr = str.toLowerCase();
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
const doc = new DOMParser().parseFromString(str, 'text/xml');
|
||||
const errorNode = doc.querySelector('parsererror');
|
||||
return !errorNode;
|
||||
}
|
||||
|
||||
function isMarkdown (str: string) {
|
||||
function isMD (str: string) {
|
||||
const mdChecks = [
|
||||
'# ',
|
||||
'`',
|
||||
@ -168,15 +178,15 @@ function isMarkdown (str: string) {
|
||||
export function langDetector (str: string) {
|
||||
if (!str.trim().length)
|
||||
return 'text';
|
||||
|
||||
if (isJSON(str))
|
||||
return 'json';
|
||||
if (isHTML(str))
|
||||
return 'html';
|
||||
if (isSVG(str))
|
||||
return 'svg';
|
||||
if (isXML(str))
|
||||
return 'xml';
|
||||
if (isMarkdown(str))
|
||||
if (isMD(str))
|
||||
return 'markdown';
|
||||
|
||||
return 'text';
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
<ConfirmModal
|
||||
:confirm-text="t('word.confirm')"
|
||||
size="400"
|
||||
:disable-autofocus="true"
|
||||
@confirm="confirmOptionsChange"
|
||||
@hide="$emit('hide')"
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user