Skip to content

Build your personal knowledge base with Trilium Notes

feat(web-clipper): drop the popup's header, move its buttons to the footer

Elian Doran9777f7737606
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 cb6c6acfab..943c524bdb 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
@@ -30,7 +30,6 @@
<h2>The popup</h2>
<p>Clicking the extension's button in the browser toolbar opens its popup:</p>
<ul>
- <li>The header has buttons for the extension's options and for this help page.</li>
<li>The popup reads the current page as an article and shows a preview of
what will be saved: the note's title, which can be edited before saving,
the website and the publication date (when the page states one), and the
@@ -54,8 +53,10 @@
<li>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. A button to check the connection again appears when hovering
- over it, and stays visible while Trilium cannot be reached or is not compatible.</li>
+ 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.</li>
</ul>
<h2>Location of clippings</h2>
<p>Trilium will save these clippings as a new child note under a "clipper
diff --git a/apps/web-clipper/entrypoints/popup/main.tsx b/apps/web-clipper/entrypoints/popup/main.tsx
index eb5b2379e6..ab6c86c418 100644
--- a/apps/web-clipper/entrypoints/popup/main.tsx
+++ b/apps/web-clipper/entrypoints/popup/main.tsx
@@ -102,20 +102,6 @@ export function Popup() {
return (
<div className="popup">
- <div className="popup-header">
- <img className="logo" src="/icons/48.png" alt="" />
- <h3>Trilium Web Clipper</h3>
-
- <div className="popup-header-buttons">
- <button className="icon-action" title="Options" aria-label="Options" onClick={() => browser.runtime.openOptionsPage()}>
- <Icon icon={Cog} />
- </button>
- <button className="icon-action" title="Help" aria-label="Help" onClick={() => window.open(HELP_URL, "_blank")}>
- <Icon icon={HelpCircle} />
- </button>
- </div>
- </div>
-
{clippedNoteId && (
<div className="callout callout-info already-visited">
<span>Web page already clipped.</span>
@@ -146,13 +132,20 @@ export function Popup() {
</span>
<button
- className="icon-action"
+ className="icon-action refresh"
title="Check the connection again"
aria-label="Check the connection again"
onClick={() => sendMessage({ name: "trigger-trilium-search" })}
>
<Icon icon={RefreshCw} />
</button>
+
+ <button className="icon-action" title="Options" aria-label="Options" onClick={() => browser.runtime.openOptionsPage()}>
+ <Icon icon={Cog} />
+ </button>
+ <button className="icon-action" title="Help" aria-label="Help" onClick={() => window.open(HELP_URL, "_blank")}>
+ <Icon icon={HelpCircle} />
+ </button>
</div>
</div>
);
diff --git a/apps/web-clipper/entrypoints/popup/popup.css b/apps/web-clipper/entrypoints/popup/popup.css
index c69ce17266..e2a953acfa 100644
--- a/apps/web-clipper/entrypoints/popup/popup.css
+++ b/apps/web-clipper/entrypoints/popup/popup.css
@@ -8,28 +8,6 @@ body {
gap: 12px;
padding: 12px;
- .popup-header {
- display: flex;
- align-items: center;
- gap: 8px;
-
- .logo {
- width: 24px;
- height: 24px;
- }
-
- h3 {
- margin: 0;
- font-size: 1.1em;
- }
- }
-
- .popup-header-buttons {
- display: flex;
- gap: 2px;
- margin-inline-start: auto;
- }
-
.callout {
padding: 8px 10px;
border-radius: 6px;
@@ -248,8 +226,7 @@ body {
.connection {
display: flex;
align-items: center;
- justify-content: space-between;
- gap: 8px;
+ gap: 2px;
min-height: 26px;
margin: 0 -12px -12px;
padding: 4px 12px;
@@ -263,6 +240,7 @@ body {
align-items: center;
gap: 6px;
min-width: 0;
+ margin-inline-end: auto;
}
.status-dot {
@@ -289,11 +267,11 @@ body {
background: var(--status-error-color);
}
- .icon-action {
+ .refresh {
transition: opacity 150ms ease-out;
}
- &:has(.status-ok, .status-pending):not(:hover, :focus-within) .icon-action {
+ &:has(.status-ok, .status-pending):not(:hover, :focus-within) .refresh {
opacity: 0;
}
}
diff --git a/apps/web-clipper/entrypoints/popup/popup.spec.tsx b/apps/web-clipper/entrypoints/popup/popup.spec.tsx
index df46141306..821c96de31 100644
--- a/apps/web-clipper/entrypoints/popup/popup.spec.tsx
+++ b/apps/web-clipper/entrypoints/popup/popup.spec.tsx
@@ -58,7 +58,9 @@ describe("popup", () => {
expect(sendMessage).toHaveBeenCalledWith({ name: "send-trilium-search-status" });
expect(status()).toEqual({ dot: "status-dot status-dot-pending", text: "Looking for Trilium…" });
expect(captureButtons()).toHaveLength(5);
- expect(container.querySelector(".popup-header .status-dot")).toBeNull();
+ expect(container.querySelector(".popup-header")).toBeNull();
+ expect([ ...container.querySelectorAll(".connection button") ].map((b) => b.getAttribute("aria-label")))
+ .toEqual([ "Check the connection again", "Options", "Help" ]);
expect(captureButtons().every((button) => !button.disabled)).toBe(true);
await receive({ name: "trilium-search-status", triliumSearch: { status: "found-desktop", port: 37840, url: "" } });
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 dc5fddd0f3..2e01b4ec40 100644
--- a/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md
+++ b/docs/User Guide/User Guide/Installation & Setup/Web Clipper.md
@@ -29,13 +29,12 @@ The extension is available from the official browser web stores:
Clicking the extension's button in the browser toolbar opens its popup:
-* The header has buttons for the extension's options and for this help page.
* The popup reads the current page as an article and shows a preview of what will be saved: the note's title, which can be edited before saving, the website and the publication date (when the page states one), and the article's text and images. _Save page to Trilium_ saves it. Pages the extension cannot read, such as the browser's own pages, say so instead. The keyboard shortcut and the context menu still save the page right away, without a preview.
* 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), _Note_ (a link with a note) and _Tabs_ (saves the links of every tab in the current window as a list). Hovering over a button shows its full name and, if it has one, its keyboard shortcut.
* _Note_ opens a small editor in place of the actions. The first sentence or line of the text becomes the note's title, unless _Keep page title as note title_ is checked. Press _Save_ or <kbd>Ctrl</kbd>+<kbd>Enter</kbd> to save it, or the back arrow to return to the actions.
* 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. A button to check the connection again appears when hovering over it, and stays visible while Trilium cannot be reached or is not compatible.
+* 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.
## Location of clippings