mirror of
https://github.com/Fenrir784/e621tagger.git
synced 2026-11-20 08:41:20 -08:00
Text area for copy fix
This commit is contained in:
1 parent
4732396fa3
commit
6f7fec6669
2 files changed
+10
-18
No files matched your search
+9
-17
@@ -412,26 +412,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
btn._copyTimeout = setTimeout(() => btn.classList.remove('copied'), 1000);
|
||||
}
|
||||
|
||||
const fallbackTextarea = document.createElement('textarea');
|
||||
fallbackTextarea.style.position = 'fixed';
|
||||
fallbackTextarea.style.opacity = '0';
|
||||
fallbackTextarea.setAttribute('aria-hidden', 'true');
|
||||
fallbackTextarea.setAttribute('inputmode', 'none');
|
||||
document.body.appendChild(fallbackTextarea);
|
||||
|
||||
document.addEventListener('focusin', (e) => {
|
||||
if (e.target.tagName === 'BUTTON') {
|
||||
e.target.blur();
|
||||
}
|
||||
});
|
||||
|
||||
function fallbackCopy(text, btn, count, format) {
|
||||
fallbackTextarea.value = text;
|
||||
fallbackTextarea.select();
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
try {
|
||||
if (document.execCommand('copy')) showCopySuccess(btn, count, format);
|
||||
else showNotification('Unable to copy. Please copy manually.', 'error');
|
||||
} catch { showNotification('Copy failed. Please copy manually.', 'error'); }
|
||||
else showNotification('Unable to copy.', 'error');
|
||||
} catch { showNotification('Copy failed.', 'error'); }
|
||||
document.body.removeChild(textarea);
|
||||
}
|
||||
|
||||
function setupGlobalCopyButton(btn, getThreshold) {
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
<line x1="12" y1="3" x2="12" y2="15" />
|
||||
</svg>
|
||||
<p>Drag & drop image here, Ctrl+V or click to select</p>
|
||||
<p class="small">Supports: PNG, JPG, GIF, WebP, BMP, TIFF (max 20MB)</p>
|
||||
<p class="small">Supports: PNG, JPG, GIF, WebP (max 20MB)</p>
|
||||
</div>
|
||||
<input type="file" id="fileInput" accept="image/*" hidden>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user