mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-10 15:39:01 +00:00
remove extension menu hotkey conflict + make configurable
This commit is contained in:
parent
648c1f8b99
commit
e158cc25b3
@ -5,6 +5,7 @@
|
|||||||
- [groupy-like tabbing](https://www.npmjs.com/package/electron-tabs)
|
- [groupy-like tabbing](https://www.npmjs.com/package/electron-tabs)
|
||||||
- [improved responsiveness](https://chrome.google.com/webstore/detail/notion%20%20-responsiveness-f/leadcilhbmibbkgbnjgmmnfgnnhmeddk)
|
- [improved responsiveness](https://chrome.google.com/webstore/detail/notion%20%20-responsiveness-f/leadcilhbmibbkgbnjgmmnfgnnhmeddk)
|
||||||
- [highlight/mark viewer](https://chrome.google.com/webstore/detail/notion%2B-mark-manager/hipgmnlpnimedfepbfbfiaobohhffcfc)
|
- [highlight/mark viewer](https://chrome.google.com/webstore/detail/notion%2B-mark-manager/hipgmnlpnimedfepbfbfiaobohhffcfc)
|
||||||
|
- [advanced math editor](https://github.com/Manueloccorso/NotionMathEditor_BrowserExtension)
|
||||||
|
|
||||||
### v0.9.0 (wip)
|
### v0.9.0 (wip)
|
||||||
|
|
||||||
@ -21,14 +22,14 @@ a feature and cleanup update.
|
|||||||
- themes: "littlepig" (light + dark) = monospaced themes using emojis and colourful text.
|
- themes: "littlepig" (light + dark) = monospaced themes using emojis and colourful text.
|
||||||
- extension: "font chooser" = customize fonts. for each option, type in the name of the font you would like to use,
|
- extension: "font chooser" = customize fonts. for each option, type in the name of the font you would like to use,
|
||||||
or leave it blank to not change anything.
|
or leave it blank to not change anything.
|
||||||
|
- bugfix: made the open enhancements menu hotkey configurable and changed the default to `alt + e`
|
||||||
|
to remove conflict with the inline code highlight shortcut.
|
||||||
|
|
||||||
// todo
|
// todo
|
||||||
|
|
||||||
- improved: added individual text-colour rules for different background colours.
|
- improved: added individual text-colour rules for different background colours.
|
||||||
- improved: added variables for callout colouring.
|
- improved: added variables for callout colouring.
|
||||||
- improved: tiling window-manager support (can hide titlebars entirely without dragarea/buttons).
|
- improved: tiling window-manager support (can hide titlebars entirely without dragarea/buttons).
|
||||||
- bugfix: made the open enhancements menu hotkey configurable and changed the default to `option/alt + e`
|
|
||||||
to remove conflict with the inline code highlight shortcut.
|
|
||||||
- bugfix: block-level text colours are now changed properly.
|
- bugfix: block-level text colours are now changed properly.
|
||||||
- bugfix: update property-layout to match notion changes again.
|
- bugfix: update property-layout to match notion changes again.
|
||||||
- extension: "calendar scroll" = a button to scroll down to the current week for you.
|
- extension: "calendar scroll" = a button to scroll down to the current week for you.
|
||||||
|
@ -46,7 +46,7 @@ page and the [css theming documentation](DOCUMENTATION.md#variable-theming).
|
|||||||
"how can I set a custom window visibility toggle hotkey?"
|
"how can I set a custom window visibility toggle hotkey?"
|
||||||
|
|
||||||
these options and more have been moved to the graphical menu, which can be opened from the
|
these options and more have been moved to the graphical menu, which can be opened from the
|
||||||
tray or with `CMD/CTRL+E` (while the notion app is focused).
|
tray or with `ALT+E` (while the notion app is focused).
|
||||||
|
|
||||||
## installing
|
## installing
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ module.exports = (store, __exports) => {
|
|||||||
// additional hotkeys
|
// additional hotkeys
|
||||||
document.defaultView.addEventListener('keyup', (event) => {
|
document.defaultView.addEventListener('keyup', (event) => {
|
||||||
if (event.code === 'F5') location.reload();
|
if (event.code === 'F5') location.reload();
|
||||||
if (event.key === 'e' && (event.ctrlKey || event.metaKey))
|
|
||||||
electron.ipcRenderer.send('enhancer:open-extension-menu');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const attempt_interval = setInterval(enhance, 500);
|
const attempt_interval = setInterval(enhance, 500);
|
||||||
|
@ -19,7 +19,6 @@ window['__start'] = async () => {
|
|||||||
|
|
||||||
document.defaultView.addEventListener('keyup', (event) => {
|
document.defaultView.addEventListener('keyup', (event) => {
|
||||||
if (event.code === 'F5') location.reload();
|
if (event.code === 'F5') location.reload();
|
||||||
if ((event.ctrlKey || event.metaKey) && event.key === 'e') browser.close();
|
|
||||||
if (!(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey) {
|
if (!(event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey) {
|
||||||
if (
|
if (
|
||||||
document.activeElement.parentElement.id === 'tags' &&
|
document.activeElement.parentElement.id === 'tags' &&
|
||||||
@ -458,6 +457,7 @@ window['__start'] = async () => {
|
|||||||
$opt
|
$opt
|
||||||
.querySelector(`#${opt.type}_${mod.id}--${opt.key}`)
|
.querySelector(`#${opt.type}_${mod.id}--${opt.key}`)
|
||||||
.addEventListener('change', (event) => {
|
.addEventListener('change', (event) => {
|
||||||
|
modified();
|
||||||
if (opt.type === 'toggle') {
|
if (opt.type === 'toggle') {
|
||||||
store(mod.id)[opt.key] = event.target.checked;
|
store(mod.id)[opt.key] = event.target.checked;
|
||||||
} else if (opt.type === 'file') {
|
} else if (opt.type === 'file') {
|
||||||
@ -469,9 +469,8 @@ window['__start'] = async () => {
|
|||||||
} else
|
} else
|
||||||
store(mod.id)[opt.key] =
|
store(mod.id)[opt.key] =
|
||||||
typeof opt.value === 'number'
|
typeof opt.value === 'number'
|
||||||
? Number(event.target.value)
|
? +event.target.value
|
||||||
: event.target.value;
|
: event.target.value;
|
||||||
modified();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$options.appendChild($opt);
|
$options.appendChild($opt);
|
||||||
|
@ -56,6 +56,12 @@ module.exports = {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
value: 'CommandOrControl+Shift+A',
|
value: 'CommandOrControl+Shift+A',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'menu_toggle',
|
||||||
|
label: 'open enhancements menu hotkey:',
|
||||||
|
type: 'input',
|
||||||
|
value: 'Alt+E',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
hacks: {
|
hacks: {
|
||||||
'main/main.js': require('./tray.js'),
|
'main/main.js': require('./tray.js'),
|
||||||
|
@ -40,7 +40,6 @@ module.exports = (store, __exports) => {
|
|||||||
webContents.send('enhancer:get-theme-vars', arg)
|
webContents.send('enhancer:get-theme-vars', arg)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
electron.ipcMain.on('enhancer:open-extension-menu', openExtensionMenu);
|
|
||||||
|
|
||||||
function calculateWindowPos(width, height) {
|
function calculateWindowPos(width, height) {
|
||||||
const screen = electron.screen.getDisplayNearestPoint({
|
const screen = electron.screen.getDisplayNearestPoint({
|
||||||
@ -157,7 +156,7 @@ module.exports = (store, __exports) => {
|
|||||||
{
|
{
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
label: 'Enhancements',
|
label: 'Enhancements',
|
||||||
accelerator: 'CommandOrControl+E',
|
accelerator: store().menu_toggle,
|
||||||
click: openExtensionMenu,
|
click: openExtensionMenu,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -193,6 +192,17 @@ module.exports = (store, __exports) => {
|
|||||||
tray.setContextMenu(contextMenu);
|
tray.setContextMenu(contextMenu);
|
||||||
tray.setToolTip('Notion');
|
tray.setToolTip('Notion');
|
||||||
|
|
||||||
|
electron.globalShortcut.register(store().menu_toggle, () => {
|
||||||
|
if (
|
||||||
|
electron.BrowserWindow.getAllWindows()
|
||||||
|
.filter((win) => win.getTitle() !== 'notion-enhancer menu')
|
||||||
|
.some((win) => win.isFocused())
|
||||||
|
) {
|
||||||
|
openExtensionMenu();
|
||||||
|
} else if (enhancer_menu && enhancer_menu.isFocused())
|
||||||
|
enhancer_menu.close();
|
||||||
|
});
|
||||||
|
|
||||||
function showWindows() {
|
function showWindows() {
|
||||||
const windows = electron.BrowserWindow.getAllWindows();
|
const windows = electron.BrowserWindow.getAllWindows();
|
||||||
if (is_mac) electron.app.show();
|
if (is_mac) electron.app.show();
|
||||||
|
@ -46,7 +46,7 @@ module.exports = {
|
|||||||
: 0;
|
: 0;
|
||||||
for (let day of days)
|
for (let day of days)
|
||||||
day.parentElement.parentElement.style.height = 0;
|
day.parentElement.parentElement.style.height = 0;
|
||||||
today.parentElement.parentElement.style.height = height;
|
if (today) today.parentElement.parentElement.style.height = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -120,3 +120,15 @@ if (overwrite) {
|
|||||||
// do stuff
|
// do stuff
|
||||||
} else console.info(' -- keeping file: skipping step.');
|
} else console.info(' -- keeping file: skipping step.');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```js
|
||||||
|
function createElement(html) {
|
||||||
|
const template = document.createElement('template');
|
||||||
|
template.innerHTML = html.trim();
|
||||||
|
return template.content.firstElementChild;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
use `helpers.createElement(html)` to turn a html-valid string into an element to add to the page.
|
||||||
|
Loading…
Reference in New Issue
Block a user