Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font fallback #3902

Merged
merged 2 commits into from
Dec 21, 2024
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
40 changes: 40 additions & 0 deletions apps/www/content/docs/components/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,46 @@ Use the [CLI](https://platejs.org/docs/components/cli) to install the latest ver

## December 2024 #17

### December 21 #17.4

Update `tailwind.config.cjs` for better font support in the HTML export:

```ts
fontFamily: {
heading: [
'var(--font-heading)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
mono: ['var(--font-mono)', ...fontFamily.mono],
sans: [
'var(--font-sans)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
```


### December 20 #17.3

- `insertColumnGroup`, `toggleColumnGroup`: use `columns` option instead of `layout`
Expand Down

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions apps/www/public/r/styles/default/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,42 @@
],
"theme": {
"extend": {
"fontFamily": {
"heading": [
"var(--font-heading)",
"ui-sans-serif",
"-apple-system",
"BlinkMacSystemFont",
"Segoe UI Variable Display",
"Segoe UI",
"Helvetica",
"Apple Color Emoji",
"Arial",
"sans-serif",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji"
],
"mono": [
"var(--font-mono)",
"...require(\"tailwindcss/defaultTheme\").fontFamily.mono"
],
"sans": [
"var(--font-sans)",
"ui-sans-serif",
"-apple-system",
"BlinkMacSystemFont",
"Segoe UI Variable Display",
"Segoe UI",
"Helvetica",
"Apple Color Emoji",
"Arial",
"sans-serif",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji"
]
},
"colors": {
"brand": {
"DEFAULT": "hsl(var(--brand))",
Expand Down
33 changes: 33 additions & 0 deletions apps/www/scripts/build-registry.mts
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,39 @@ async function buildStylesIndex() {
plugins: [`require("tailwindcss-animate")`, `require("tailwind-scrollbar-hide")`],
theme: {
extend: {
fontFamily: {
heading: [
'var(--font-heading)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
mono: ['var(--font-mono)', `...require("tailwindcss/defaultTheme").fontFamily.mono`],
sans: [
'var(--font-sans)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
},
colors: {
brand: {
DEFAULT: 'hsl(var(--brand))',
Expand Down
6 changes: 3 additions & 3 deletions apps/www/src/registry/default/lib/create-html-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export function createHtmlDocument({
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;700&display=swap"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&family=JetBrains+Mono:wght@400..700&display=swap"
rel="stylesheet"
/>
<style>
:root {
--font-sans: 'Inter', sans-serif;
--font-mono: 'JetBrains Mono', monospace;
--font-sans: 'Inter', 'Inter Fallback';
--font-mono: 'JetBrains Mono', 'JetBrains Mono Fallback';
}
</style>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ export function ExportToolbarButton({ children, ...props }: DropdownMenuProps) {
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;700&display=swap"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400..700&family=JetBrains+Mono:wght@400..700&display=swap"
rel="stylesheet"
/>
${tailwindCss}
${prismCss}
<style>
:root {
--font-sans: 'Inter', sans-serif;
--font-mono: 'JetBrains Mono', monospace;
--font-sans: 'Inter', 'Inter Fallback';
--font-mono: 'JetBrains Mono', 'JetBrains Mono Fallback';
}
</style>
</head>
Expand Down
38 changes: 34 additions & 4 deletions tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { fontFamily } = require('tailwindcss/defaultTheme');
const plugin = require('tailwindcss/plugin');

/** @type {import('tailwindcss').Config} */
Expand Down Expand Up @@ -86,9 +85,40 @@ module.exports = {
},
},
fontFamily: {
heading: ['var(--font-heading)', ...fontFamily.sans],
mono: ['var(--font-mono)', ...fontFamily.mono],
sans: ['var(--font-sans)', ...fontFamily.sans],
heading: [
'var(--font-heading)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
mono: [
'var(--font-mono)',
...require('tailwindcss/defaultTheme').fontFamily.mono,
],
sans: [
'var(--font-sans)',
'ui-sans-serif',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI Variable Display',
'Segoe UI',
'Helvetica',
'Apple Color Emoji',
'Arial',
'sans-serif',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
},
keyframes: {
'accordion-down': {
Expand Down
Loading