@@ -27,12 +27,14 @@ function Tooltip(props, ...children) {
$tooltip.show = (x, y) => {
const $notionApp = document.querySelector(notionApp);
if (!document.contains($tooltip)) $notionApp?.append($tooltip);
+ if ($tooltip.hasAttribute("open")) return;
requestAnimationFrame(() => {
+ $tooltip.onbeforeshow?.();
$tooltip.setAttribute("open", true);
- x -= $tooltip.clientWidth + 6;
- if (x < 0) x += $tooltip.clientWidth + 12;
+ x -= $tooltip.clientWidth;
+ if (x < 0) x = $tooltip.clientWidth + 12;
y -= $tooltip.clientHeight / 2;
- if (y < 0) y += $tooltip.clientHeight / 2;
+ if (y < 0) y = $tooltip.clientHeight + 12;
$tooltip.style.left = `${x}px`;
$tooltip.style.top = `${y}px`;
$tooltip.onshow?.();
@@ -45,6 +47,16 @@ function Tooltip(props, ...children) {
$tooltip.onhide?.();
}, 200);
};
+ $tooltip.attach = ($target, calcPos) => {
+ $target.addEventListener("mouseover", (event) => {
+ setTimeout(() => {
+ if (!$target.matches(":hover")) return;
+ const { x = event.clientX, y = event.clientY } = calcPos?.(event) ?? {};
+ $tooltip.show(x, y);
+ }, 200);
+ });
+ $target.addEventListener("mouseout", $tooltip.hide);
+ };
return $tooltip;
}
diff --git a/src/core/islands/TopbarButton.mjs b/src/core/islands/TopbarButton.mjs
index 6f4cd95..537d006 100644
--- a/src/core/islands/TopbarButton.mjs
+++ b/src/core/islands/TopbarButton.mjs
@@ -4,8 +4,8 @@
* (https://notion-enhancer.github.io/) under the MIT license
*/
-function TopbarButton({ icon, ...props }, ...children) {
- const { html, extendProps } = globalThis.__enhancerApi;
+function TopbarButton({ icon, ...props }) {
+ const { html, extendProps, addMutationListener } = globalThis.__enhancerApi;
extendProps(props, {
tabindex: 0,
role: "button",
@@ -15,12 +15,23 @@ function TopbarButton({ icon, ...props }, ...children) {
rounded-[3px] hover:bg-[color:var(--theme--bg-hover)]
&[data-active]:bg-[color:var(--theme--bg-hover)]`,
});
- return html`
`;
+
+ const notionTopbar = ".notion-topbar-favorite-button",
+ $button = html`
`,
+ addToTopbar = () => {
+ if (document.contains($button)) return;
+ document.querySelector(notionTopbar)?.after($button);
+ };
+ $button.addToTopbar = () => {
+ addToTopbar();
+ addMutationListener(notionTopbar, addToTopbar);
+ };
+ return $button;
}
export { TopbarButton };
diff --git a/src/core/menu/islands/Input.mjs b/src/core/menu/islands/Input.mjs
index 8154551..c12b61e 100644
--- a/src/core/menu/islands/Input.mjs
+++ b/src/core/menu/islands/Input.mjs
@@ -22,6 +22,7 @@ const updateHotkey = (event) => {
if (key === " ") key = "Space";
if (["+", "="].includes(key)) key = "Plus";
if (key === "-") key = "Minus";
+ if (key === "|") key = "\\";
if (event.code === "Comma") key = ",";
if (event.code === "Period") key = ".";
if (key === "Control") key = "Ctrl";
diff --git a/src/core/mod.json b/src/core/mod.json
index 867d33d..506491b 100644
--- a/src/core/mod.json
+++ b/src/core/mod.json
@@ -24,25 +24,25 @@
},
{
"type": "hotkey",
- "key": "toggleWindowHotkey",
- "description": "Toggles focus of the Notion window anywhere, even when your Notion app isn't active.",
- "value": "Ctrl+Shift+A"
+ "key": "togglePanelHotkey",
+ "description": "Toggles the side panel used by some notion-enhancer extensions to display additional information and interfaces within the Notion app.",
+ "value": "Ctrl+Shift+\\"
},
{
"type": "hotkey",
- "key": "togglePanelHotkey",
- "description": "Toggles the side panel used by some notion-enhancer extensions to display additional information and interfaces within the Notion app.",
- "value": "Ctrl+Shift+|"
+ "key": "toggleWindowHotkey",
+ "description": "Toggles focus of the Notion window anywhere, even when your Notion app isn't active.",
+ "value": "Ctrl+Shift+A"
},
{
"type": "heading",
"label": "Appearance"
},
{
- "type": "select",
- "key": "menuButtonIconStyle",
- "description": "Sets whether the notion-enhancer icon added to Notion's sidebar should be coloured or monochrome. The latter style will match the theme's icon colour for users who would like the icon to be less noticeable.",
- "values": ["Colour", "Monochrome"]
+ "type": "file",
+ "key": "customStyles",
+ "description": "Adds the styles from an uploaded .css file to Notion. Use this if you would like to customise the current theme or
otherwise tweak Notion's appearance.",
+ "extensions": ["css"]
},
{
"type": "select",
@@ -51,10 +51,10 @@
"values": ["Auto", "Enabled", "Disabled"]
},
{
- "type": "file",
- "key": "customStyles",
- "description": "Adds the styles from an uploaded .css file to Notion. Use this if you would like to customise the current theme or
otherwise tweak Notion's appearance.",
- "extensions": ["css"]
+ "type": "select",
+ "key": "menuButtonIconStyle",
+ "description": "Sets whether the notion-enhancer icon added to Notion's sidebar should be coloured or monochrome. The latter style will match the theme's icon colour for users who would like the icon to be less noticeable.",
+ "values": ["Colour", "Monochrome"]
},
{
"type": "heading",
@@ -66,7 +66,7 @@
"key": "developerMode",
"description": "Activates built-in debugging tools accessible through the application menu.",
"platforms": ["linux", "win32", "darwin"],
- "value": false
+ "value": true
}
],
"clientStyles": ["variables.css"],