Fixed SD RPG

This commit is contained in:
2026-06-04 08:05:06 +03:00
parent d4cd8f02f4
commit 6189a5fb74
62 changed files with 6969 additions and 552 deletions
+21 -1
View File
@@ -6,12 +6,32 @@ export function parseImagePromptFromContent(content) {
return { text, prompt };
}
export function splitSdPromptForCopy(fullPrompt) {
if (!fullPrompt) return '';
const marker = '\n\nNegative prompt:';
const i = fullPrompt.indexOf(marker);
return (i >= 0 ? fullPrompt.slice(0, i) : fullPrompt).trim();
}
export async function copyToClipboard(text) {
if (!text) return false;
try {
await navigator.clipboard.writeText(text);
return true;
} catch {
return false;
try {
const ta = document.createElement('textarea');
ta.value = text;
ta.setAttribute('readonly', '');
ta.style.cssText = 'position:fixed;left:-9999px;top:0';
document.body.appendChild(ta);
ta.select();
const ok = document.execCommand('copy');
document.body.removeChild(ta);
return ok;
} catch {
return false;
}
}
}