add font variables for headings, headings input for font chooser and fix quote variable

This commit is contained in:
Emir 2020-12-05 20:40:00 +03:00
parent 6f4534c9fc
commit 495f5aeb89
3 changed files with 43 additions and 7 deletions

View File

@ -149,6 +149,15 @@
.notion-selectable.notion-quote-block div[spellcheck="true"] { .notion-selectable.notion-quote-block div[spellcheck="true"] {
font-family: var(--theme--font_quote) !important; font-family: var(--theme--font_quote) !important;
} }
[placeholder='Heading 1'] {
font-family: var(--theme--font_heading1) !important;
}
[placeholder='Heading 2'] {
font-family: var(--theme--font_heading2) !important;
}
[placeholder='Heading 3'] {
font-family: var(--theme--font_heading3) !important;
}
.notion-frame .notion-page-block div[placeholder='Untitled'], .notion-frame .notion-page-block div[placeholder='Untitled'],
.notion-overlay-container .notion-page-block div[placeholder='Untitled'] { .notion-overlay-container .notion-page-block div[placeholder='Untitled'] {
font-size: calc( font-size: calc(

View File

@ -37,6 +37,9 @@
--theme_dark--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, --theme_dark--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
Courier, monospace; Courier, monospace;
--theme_dark--font_quote: var(--theme_dark--font_sans); --theme_dark--font_quote: var(--theme_dark--font_sans);
--theme_dark--font_heading1: var(--theme_dark--font_sans);
--theme_dark--font_heading2: var(--theme_dark--font_sans);
--theme_dark--font_heading3: var(--theme_dark--font_sans);
--theme_dark--font_title-size: 40px; --theme_dark--font_title-size: 40px;
--theme_dark--font_heading1-size: 1.875em; --theme_dark--font_heading1-size: 1.875em;
@ -222,6 +225,9 @@
--theme_light--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, --theme_light--font_code: SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
Courier, monospace; Courier, monospace;
--theme_light--font_quote: var(--theme_light--font_sans); --theme_light--font_quote: var(--theme_light--font_sans);
--theme_light--font_heading1: var(--theme_light--font_sans);
--theme_light--font_heading2: var(--theme_light--font_sans);
--theme_light--font_heading3: var(--theme_light--font_sans);
--theme_light--font_title-size: 40px; --theme_light--font_title-size: 40px;
--theme_light--font_heading1-size: 1.875em; --theme_light--font_heading1-size: 1.875em;
@ -399,7 +405,10 @@
--theme--font_serif: var(--theme_dark--font_serif); --theme--font_serif: var(--theme_dark--font_serif);
--theme--font_mono: var(--theme_dark--font_mono); --theme--font_mono: var(--theme_dark--font_mono);
--theme--font_code: var(--theme_dark--font_code); --theme--font_code: var(--theme_dark--font_code);
--theme--font_quote: var(--theme_dark--font_sans); --theme--font_quote: var(--theme_dark--font_quote);
--theme--font_heading1: var(--theme_dark--font_heading1);
--theme--font_heading2: var(--theme_dark--font_heading2);
--theme--font_heading3: var(--theme_dark--font_heading3);
--theme--font_title-size: var(--theme_dark--font_title-size); --theme--font_title-size: var(--theme_dark--font_title-size);
--theme--font_heading1-size: var(--theme_dark--font_heading1-size); --theme--font_heading1-size: var(--theme_dark--font_heading1-size);
--theme--font_heading2-size: var(--theme_dark--font_heading2-size); --theme--font_heading2-size: var(--theme_dark--font_heading2-size);
@ -566,7 +575,10 @@
--theme--font_serif: var(--theme_light--font_serif); --theme--font_serif: var(--theme_light--font_serif);
--theme--font_mono: var(--theme_light--font_mono); --theme--font_mono: var(--theme_light--font_mono);
--theme--font_code: var(--theme_light--font_code); --theme--font_code: var(--theme_light--font_code);
--theme--font_quote: var(--theme_light--font_sans); --theme--font_quote: var(--theme_light--font_quote);
--theme--font_heading1: var(--theme_light--font_heading1);
--theme--font_heading2: var(--theme_light--font_heading2);
--theme--font_heading3: var(--theme_light--font_heading3);
--theme--font_title-size: var(--theme_light--font_title-size); --theme--font_title-size: var(--theme_light--font_title-size);
--theme--font_heading1-size: var(--theme_light--font_heading1-size); --theme--font_heading1-size: var(--theme_light--font_heading1-size);
--theme--font_heading2-size: var(--theme_light--font_heading2-size); --theme--font_heading2-size: var(--theme_light--font_heading2-size);

View File

@ -14,7 +14,7 @@ module.exports = {
name: 'font chooser', name: 'font chooser',
desc: desc:
'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.<br/><br/>make sure the fonts you type are installed on your device.', '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.<br/><br/>make sure the fonts you type are installed on your device.',
version: '0.2.1', version: '0.3.1',
author: 'torchatlas', author: 'torchatlas',
options: [ options: [
{ {
@ -47,6 +47,12 @@ module.exports = {
type: 'input', type: 'input',
value: '', value: '',
}, },
{
key: 'headings',
label: 'headings:',
type: 'input',
value: '',
},
], ],
hacks: { hacks: {
'renderer/preload.js'(store, __exports) { 'renderer/preload.js'(store, __exports) {
@ -54,13 +60,22 @@ module.exports = {
async function enhance() { async function enhance() {
if (!document.querySelector('.notion-app-inner')) return; if (!document.querySelector('.notion-app-inner')) return;
clearInterval(attempt_interval); clearInterval(attempt_interval);
for (let style of ['sans', 'serif', 'mono', 'code', 'quote']) { for (let style of ['sans', 'serif', 'mono', 'code', 'quote', 'headings']) {
if (!store()[style]) continue; if (!store()[style]) continue;
if (style == 'headings') {
for (let heading of ['heading1', 'heading2', 'heading3']) {
document
.querySelector('.notion-app-inner')
.style.setProperty(`--theme--font_${heading}`, store()[style]);
}
} else {
document document
.querySelector('.notion-app-inner') .querySelector('.notion-app-inner')
.style.setProperty(`--theme--font_${style}`, store()[style]); .style.setProperty(`--theme--font_${style}`, store()[style]);
} }
} }
}
}, },
}, },
}; };