mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-07 22:19:02 +00:00
integration: quick note
This commit is contained in:
parent
805cbb836d
commit
9b1a1ea509
repo
@ -231,3 +231,6 @@
|
||||
margin: 1em 0;
|
||||
border-bottom: 1px solid var(--theme--ui_divider);
|
||||
}
|
||||
.icon_sets--title[data-collapsed='true'] + .icon_sets--set + .icon_sets--divider {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "icon sets",
|
||||
"id": "2d1f4809-9581-40dd-9bf3-4239db406483",
|
||||
"version": "0.4.0",
|
||||
"description": "upload, save and reuse custom icons directly from the icon picker.",
|
||||
"description": "upload, save and reuse custom icons directly from the icon picker. check out the [icons page](https://notion-enhancer.github.io/mods/icon-sets) for instructions on loading entire sets.",
|
||||
"tags": ["integration", "customisation"],
|
||||
"authors": [
|
||||
{
|
||||
|
@ -230,6 +230,7 @@ export const options = {
|
||||
if (!empty && !pressed.includes(event.key)) {
|
||||
let key = event.key;
|
||||
if (key === ' ') key = 'Space';
|
||||
if (key === '+') key = 'Plus';
|
||||
if (key.length === 1) key = event.key.toUpperCase();
|
||||
pressed.push(key);
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ web.render(
|
||||
$extensionsNavItem,
|
||||
$themesNavItem,
|
||||
$integrationsNavItem,
|
||||
web.html`<a href="https://notion-enhancer.github.io" class="nav-item">docs</a>`,
|
||||
web.html`<a href="https://discord.gg/sFWPXtA" class="nav-item">community</a>`
|
||||
web.html`<a href="https://notion-enhancer.github.io" target="_blank" class="nav-item">docs</a>`,
|
||||
web.html`<a href="https://discord.gg/sFWPXtA" target="_blank" class="nav-item">community</a>`
|
||||
),
|
||||
$main
|
||||
),
|
||||
|
@ -67,7 +67,6 @@ async function triggerQueryListeners() {
|
||||
if (location.search === queryCache) return;
|
||||
const newQuery = web.queryParams(),
|
||||
oldQuery = new URLSearchParams(queryCache);
|
||||
console.log(location.search, queryCache);
|
||||
queryCache = location.search;
|
||||
for (const listener of _queryListeners) {
|
||||
const newParam = newQuery.get(listener.param),
|
||||
|
@ -35,14 +35,16 @@ const customClasses = {
|
||||
'notification-text': apply`text-xs mx-2 flex-auto font-semibold group-hover:(filter brightness-75)`,
|
||||
'notification-icon': apply`fill-current opacity-75 h-4 w-4 mx-2`,
|
||||
'body-container': apply`flex w-full h-full overflow-hidden`,
|
||||
'content-container': apply`h-full w-full-96`,
|
||||
'nav': apply`px-4 py-3 flex flex-wrap items-center border-b border-divider h-64 sm:h-48 md:h-32 lg:h-16`,
|
||||
'sidebar': apply`h-full w-96 max-w-3/7 flex-shrink-0 px-4 pt-3 pb-16 overflow-y-auto flex flex-col
|
||||
bg-notion-secondary border-l border-divider`,
|
||||
'content-container': apply`h-full flex flex-col`,
|
||||
'nav': apply`px-4 py-3 flex flex-wrap items-center border-b border-divider`,
|
||||
'nav-notion': apply`flex items-center font-semibold text-xl cursor-pointer select-none mr-4
|
||||
ml-4 sm:mb-4 md:w-full lg:(w-auto ml-0 mb-0)`,
|
||||
'nav-notion-icon': apply`h-12 w-12 mr-5 sm:(h-6 w-6 mr-3)`,
|
||||
'nav-item': apply`ml-4 px-3 py-2 rounded-md text-sm font-medium hover:bg-interactive-hover focus:bg-interactive-active`,
|
||||
'nav-item-selected': apply`ml-4 px-3 py-2 rounded-md text-sm font-medium ring-1 ring-divider bg-notion-secondary`,
|
||||
'main': apply`transition px-4 py-3 overflow-y-auto max-h-full-64 sm:max-h-full-48 md:max-h-full-32 lg:max-h-full-16`,
|
||||
'main': apply`transition px-4 py-3 overflow-y-auto flex-grow`,
|
||||
'main-message': apply`mx-2.5 my-2.5 px-px text-sm text-foreground-secondary text-justify`,
|
||||
'mods-list': apply`flex flex-wrap`,
|
||||
'mod-container': apply`w-full md:w-1/2 lg:w-1/3 xl:w-1/4 2xl:w-1/5 px-2.5 py-2.5 box-border`,
|
||||
@ -58,7 +60,6 @@ const customClasses = {
|
||||
'mod-authors-container': apply`text-sm font-medium`,
|
||||
'mod-author': apply`flex items-center mb-2`,
|
||||
'mod-author-avatar': apply`inline object-cover w-5 h-5 rounded-full mr-2`,
|
||||
'sidebar': apply`h-full w-96 px-4 pt-3 pb-16 overflow-y-auto flex flex-col bg-notion-secondary border-l border-divider`,
|
||||
'profile-trigger': apply`block px-4 py-3 mb-2 rounded-md text-sm text-left font-semibold shadow-inner
|
||||
hover:bg-accent-red-button border border-accent-red text-accent-red focus:(outline-none bg-accent-red-button)`,
|
||||
'profile-actions': apply`flex`,
|
||||
@ -138,15 +139,7 @@ setup({
|
||||
'red': mapColorVariables('red'),
|
||||
},
|
||||
extend: {
|
||||
width: {
|
||||
'full-96': 'calc(100% - 24rem)',
|
||||
},
|
||||
maxHeight: {
|
||||
'full-16': 'calc(100% - 4rem)',
|
||||
'full-32': 'calc(100% - 8rem)',
|
||||
'full-48': 'calc(100% - 12rem)',
|
||||
'full-64': 'calc(100% - 16rem)',
|
||||
},
|
||||
maxWidth: { '3/7': 'calc((3 / 7) * 100%);' },
|
||||
},
|
||||
},
|
||||
plugins: customClasses,
|
||||
|
33
repo/quick-note/client.mjs
Normal file
33
repo/quick-note/client.mjs
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* notion-enhancer: quick note
|
||||
* (c) 2021 dragonwocky <thedragonring.bod@gmail.com> (https://dragonwocky.me/)
|
||||
* (https://notion-enhancer.github.io/) under the MIT license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
export default async function ({ web, components, notion }, db) {
|
||||
const targetDbId = await db.get(['target_db']);
|
||||
if (!targetDbId) return;
|
||||
|
||||
const newQuickNote = async () => {
|
||||
try {
|
||||
const { collection_id } = await notion.get(targetDbId),
|
||||
noteID = await notion.create(
|
||||
{
|
||||
recordValue: {
|
||||
properties: { title: [[`quick note: ${new Date().toLocaleString()}`]] },
|
||||
},
|
||||
recordType: 'page',
|
||||
},
|
||||
{ parentID: collection_id, parentTable: 'collection' }
|
||||
);
|
||||
location.assign(`https://www.notion.so/${noteID.replace(/-/g, '')}`);
|
||||
} catch {
|
||||
alert('quick note failed: target database id did not match any known databases');
|
||||
}
|
||||
};
|
||||
|
||||
await components.addCornerAction(await components.feather('feather'), newQuickNote);
|
||||
web.addHotkeyListener(await db.get(['hotkey']), newQuickNote);
|
||||
}
|
34
repo/quick-note/mod.json
Normal file
34
repo/quick-note/mod.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "quick note",
|
||||
"id": "5d7c1677-6f6d-4fb5-8d6f-5067bcd0e24c",
|
||||
"version": "0.1.0",
|
||||
"description": "adds a hotkey & a button in the bottom right corner to jump to a new page in a notes database (target database id must be set).",
|
||||
"tags": ["integration", "shortcut"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "dragonwocky",
|
||||
"email": "thedragonring.bod@gmail.com",
|
||||
"homepage": "https://dragonwocky.me/",
|
||||
"avatar": "https://dragonwocky.me/avatar.jpg"
|
||||
}
|
||||
],
|
||||
"css": {},
|
||||
"js": {
|
||||
"client": ["client.mjs"]
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
"type": "text",
|
||||
"key": "target_db",
|
||||
"label": "target database id",
|
||||
"tooltip": "**the uuid of the database in which pages should be created** (the bit after the '/' in the database url, e.g. edbafbd8bb7045cab1408aadaf4edf9d)",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"type": "hotkey",
|
||||
"key": "hotkey",
|
||||
"label": "hotkey",
|
||||
"value": "Ctrl+Alt+="
|
||||
}
|
||||
]
|
||||
}
|
@ -24,7 +24,6 @@
|
||||
"right-to-left",
|
||||
"simpler-databases",
|
||||
"emoji-sets",
|
||||
"icon-sets",
|
||||
"bypass-preview",
|
||||
"topbar-icons",
|
||||
"word-counter",
|
||||
@ -35,5 +34,8 @@
|
||||
"weekly-view",
|
||||
"truncated-titles",
|
||||
"focus-mode",
|
||||
"global-block-links"
|
||||
"global-block-links",
|
||||
|
||||
"icon-sets",
|
||||
"quick-note"
|
||||
]
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "tweaks",
|
||||
"id": "5174a483-c88d-4bf8-a95f-35cd330b76e2",
|
||||
"version": "0.2.0",
|
||||
"description": "common style/layout changes and custom code insertion. check out the [tweaks page](https://notion-enhancer.github.io/tweaks) for more.",
|
||||
"description": "common style/layout changes and custom code insertion. check out the [tweaks page](https://notion-enhancer.github.io/mods/tweaks) for more.",
|
||||
"tags": ["extension", "customisation"],
|
||||
"authors": [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user