refactor: disabled autofocus for scheduler timing modal

This commit is contained in:
Fabio Di Stasio 2022-07-11 11:35:30 +02:00
parent f312cf5f85
commit 0891e7be8c
2 changed files with 16 additions and 5 deletions

View File

@ -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';
}

View File

@ -2,6 +2,7 @@
<ConfirmModal
:confirm-text="t('word.confirm')"
size="400"
:disable-autofocus="true"
@confirm="confirmOptionsChange"
@hide="$emit('hide')"
>