mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-12 00:09:03 +00:00
Merge pull request #72 from amv146/dev
toggle header indentation lines, adjacent tab nav hotkeys
This commit is contained in:
commit
7358873fba
@ -9,6 +9,9 @@
|
|||||||
.notion-page-content .notion-numbered_list-block > div > div:last-child,
|
.notion-page-content .notion-numbered_list-block > div > div:last-child,
|
||||||
.notion-page-content .notion-to_do-block > div > div:last-child,
|
.notion-page-content .notion-to_do-block > div > div:last-child,
|
||||||
.notion-page-content .notion-toggle-block > div > div:last-child,
|
.notion-page-content .notion-toggle-block > div > div:last-child,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_header-block > div > div > div:last-child,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_header-block > div > div > div:last-child,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_sub_header-block > div > div > div:last-child,
|
||||||
.notion-page-content .notion-table_of_contents-block > div > div > a > div > div {
|
.notion-page-content .notion-table_of_contents-block > div > div > a > div > div {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@ -16,7 +19,11 @@
|
|||||||
.notion-page-content .notion-bulleted_list-block > div > div:last-child::before,
|
.notion-page-content .notion-bulleted_list-block > div > div:last-child::before,
|
||||||
.notion-page-content .notion-numbered_list-block > div > div:last-child::before,
|
.notion-page-content .notion-numbered_list-block > div > div:last-child::before,
|
||||||
.notion-page-content .notion-to_do-block > div > div:last-child::before,
|
.notion-page-content .notion-to_do-block > div > div:last-child::before,
|
||||||
.notion-page-content .notion-toggle-block > div > div:last-child::before {
|
.notion-page-content .notion-toggle-block > div > div:last-child::before,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_header-block > div > div > div:last-child::before,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_header-block > div > div > div:last-child::before,
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_sub_header-block > div > div > div:last-child::before,
|
||||||
|
.notion-page-content .pseudoSelection > div > div:last-child::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
height: calc(100% - 2em);
|
height: calc(100% - 2em);
|
||||||
@ -93,3 +100,4 @@
|
|||||||
> .plus:hover {
|
> .plus:hover {
|
||||||
background: var(--theme--ui_interactive-hover) !important;
|
background: var(--theme--ui_interactive-hover) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,21 @@ export default async function ({ web }, db) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (await db.get(['toggle_header'])) {
|
||||||
|
css += `
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_header-block > div > div > div:last-child::before {
|
||||||
|
border-left: 1px ${style} var(--indentation_lines--color, currentColor);
|
||||||
|
opacity: ${opacity};
|
||||||
|
}
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_header-block > div > div > div:last-child::before {
|
||||||
|
border-left: 1px ${style} var(--indentation_lines--color, currentColor);
|
||||||
|
opacity: ${opacity};
|
||||||
|
}
|
||||||
|
.notion-page-content .notion-selectable.notion-sub_sub_sub_header-block > div > div > div:last-child::before {
|
||||||
|
border-left: 1px ${style} var(--indentation_lines--color, currentColor);
|
||||||
|
opacity: ${opacity};
|
||||||
|
}`;
|
||||||
|
}
|
||||||
if (db.get(['table_of_contents'])) {
|
if (db.get(['table_of_contents'])) {
|
||||||
css += `
|
css += `
|
||||||
.notion-page-content .notion-table_of_contents-block > div > div > a > div
|
.notion-page-content .notion-table_of_contents-block > div > div > a > div
|
||||||
|
@ -50,6 +50,12 @@
|
|||||||
"label": "toggle lists",
|
"label": "toggle lists",
|
||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "toggle",
|
||||||
|
"key": "toggle_header",
|
||||||
|
"label": "toggle headers",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "toggle",
|
"type": "toggle",
|
||||||
"key": "table_of_contents",
|
"key": "table_of_contents",
|
||||||
|
@ -10,14 +10,14 @@ export default async function ({ web, electron }, db) {
|
|||||||
const newTabHotkey = await db.get(['new_tab']),
|
const newTabHotkey = await db.get(['new_tab']),
|
||||||
closeTabHotkey = await db.get(['close_tab']),
|
closeTabHotkey = await db.get(['close_tab']),
|
||||||
restoreTabHotkey = await db.get(['restore_tab']),
|
restoreTabHotkey = await db.get(['restore_tab']),
|
||||||
selectTabModifier = await db.get(['select_modifier']);
|
selectTabModifier = await db.get(['select_modifier']),
|
||||||
|
prevTabHotkey = await db.get(['prev_tab']),
|
||||||
|
nextTabHotkey = await db.get(['next_tab']);
|
||||||
web.addHotkeyListener(newTabHotkey, () => {
|
web.addHotkeyListener(newTabHotkey, () => {
|
||||||
electron.sendMessageToHost('new-tab');
|
electron.sendMessageToHost('new-tab');
|
||||||
console.log('new-tab');
|
|
||||||
});
|
});
|
||||||
web.addHotkeyListener(restoreTabHotkey, () => {
|
web.addHotkeyListener(restoreTabHotkey, () => {
|
||||||
electron.sendMessageToHost('restore-tab');
|
electron.sendMessageToHost('restore-tab');
|
||||||
console.log('restore-tab');
|
|
||||||
});
|
});
|
||||||
web.addHotkeyListener(closeTabHotkey, () => electron.sendMessageToHost('close-tab'));
|
web.addHotkeyListener(closeTabHotkey, () => electron.sendMessageToHost('close-tab'));
|
||||||
for (let i = 1; i < 10; i++) {
|
for (let i = 1; i < 10; i++) {
|
||||||
@ -25,6 +25,12 @@ export default async function ({ web, electron }, db) {
|
|||||||
electron.sendMessageToHost('select-tab', i);
|
electron.sendMessageToHost('select-tab', i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
web.addHotkeyListener(prevTabHotkey, () => {
|
||||||
|
electron.sendMessageToHost('select-prev-tab')
|
||||||
|
});
|
||||||
|
web.addHotkeyListener(nextTabHotkey, () => {
|
||||||
|
electron.sendMessageToHost('select-next-tab')
|
||||||
|
});
|
||||||
|
|
||||||
const breadcrumbSelector =
|
const breadcrumbSelector =
|
||||||
'.notion-topbar > div > [class="notranslate"] > .notion-focusable:last-child',
|
'.notion-topbar > div > [class="notranslate"] > .notion-focusable:last-child',
|
||||||
|
@ -62,6 +62,18 @@
|
|||||||
"Super+Shift"
|
"Super+Shift"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "hotkey",
|
||||||
|
"key": "prev_tab",
|
||||||
|
"label": "previous tab hotkey",
|
||||||
|
"value": "Control+Shift+Tab"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "hotkey",
|
||||||
|
"key": "next_tab",
|
||||||
|
"label": "next tab hotkey",
|
||||||
|
"value": "Control+Tab"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "hotkey",
|
"type": "hotkey",
|
||||||
"key": "new_tab",
|
"key": "new_tab",
|
||||||
|
@ -228,6 +228,36 @@ module.exports = async function (api, db, tabCache = new Map()) {
|
|||||||
const $tab = i === 9 ? this.$tabList.lastElementChild : this.$tabList.children[i - 1];
|
const $tab = i === 9 ? this.$tabList.lastElementChild : this.$tabList.children[i - 1];
|
||||||
if ($tab) $tab.click();
|
if ($tab) $tab.click();
|
||||||
});
|
});
|
||||||
|
fromNotion('notion-enhancer:select-prev-tab', () => {
|
||||||
|
if (this.$tabList.count == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const $sibling = this.$tab.previousElementSibling;
|
||||||
|
if ($sibling) {
|
||||||
|
$sibling.click();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let $tab = this.$tabList.lastElementChild;
|
||||||
|
if ($tab) {
|
||||||
|
$tab.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fromNotion('notion-enhancer:select-next-tab', () => {
|
||||||
|
if (this.$tabList.count == 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const $sibling = this.$tab.nextElementSibling;
|
||||||
|
if ($sibling) {
|
||||||
|
$sibling.click();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let $tab = this.$tabList.children[0]
|
||||||
|
if ($tab) {
|
||||||
|
$tab.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#firstQuery = true;
|
#firstQuery = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user