Unverified Commit ee2f4fb9 authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge pull request #10615 from missionfloyd/text-drag-fix

Fix dragging text to prompt
parents 3366e494 8137bdba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ function dropReplaceImage(imgWrap, files) {
window.document.addEventListener('dragover', e => {
    const target = e.composedPath()[0];
    const imgWrap = target.closest('[data-testid="image"]');
    if (!imgWrap && target.placeholder && target.placeholder.indexOf("Prompt") == -1) {
    if (e.dataTransfer.files.length == 0 || (!imgWrap && target.placeholder && target.placeholder.indexOf("Prompt") == -1)) {
        return;
    }
    e.stopPropagation();
@@ -61,7 +61,7 @@ window.document.addEventListener('dragover', e => {

window.document.addEventListener('drop', e => {
    const target = e.composedPath()[0];
    if (target.placeholder.indexOf("Prompt") == -1) {
    if (e.dataTransfer.files.length == 0 || target.placeholder.indexOf("Prompt") == -1) {
        return;
    }
    const imgWrap = target.closest('[data-testid="image"]');
+1 −1
Original line number Diff line number Diff line
window.onload = (function() {
    window.addEventListener('drop', e => {
        const target = e.composedPath()[0];
        if (target.placeholder.indexOf("Prompt") == -1) return;
        if (e.dataTransfer.files.length == 0 || target.placeholder.indexOf("Prompt") == -1) return;

        let prompt_target = get_tab_index('tabs') == 1 ? "img2img_prompt_image" : "txt2img_prompt_image";