mirror of
https://github.com/f/awesome-chatgpt-prompts.git
synced 2025-06-22 15:35:04 +00:00
update
This commit is contained in:
parent
a8a69caf76
commit
eee62fe478
@ -30,8 +30,19 @@
|
||||
<body class="bg-dynamic-background text-dynamic-foreground overflow-hidden">
|
||||
<!-- Viewer Mode -->
|
||||
<div id="viewer-mode" class="viewer-mode h-screen flex flex-col p-2 sm:p-4">
|
||||
<!-- Top Bar with Context Pills and Edit Button -->
|
||||
<div class="flex justify-between items-start gap-2 mb-0 sm:mb-2">
|
||||
<!-- Context Pills -->
|
||||
<div id="context-pills" class="flex overflow-x-auto gap-2 empty:hidden mb-0 sm:mb-2 pb-1 scrollbar-hide"></div>
|
||||
<div id="context-pills" class="flex overflow-x-auto gap-2 empty:hidden pb-1 scrollbar-hide flex-1"></div>
|
||||
|
||||
<!-- Edit Button -->
|
||||
<button id="edit-button" class="p-1 text-dynamic-muted-foreground hover:text-dynamic-foreground transition-colors" title="Edit in designer">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
||||
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Main Prompt Interface - Full Height -->
|
||||
<div class="flex-1 flex flex-col">
|
||||
|
@ -177,6 +177,11 @@ class EmbedPreview {
|
||||
if (copyButton) {
|
||||
copyButton.addEventListener('click', () => this.handleCopy());
|
||||
}
|
||||
|
||||
const editButton = document.getElementById('edit-button');
|
||||
if (editButton) {
|
||||
editButton.addEventListener('click', () => this.handleEdit());
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -353,6 +358,30 @@ class EmbedPreview {
|
||||
this.showNotification('Prompt copied to clipboard!');
|
||||
}
|
||||
|
||||
handleEdit() {
|
||||
// Get current query string
|
||||
const queryString = window.location.search;
|
||||
|
||||
// Get current URL path parts
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
|
||||
// Find index of 'embed-preview' and replace with 'embed'
|
||||
const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview');
|
||||
if (embedPreviewIndex !== -1) {
|
||||
pathParts[embedPreviewIndex] = 'embed';
|
||||
} else {
|
||||
// Fallback: just append /embed/ if embed-preview not found
|
||||
pathParts.push('embed');
|
||||
}
|
||||
|
||||
// Construct new URL
|
||||
const newPath = pathParts.join('/');
|
||||
const newUrl = window.location.origin + newPath + queryString;
|
||||
|
||||
// Open in new tab
|
||||
window.open(newUrl, '_blank');
|
||||
}
|
||||
|
||||
async copyToClipboard(text) {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await navigator.clipboard.writeText(text);
|
||||
|
@ -30,8 +30,19 @@
|
||||
<body class="bg-dynamic-background text-dynamic-foreground overflow-hidden">
|
||||
<!-- Viewer Mode -->
|
||||
<div id="viewer-mode" class="viewer-mode h-screen flex flex-col p-2 sm:p-4">
|
||||
<!-- Top Bar with Context Pills and Edit Button -->
|
||||
<div class="flex justify-between items-start gap-2 mb-0 sm:mb-2">
|
||||
<!-- Context Pills -->
|
||||
<div id="context-pills" class="flex overflow-x-auto gap-2 empty:hidden mb-0 sm:mb-2 pb-1 scrollbar-hide"></div>
|
||||
<div id="context-pills" class="flex overflow-x-auto gap-2 empty:hidden pb-1 scrollbar-hide flex-1"></div>
|
||||
|
||||
<!-- Edit Button -->
|
||||
<button id="edit-button" class="p-1 text-dynamic-muted-foreground hover:text-dynamic-foreground transition-colors" title="Edit in designer">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
|
||||
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Main Prompt Interface - Full Height -->
|
||||
<div class="flex-1 flex flex-col">
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/style.css?v=6eaf839c38bd08d088d00ca61df334cd3fba3890">
|
||||
<link rel="stylesheet" href="/style.css?v=a8a69caf7649bb8f02c225029af543967973a65f">
|
||||
</head>
|
||||
<body class="">
|
||||
<div class="layout-wrapper">
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/style.css?v=6eaf839c38bd08d088d00ca61df334cd3fba3890">
|
||||
<link rel="stylesheet" href="/style.css?v=a8a69caf7649bb8f02c225029af543967973a65f">
|
||||
</head>
|
||||
<body class="vibe">
|
||||
<div class="layout-wrapper">
|
||||
|
@ -177,6 +177,11 @@ class EmbedPreview {
|
||||
if (copyButton) {
|
||||
copyButton.addEventListener('click', () => this.handleCopy());
|
||||
}
|
||||
|
||||
const editButton = document.getElementById('edit-button');
|
||||
if (editButton) {
|
||||
editButton.addEventListener('click', () => this.handleEdit());
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -353,6 +358,30 @@ class EmbedPreview {
|
||||
this.showNotification('Prompt copied to clipboard!');
|
||||
}
|
||||
|
||||
handleEdit() {
|
||||
// Get current query string
|
||||
const queryString = window.location.search;
|
||||
|
||||
// Get current URL path parts
|
||||
const pathParts = window.location.pathname.split('/');
|
||||
|
||||
// Find index of 'embed-preview' and replace with 'embed'
|
||||
const embedPreviewIndex = pathParts.findIndex(part => part === 'embed-preview');
|
||||
if (embedPreviewIndex !== -1) {
|
||||
pathParts[embedPreviewIndex] = 'embed';
|
||||
} else {
|
||||
// Fallback: just append /embed/ if embed-preview not found
|
||||
pathParts.push('embed');
|
||||
}
|
||||
|
||||
// Construct new URL
|
||||
const newPath = pathParts.join('/');
|
||||
const newUrl = window.location.origin + newPath + queryString;
|
||||
|
||||
// Open in new tab
|
||||
window.open(newUrl, '_blank');
|
||||
}
|
||||
|
||||
async copyToClipboard(text) {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await navigator.clipboard.writeText(text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user