Skip to content

Commit

Permalink
Merge pull request #3902 from udecode/feat/font-fallback
Browse files Browse the repository at this point in the history
font fallback
  • Loading branch information
zbeyens authored Dec 21, 2024
2 parents 775edae + 7c96d5d commit af4e439
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 11 deletions.
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

0 comments on commit af4e439

Please sign in to comment.