Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/chrome-extension/src/entrypoints/sidepanel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
</div>
<div class="controls">
<div id="summarizeControlRoot" class="summarizeControlRoot"></div>
<button id="copySummary" type="button" class="ghost icon" aria-label="Copy summary" hidden>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path
d="M16 1H4C2.9 1 2 1.9 2 3v14h2V3h12V1zm3 4H8C6.9 5 6 5.9 6 7v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
/>
</svg>
</button>
<button id="drawerToggle" type="button" class="ghost icon" aria-label="Settings">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path
Expand Down
11 changes: 11 additions & 0 deletions apps/chrome-extension/src/entrypoints/sidepanel/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const chatDockEl = byId<HTMLDivElement>("chatDock");
const slideImageLoader = createSlideImageLoader();

const summarizeControlRoot = byId<HTMLElement>("summarizeControlRoot");
const copySummaryBtn = byId<HTMLButtonElement>("copySummary");
const drawerToggleBtn = byId<HTMLButtonElement>("drawerToggle");
const refreshBtn = byId<HTMLButtonElement>("refresh");
const clearBtn = byId<HTMLButtonElement>("clear");
Expand Down Expand Up @@ -1075,6 +1076,7 @@ function resetSummaryView({
clearSlideGallery(renderSlidesHostEl);
clearMetricsForMode("summary");
panelState.summaryMarkdown = null;
copySummaryBtn.hidden = true;
panelState.summaryFromCache = null;
panelState.slides = null;
if (clearRunId) {
Expand Down Expand Up @@ -1254,6 +1256,7 @@ function renderMarkdownDisplay() {

function renderMarkdown(markdown: string) {
panelState.summaryMarkdown = markdown;
copySummaryBtn.hidden = !markdown;
updateSlideSummaryFromMarkdown(markdown, {
preserveIfEmpty: slideSummaryByIndex.size > 0,
source: "summary",
Expand Down Expand Up @@ -4163,6 +4166,14 @@ refreshBtn.addEventListener("click", () => sendSummarize({ refresh: true }));
clearBtn.addEventListener("click", () => {
void clearCurrentView();
});
copySummaryBtn.addEventListener("click", () => {
const md = panelState.summaryMarkdown;
if (!md) return;
void navigator.clipboard.writeText(md).then(() => {
headerController.setStatus("Copied");
setTimeout(() => headerController.setStatus(panelState.ui?.status ?? ""), 800);
});
});
drawerToggleBtn.addEventListener("click", () => toggleDrawer());
advancedBtn.addEventListener("click", () => {
void send({ type: "panel:openOptions" });
Expand Down