fix menu hotkey + tab title emojis on macOS

This commit is contained in:
dragonwocky 2020-11-01 12:04:04 +11:00
parent 9e1417ac3e
commit 667c727ac9
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
4 changed files with 24 additions and 8 deletions

View File

@ -69,10 +69,6 @@ a flexibility update.
a fork of notion-deb-builder that does generate an app.asar has been created and is once again supported.
// todo
- open ext. menu hotkey not working on macOS?
### v0.9.1 (2020-09-26)
- bugfix: font chooser will continue iterating through fonts after encountering a blank option.

View File

@ -25,7 +25,11 @@ module.exports = (store, __exports) => {
const hotkey = toKeyEvent(store().menu_toggle);
let triggered = true;
for (let prop in hotkey)
if (hotkey[prop] !== event[prop]) triggered = false;
if (
hotkey[prop] !== event[prop] &&
!(prop === 'key' && event[prop] === 'Dead')
)
triggered = false;
if (triggered) electron.ipcRenderer.send('enhancer:open-menu');
if (tabsEnabled) {
// switch between tabs via key modifier
@ -214,6 +218,10 @@ module.exports = (store, __exports) => {
if (tabsEnabled) {
let tab_title = '';
if (process.platform === 'darwin')
document
.querySelector('.notion-sidebar [style*="37px"]:empty')
.remove();
const TITLE_OBSERVER = new MutationObserver(() =>
__electronApi.setWindowTitle('notion.so')
);
@ -232,7 +240,11 @@ module.exports = (store, __exports) => {
),
text = $container.querySelector('[placeholder="Untitled"]');
title =
(icon ? `<img src="${icon.getAttribute('src')}">` : '') +
(icon
? icon.getAttribute('src')
? `<img src="${icon.getAttribute('src')}">`
: `${icon.getAttribute('aria-label')} `
: '') +
(text
? text.innerText
: [

View File

@ -131,7 +131,11 @@ window['__start'] = async () => {
const hotkey = toKeyEvent(coreStore().menu_toggle);
let triggered = true;
for (let prop in hotkey)
if (hotkey[prop] !== event[prop]) triggered = false;
if (
hotkey[prop] !== event[prop] &&
!(prop === 'key' && event[prop] === 'Dead')
)
triggered = false;
if (triggered || ((event.ctrlKey || event.metaKey) && event.key === 'w'))
electron.remote.getCurrentWindow().close();
// focus search

View File

@ -994,7 +994,11 @@ module.exports = (store, __exports) => {
const hotkey = toKeyEvent(store().menu_toggle);
let triggered = true;
for (let prop in hotkey)
if (hotkey[prop] !== event[prop]) triggered = false;
if (
hotkey[prop] !== event[prop] &&
!(prop === 'key' && event[prop] === 'Dead')
)
triggered = false;
if (triggered) electron.ipcRenderer.send('enhancer:open-menu');
});