17 lines
538 B
JavaScript
17 lines
538 B
JavaScript
export function parseImagePromptFromContent(content) {
|
|
if (!content || !content.includes('[IMAGE_PROMPT:')) return { text: content, prompt: null };
|
|
const match = content.match(/\[IMAGE_PROMPT:(.*?)\]/s);
|
|
const prompt = match ? match[1].trim() : null;
|
|
const text = content.replace(/\[IMAGE_PROMPT:.*?\]/gs, '').trim();
|
|
return { text, prompt };
|
|
}
|
|
|
|
export async function copyToClipboard(text) {
|
|
try {
|
|
await navigator.clipboard.writeText(text);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|