mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-01 11:56:48 +01:00
[chore] Apply lint and formatter
This commit is contained in:
parent
664a531c22
commit
a9aff676ba
@ -408,15 +408,15 @@ async function translate(text, lang) {
|
|||||||
|
|
||||||
// split text by embedded images links
|
// split text by embedded images links
|
||||||
const chunks = text.split(/!\[.*?]\([^)]*\)/);
|
const chunks = text.split(/!\[.*?]\([^)]*\)/);
|
||||||
const links = [ ...text.matchAll(/!\[.*?]\([^)]*\)/g) ];
|
const links = [...text.matchAll(/!\[.*?]\([^)]*\)/g)];
|
||||||
|
|
||||||
let r = "";
|
let result = '';
|
||||||
for (let i = 0; i < chunks.length; i++) {
|
for (let i = 0; i < chunks.length; i++) {
|
||||||
r += await translateInner(chunks[i], lang);
|
result += await translateInner(chunks[i], lang);
|
||||||
if (i < links.length) r += links[i][0];
|
if (i < links.length) result += links[i][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
toastr.error(String(error), 'Failed to translate message');
|
toastr.error(String(error), 'Failed to translate message');
|
||||||
@ -649,7 +649,7 @@ jQuery(async () => {
|
|||||||
const secretKey = extension_settings.translate.provider + '_url';
|
const secretKey = extension_settings.translate.provider + '_url';
|
||||||
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
||||||
|
|
||||||
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl,{
|
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl, {
|
||||||
customButtons: [{
|
customButtons: [{
|
||||||
text: 'Remove URL',
|
text: 'Remove URL',
|
||||||
appendAtEnd: true,
|
appendAtEnd: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user