Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/app/assets/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@font-face {
font-family: 'Martian Mono';
src: url('./fonts/MartianMono-VariableFont_wdth,wght.woff2') format('woff2');
font-weight: 100 900;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'Source Serif 4';
src: url('./fonts/SourceSerif4-VariableFont_opsz,wght.woff2') format('woff2');
font-weight: 200 900;
font-style: normal;
font-display: swap;
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
background-color: var(--chakra-colors-dim-100);
color: var(--chakra-colors-typography);
padding: 0.0625rem 0.25rem;
font-family: Menlo, Consolas, Monaco, monospace;
font-family: 'Martian Mono', monospace;
font-size: 0.9em;
}

Expand Down Expand Up @@ -186,7 +186,7 @@

background-color: var(--chakra-colors-dim-100);
color: var(--chakra-colors-typography);
font-family: Menlo, Consolas, Monaco, monospace;
font-family: 'Martian Mono', monospace;
display: block;
padding: var(--block-padding);
line-height: 1.53;
Expand Down
6 changes: 5 additions & 1 deletion packages/app/src/features/NoteEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ import { GLOBAL_COMMANDS } from '@hooks/commands';
import { useCommand } from '@hooks/commands/useCommand';
import { useWorkspaceCommandCallback } from '@hooks/commands/useWorkspaceCommandCallback';
import { useImmutableCallback } from '@hooks/useImmutableCallback';
import { useAppDispatch } from '@state/redux/hooks';
import { useAppDispatch, useAppSelector } from '@state/redux/hooks';
import { selectEditorFontFamily } from '@state/redux/settings/selectors/preferences';
import {
useVaultSelector,
useWorkspaceData,
Expand Down Expand Up @@ -292,6 +293,8 @@ export type NoteEditorProps = {
*/
export const Note2: FC<NoteEditorProps> = memo(
({ note, updateNote, updateMeta, isActive }) => {
const fontFamily = useAppSelector(selectEditorFontFamily);

const { t } = useTranslation(LOCALE_NAMESPACE.features);
const telemetry = useTelemetryTracker();

Expand Down Expand Up @@ -436,6 +439,7 @@ export const Note2: FC<NoteEditorProps> = memo(
variant="flushed"
size="md"
fontSize="22px"
fontFamily={fontFamily}
value={versionPreview ? versionPreview.title : title}
onChange={
versionPreview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export const selectEditorConfig = createAppSelector(
export const selectEditorFontFamily = createAppSelector(
selectEditorConfig,
({ fontFamily }) => {
const fallback =
// eslint-disable-next-line @cspell/spellchecker
'-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", "Segoe UI Variable", "Noto Sans", "Ubuntu", "Cantarell", "Helvetica Neue", Arial, system-ui, sans-serif';
const fallback = '"Source Serif 4", serif';

const normalizedFontFamily = normalizeFontFamily(fontFamily);

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/state/redux/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const defaultSettings = {
editor: {
mode: 'richtext',
fontFamily: '',
fontSize: 16,
fontSize: 18,
lineHeight: 1.6,
miniMap: false,
lineNumbers: false,
Expand Down
6 changes: 6 additions & 0 deletions packages/app/src/templates/window.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<head>
<meta charset="utf-8" />
<title><%= htmlWebpackPlugin.options.title %></title>

<!-- Preload fonts -->
<link rel="preload" href="./assets/fonts/MartianMono-VariableFont_wdth,wght.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="./assets/fonts/SourceSerif4-VariableFont_opsz,wght.woff2" as="font" type="font/woff2" crossorigin />
<link href="./assets/fonts.css" rel="stylesheet">

<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<!-- <meta
http-equiv="Content-Security-Policy"
Expand Down
Loading