Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(extension): keep clip commands on the top-level menu

tianma-if7ed8f11f050b
diff --git a/apps/extension/README.md b/apps/extension/README.md
index c22ff04f..1345e1aa 100644
--- a/apps/extension/README.md
+++ b/apps/extension/README.md
@@ -10,7 +10,7 @@ Chrome, Edge, and Firefox Manifest V3 extension for saving the current webpage,
- Convert the extracted article HTML into Markdown with Turndown before uploading it.
- Right-click an image and choose **Save image to EdgeEver**. The image file is uploaded into a new note in the default notebook, with the source page linked underneath.
- Select text on a page, right-click, and choose **Save selection to EdgeEver**. That passage is saved as a new note in the default notebook, with the source page linked underneath. The rest of the page is not included.
-- On X, right-click a post and choose **Save this post to EdgeEver**. The post text, author, time, and photos already shown in that post are saved into one note. Text folded behind Show more is expanded first, so a long post is saved in full. A single-post page can be saved immediately. On a timeline, the extension asks once for access to X so it can remember the post under the pointer.
+- On X, right-click the post text and choose **Save this post to EdgeEver**. The post text, author, time, and photos already shown in that post are saved into one note. Text folded behind Show more is expanded first, so a long post is saved in full. Right-clicking a photo saves that image instead, so the command stays on the top-level menu. A single-post page can be saved immediately. On a timeline, the extension asks once for access to X so it can remember the post under the pointer.
- When the page cannot hand over the image bytes, the extension asks once for access to that image's site. After that, later images from the same site save directly.
- Create a searchable EdgeEver memo with the source URL and a `web-clip` tag.
diff --git a/apps/extension/src/background.ts b/apps/extension/src/background.ts
index 3a6457b7..8b428040 100644
--- a/apps/extension/src/background.ts
+++ b/apps/extension/src/background.ts
@@ -695,6 +695,18 @@ const saveSelectionFromMenu = async (
};
const registerClipMenus = () => {
+ // Chrome and Firefox fold an extension into a submenu when more than one of
+ // its items is visible. These contexts stay disjoint so each command remains
+ // on the top-level menu: a photo saves the image, selected words save the
+ // passage, and the rest of an X post saves the post. Recreate from scratch
+ // so a previous registration cannot keep an overlapping item.
+ chrome.contextMenus.removeAll(() => {
+ void chrome.runtime.lastError;
+ createClipMenus();
+ });
+};
+
+const createClipMenus = () => {
chrome.contextMenus.create({
id: SELECTION_MENU_ID,
title: t("saveSelectionToEdgeEver"),
@@ -714,7 +726,7 @@ const registerClipMenus = () => {
chrome.contextMenus.create({
id: TWEET_MENU_ID,
title: t("saveTweetToEdgeEver"),
- contexts: ["page", "selection", "link", "image", "video"],
+ contexts: ["page", "video"],
documentUrlPatterns: TWEET_DOCUMENT_PATTERNS,
}, () => {
void chrome.runtime.lastError;