Skip to content

Build your personal knowledge base with Trilium Notes

feat(clipper): name the popup's capture buttons by what they capture

Elian Doranee67bbabc11f
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Web Clipper.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Web Clipper.html
index 511be550a8..405a4b8ff8 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Web Clipper.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Installation & Setup/Web Clipper.html
@@ -95,16 +95,17 @@
<p>Pages the extension cannot access (the browser's own pages, the extension
stores, and pages that were open before the extension was installed until
they are reloaded) cannot be saved or captured, so the popup says so in
- place of the preview, and only <em>Tabs</em> remains available there.</p>
+ place of the preview, and only <em>All tabs</em> remains available there.</p>
</li>
<li>
- <p>Below the preview, a row of buttons offers the other actions: <em>Crop</em> (a
- screenshot of an area you select), <em>Screenshot</em> (of the visible part
- of the page), <em>Full page</em> (a screenshot of the whole page) and <em>Tabs</em> (saves
- the links of every tab in the current window as a list of <a class="reference-link"
- href="#root/_help_UmgZAfcltxkS">Link Previews</a>, or of plain links when <em>Autogenerate link previews</em> is
- turned off). Hovering over a button shows its full name and, if it has
- one, its keyboard shortcut.</p>
+ <p>Below the preview, a row of buttons offers the other actions: <em>Area</em> (a
+ screenshot of an area you select), <em>Visible</em> (a screenshot of the
+ visible part of the page), <em>Full page</em> (a screenshot of the whole
+ page) and <em>All tabs</em> (saves the links of every tab in the current
+ window as a list of <a class="reference-link" href="#root/_help_UmgZAfcltxkS">Link Previews</a>,
+ or of plain links when <em>Autogenerate link previews</em> is turned off).
+ Hovering over a button shows its full name and, if it has one, its keyboard
+ shortcut.</p>
</li>
<li>
<p><em>Full page</em> scrolls through the page, takes a screenshot of each
@@ -129,7 +130,7 @@
for a long page or a large PDF, and the other actions wait until it is
done. The bar at the top of the popup then says, in green, that the clipping
was saved (in place of the notice that the page was already clipped), with <em>Open note</em> to
- open it in Trilium (and, after <em>Tabs</em>, <em>Close saved tabs</em>),
+ open it in Trilium (and, after <em>All tabs</em>, <em>Close saved tabs</em>),
or, in red, why it could not be saved. The same clipping cannot be saved
twice by accident: the save button stays disabled until another mode is
chosen. <em>Crop</em> is the exception: the popup closes so that an area
@@ -190,7 +191,7 @@
<ul>
<li>Save selected text: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>S</kbd>)</li>
<li>Save whole page: <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> (Mac: <kbd>⌥</kbd>+<kbd>⇧</kbd>+<kbd>S</kbd>)</li>
- <li>Save screenshot: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>E</kbd>)</li>
+ <li>Save a screenshot of an area: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>E</kbd>)</li>
<li>Save all tabs of the current window: no default shortcut, but one can
be assigned as described below.</li>
<li>Save a screenshot of the whole page: no default shortcut, but one can
diff --git a/apps/web-clipper/entrypoints/background/context_menu.ts b/apps/web-clipper/entrypoints/background/context_menu.ts
index 6eacfe9752..0465646301 100644
--- a/apps/web-clipper/entrypoints/background/context_menu.ts
+++ b/apps/web-clipper/entrypoints/background/context_menu.ts
@@ -6,7 +6,7 @@ const CONTEXT_MENU_ITEMS: Browser.contextMenus.CreateProperties[] = [
},
{
id: "trilium-save-cropped-screenshot",
- title: "Crop screenshot to Trilium",
+ title: "Save area screenshot to Trilium",
contexts: ["page"]
},
{
diff --git a/apps/web-clipper/entrypoints/popup/main.tsx b/apps/web-clipper/entrypoints/popup/main.tsx
index ca0cb0f0bc..de66673890 100644
--- a/apps/web-clipper/entrypoints/popup/main.tsx
+++ b/apps/web-clipper/entrypoints/popup/main.tsx
@@ -7,21 +7,21 @@ import Article from "@boxicons/js/icons/Article";
import Bookmark from "@boxicons/js/icons/Bookmark";
import Calendar from "@boxicons/js/icons/Calendar";
import Cog from "@boxicons/js/icons/Cog";
-import Crop from "@boxicons/js/icons/Crop";
import FileDetail from "@boxicons/js/icons/FileDetail";
+import Fullscreen from "@boxicons/js/icons/Fullscreen";
+import GalleryVertical from "@boxicons/js/icons/GalleryVertical";
import Globe from "@boxicons/js/icons/Globe";
import HelpCircle from "@boxicons/js/icons/HelpCircle";
import Highlight from "@boxicons/js/icons/Highlight";
import History from "@boxicons/js/icons/History";
-import ImagePortrait from "@boxicons/js/icons/ImagePortrait";
import InfoCircle from "@boxicons/js/icons/InfoCircle";
import Lock from "@boxicons/js/icons/Lock";
import Paperclip from "@boxicons/js/icons/Paperclip";
import RefreshCw from "@boxicons/js/icons/RefreshCw";
import Screenshot from "@boxicons/js/icons/Screenshot";
-import Tabs from "@boxicons/js/icons/Tabs";
import Unlink from "@boxicons/js/icons/Unlink";
import User from "@boxicons/js/icons/User";
+import WindowIcon from "@boxicons/js/icons/Window";
import Youtube from "@boxicons/js/icons/Youtube";
import monospaceFontUrl from "@triliumnext/client/src/fonts/JetBrainsMono-Light.woff2?url";
import type { ComponentChildren } from "preact";
@@ -331,22 +331,22 @@ function CaptureActions({ disabled, shortcuts, draft, onDraftChange, saveState,
<div className="toolbar">
<ToolbarAction
- icon={Crop} label="Crop" name="Crop screenshot"
+ icon={Screenshot} label="Area" name="Area screenshot"
shortcut={shortcuts.saveCroppedScreenshot} disabledReason={pageDisabledReason}
onClick={cropScreenshot}
/>
<ToolbarAction
- icon={Screenshot} label="Screenshot" name="Visible area screenshot"
+ icon={Fullscreen} label="Visible" name="Visible area screenshot"
disabledReason={pageDisabledReason}
onClick={() => save({ name: "save-whole-screenshot" })}
/>
<ToolbarAction
- icon={ImagePortrait} label="Full page" name="Full page screenshot"
+ icon={GalleryVertical} label="Full page" name="Full page screenshot"
shortcut={shortcuts.saveFullPageScreenshot} disabledReason={pageDisabledReason}
onClick={() => save({ name: "save-full-page-screenshot" })}
/>
<ToolbarAction
- icon={Tabs} label="Tabs" name="All tabs in window"
+ icon={WindowIcon} label="All tabs" name="All tabs in this window"
shortcut={shortcuts.saveTabs} disabledReason={disabledReason}
onClick={() => save({ name: "save-tabs" })}
/>
diff --git a/apps/web-clipper/entrypoints/popup/popup.spec.tsx b/apps/web-clipper/entrypoints/popup/popup.spec.tsx
index 53ee1013e0..613aa42c9e 100644
--- a/apps/web-clipper/entrypoints/popup/popup.spec.tsx
+++ b/apps/web-clipper/entrypoints/popup/popup.spec.tsx
@@ -106,7 +106,7 @@ describe("popup", () => {
expect(container.querySelector(".connection .status-ok")).not.toBeNull();
expect(captureButtons().every((button) => !button.disabled)).toBe(true);
expect(button("Save page to Trilium")?.title).toBe("");
- expect(button("Crop screenshot")?.title).toBe("Crop screenshot (Ctrl+Shift+E)");
+ expect(button("Area screenshot")?.title).toBe("Area screenshot (Ctrl+Shift+E)");
expect(sendMessage).toHaveBeenCalledWith({ name: "trigger-trilium-search-note-url" });
await receive({
@@ -186,7 +186,7 @@ describe("popup", () => {
});
it("sends the capture actions, closing the popup only to crop on the page", async () => {
- await click("Crop screenshot");
+ await click("Area screenshot");
expect(sendMessage).toHaveBeenCalledWith({ name: "save-cropped-screenshot" });
expect(closeWindow).toHaveBeenCalledOnce();
await click("Visible area screenshot");
@@ -196,7 +196,7 @@ describe("popup", () => {
await flush();
expect(sendMessage).toHaveBeenCalledWith({ name: "save-full-page-screenshot" });
- await click("All tabs in window");
+ await click("All tabs in this window");
await flush();
expect(sendMessage).toHaveBeenCalledWith({ name: "save-tabs" });
await click("Check the connection again");
@@ -214,10 +214,10 @@ describe("popup", () => {
expect(getAllCommands).toHaveBeenCalledOnce();
expect(shortcutOf("Save page to Trilium")).toEqual({ text: "Alt+Shift+S", keys: [ "Alt", "Shift", "S" ] });
expect(toolbar()).toEqual([
- { label: "Crop", title: "Crop screenshot (Ctrl+Shift+E)" },
- { label: "Screenshot", title: "Visible area screenshot" },
+ { label: "Area", title: "Area screenshot (Ctrl+Shift+E)" },
+ { label: "Visible", title: "Visible area screenshot" },
{ label: "Full page", title: "Full page screenshot" },
- { label: "Tabs", title: "All tabs in window" }
+ { label: "All tabs", title: "All tabs in this window" }
]);
expect(container.querySelectorAll(".toolbar-action kbd")).toHaveLength(0);
@@ -382,7 +382,7 @@ describe("popup", () => {
);
expect(container.querySelector(".page-preview")).toBeNull();
expect(captureButtons().map((action) => action.disabled)).toEqual([ true, true, true, false ]);
- expect(button("Crop screenshot")?.title).toBe(UNREACHABLE);
+ expect(button("Area screenshot")?.title).toBe(UNREACHABLE);
expect(button("Visible area screenshot")?.title).toBe(UNREACHABLE);
tabsQuery.mockResolvedValueOnce([ {} ]);
@@ -451,7 +451,7 @@ describe("popup", () => {
vi.stubGlobal("alert", alertMock);
sendMessage.mockRejectedValueOnce(new Error("Receiving end does not exist."));
- await click("All tabs in window");
+ await click("All tabs in this window");
expect(alertMock).toHaveBeenCalledWith("Calling browser runtime failed. Refreshing page might help.");
});
@@ -815,8 +815,8 @@ describe("popup", () => {
expect(fetchMock).toHaveBeenCalledWith(PDF_TAB.url, { method: "HEAD", credentials: "include" });
expect(container.querySelector(".capture-actions > .no-items")).toBeNull();
expect(modes()).toEqual([ [ "PDF", "true" ], [ "Bookmark", "false" ] ]);
- expect(button("Crop screenshot")?.disabled).toBe(true);
- expect(button("All tabs in window")?.disabled).toBe(false);
+ expect(button("Area screenshot")?.disabled).toBe(true);
+ expect(button("All tabs in this window")?.disabled).toBe(false);
sendMessage.mockResolvedValueOnce({ error: "Saving a PDF needs a newer version of Trilium." });
await click("Save PDF to Trilium");
@@ -842,14 +842,14 @@ describe("popup", () => {
expect(container.querySelector(".already-visited")).not.toBeNull();
let answerSave: (answer: unknown) => void = () => {};
sendMessage.mockReturnValueOnce(new Promise((resolve) => answerSave = resolve));
- await click("All tabs in window");
+ await click("All tabs in this window");
expect(saveStatus()).toEqual({ kind: "callout callout-info save-status", text: "Saving to Trilium…" });
expect(container.querySelector(".already-visited")).toBeNull();
expect(container.querySelector(".capture-actions .save-status")).toBeNull();
for (const action of captureButtons()) {
expect(action.disabled, action.getAttribute("aria-label") ?? "").toBe(true);
}
- expect(button("Crop screenshot")?.title).toBe("Trilium is saving the last clipping.");
+ expect(button("Area screenshot")?.title).toBe("Trilium is saving the last clipping.");
answerSave({ noteId: "n1", message: "2 links have been saved to Trilium.", tabIds: [ 7, 8 ] });
await flush();
@@ -867,7 +867,7 @@ describe("popup", () => {
await flush();
expect(saveStatus()?.text).toBe("Page has been saved to Trilium.Open note");
expect(button("Save page to Trilium")?.disabled).toBe(true);
- expect(button("All tabs in window")?.disabled).toBe(false);
+ expect(button("All tabs in this window")?.disabled).toBe(false);
await clickLink("Open note");
expect(sendMessage).toHaveBeenLastCalledWith({ name: "openNoteInTrilium", noteId: "n2" });
expect(closeWindow).toHaveBeenCalledTimes(2);
diff --git a/apps/web-clipper/wxt.config.ts b/apps/web-clipper/wxt.config.ts
index 138b69818b..5bdcf3d4ee 100644
--- a/apps/web-clipper/wxt.config.ts
+++ b/apps/web-clipper/wxt.config.ts
@@ -63,7 +63,7 @@ export default defineConfig({
}
},
saveCroppedScreenshot: {
- description: "Take a cropped screenshot of the current page",
+ description: "Take a screenshot of an area of the current page",
suggested_key: {
default: "Ctrl+Shift+E"
}
diff --git a/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md b/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md
index 8639683c6b..44fbb8da50 100644
--- a/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md
+++ b/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md
@@ -42,10 +42,10 @@ Clicking the extension's button in the browser toolbar opens its popup:
The description, marked by the <span class="tn-icon bx bx-align-left"></span> icon, comes from the page's `description` meta tag, or the one it gives social sites. It can be edited or cleared before saving, or written in when the page has none, and is saved in the `#pageDescription` label of the note. Clippings saved with the keyboard shortcuts or the context menu, screenshots and images included, get the description as the page gives it. Each clipping that brings a description updates the label. The description, the author and the dates are shown by clicking the _Web clip_ badge next to the title of the note (see <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Notes/Note%20badges.md">Note badges</a>).
The popup opens on the selection if there is one, otherwise on _Page_, showing the article, or the whole page when the page has no article. On a PDF, it opens on _PDF_. On a page that shows nothing to save, it opens on _Bookmark_ and says so. The keyboard shortcuts and the context menu still save right away, without a preview: saving the whole page that way saves the article, the whole page when the page has no article, or the PDF when the tab shows one.
-* Pages the extension cannot access (the browser's own pages, the extension stores, and pages that were open before the extension was installed until they are reloaded) cannot be saved or captured, so the popup says so in place of the preview, and only _Tabs_ remains available there.
-* Below the preview, a row of buttons offers the other actions: _Crop_ (a screenshot of an area you select), _Screenshot_ (of the visible part of the page), _Full page_ (a screenshot of the whole page) and _Tabs_ (saves the links of every tab in the current window as a list of <a class="reference-link" href="../Note%20Types/Text/Link%20Previews.md">Link Previews</a>, or of plain links when _Autogenerate link previews_ is turned off). Hovering over a button shows its full name and, if it has one, its keyboard shortcut.
+* Pages the extension cannot access (the browser's own pages, the extension stores, and pages that were open before the extension was installed until they are reloaded) cannot be saved or captured, so the popup says so in place of the preview, and only _All tabs_ remains available there.
+* Below the preview, a row of buttons offers the other actions: _Area_ (a screenshot of an area you select), _Visible_ (a screenshot of the visible part of the page), _Full page_ (a screenshot of the whole page) and _All tabs_ (saves the links of every tab in the current window as a list of <a class="reference-link" href="../Note%20Types/Text/Link%20Previews.md">Link Previews</a>, or of plain links when _Autogenerate link previews_ is turned off). Hovering over a button shows its full name and, if it has one, its keyboard shortcut.
* _Full page_ scrolls through the page, takes a screenshot of each part and joins them into one image, then scrolls back to where the page was. The scrollbars are hidden while it does, so they do not appear in the image. Stay on the tab until it is saved: switching to another tab stops the screenshot. A header that stays at the top of the window appears once, at the top of the image, and headings that stick while scrolling appear where they are in the page. Other elements that stay in place while scrolling (such as cookie banners and chat buttons) are left out, while a background that fills the whole window repeats on every screen. In Firefox, the page is captured without scrolling through it, which is faster: such a background then appears only at the top, and images that the page loads only once they are scrolled into view can be missing. A long page is saved as several images, one below the other in the note. A page longer than 100 screens is cut off there, and the message after saving says so. Screenshots keep their full height in Trilium: _Resize image_ (under _Automatically compress images_ in Options → Media) limits only their width.
-* The popup stays open while Trilium saves, which can take a few seconds for a long page or a large PDF, and the other actions wait until it is done. The bar at the top of the popup then says, in green, that the clipping was saved (in place of the notice that the page was already clipped), with _Open note_ to open it in Trilium (and, after _Tabs_, _Close saved tabs_), or, in red, why it could not be saved. The same clipping cannot be saved twice by accident: the save button stays disabled until another mode is chosen. _Crop_ is the exception: the popup closes so that an area of the page can be selected, and the notification on the page reports the outcome.
+* The popup stays open while Trilium saves, which can take a few seconds for a long page or a large PDF, and the other actions wait until it is done. The bar at the top of the popup then says, in green, that the clipping was saved (in place of the notice that the page was already clipped), with _Open note_ to open it in Trilium (and, after _All tabs_, _Close saved tabs_), or, in red, why it could not be saved. The same clipping cannot be saved twice by accident: the save button stays disabled until another mode is chosen. _Crop_ is the exception: the popup closes so that an area of the page can be selected, and the notification on the page reports the outcome.
* If the current page was already clipped, a notice at the top offers to open the note in Trilium.
* If Trilium cannot be found, the popup explains why instead of showing the actions, with buttons to look for Trilium again and to open the options.
* The bottom of the popup shows whether the extension is connected to Trilium, as a colored dot (green when connected, amber when the versions are not compatible, red when Trilium was not found) next to a description of the connection, followed by the buttons for the extension's options and for this help page. A button to check the connection again appears next to them when hovering over the bar, and stays visible while Trilium cannot be reached or is not compatible.
@@ -79,7 +79,7 @@ Keyboard shortcuts are available for most functions:
* Save selected text: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>S</kbd>)
* Save whole page: <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> (Mac: <kbd>⌥</kbd>+<kbd>⇧</kbd>+<kbd>S</kbd>)
-* Save screenshot: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>E</kbd>)
+* Save a screenshot of an area: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> (Mac: <kbd>⌘</kbd>+<kbd>⇧</kbd>+<kbd>E</kbd>)
* Save all tabs of the current window: no default shortcut, but one can be assigned as described below.
* Save a screenshot of the whole page: no default shortcut, but one can be assigned as described below.