diff --git a/packages/core/src/editor.module.css b/packages/core/src/editor.module.css index 923ba5fad2..94b8263c29 100644 --- a/packages/core/src/editor.module.css +++ b/packages/core/src/editor.module.css @@ -56,13 +56,13 @@ Tippy popups that are appended to document.body directly } [data-theme="light"] { - background-color: #ffffff; - color: #444444; + background-color: #FFFFFF; + color: #3F3F3F; } [data-theme="dark"] { - background-color: #444444; - color: #dddddd; + background-color: #1F1F1F; + color: #CFCFCF; } .dragPreview { diff --git a/packages/core/src/extensions/Blocks/nodes/Block.module.css b/packages/core/src/extensions/Blocks/nodes/Block.module.css index a85152345a..91c960b757 100644 --- a/packages/core/src/extensions/Blocks/nodes/Block.module.css +++ b/packages/core/src/extensions/Blocks/nodes/Block.module.css @@ -60,14 +60,14 @@ NESTED BLOCKS .blockGroup .blockGroup > .blockOuter:not([data-prev-depth-changed])::before { - border-left: 1px solid #cccccc; + border-left: 1px solid #AFAFAF; } [data-theme="dark"] .blockGroup .blockGroup > .blockOuter:not([data-prev-depth-changed])::before { - border-left: 1px solid #999999; + border-left: 1px solid #7F7F7F; } .blockGroup .blockGroup > .blockOuter[data-prev-depth-change="-2"]::before { @@ -250,12 +250,12 @@ NESTED BLOCKS [data-theme="light"] .isEmpty .inlineContent:before, .isFilter .inlineContent:before { - color: #cccccc; + color: #CFCFCF; } [data-theme="dark"] .isEmpty .inlineContent:before, .isFilter .inlineContent:before { - color: #999999; + color: #7F7F7F; } /* TODO: would be nicer if defined from code */ diff --git a/packages/react/src/BlockNoteTheme.ts b/packages/react/src/BlockNoteTheme.ts index 9c2016d49b..2d941f3a38 100644 --- a/packages/react/src/BlockNoteTheme.ts +++ b/packages/react/src/BlockNoteTheme.ts @@ -15,15 +15,15 @@ type ColorScheme = [ export const blockNoteColorScheme: ColorScheme = [ "#FFFFFF", - "#EEEEEE", - "#DDDDDD", - "#CCCCCC", - "#999999", - "#666666", - "#444444", - "#333333", - "#222222", - "#111111", + "#EFEFEF", + "#CFCFCF", + "#AFAFAF", + "#7F7F7F", + "#3F3F3F", + "#1F1F1F", + "#161616", + "#0F0F0F", + "#000000", ]; export const getBlockNoteTheme = ( @@ -41,7 +41,7 @@ export const getBlockNoteTheme = ( const sideMenu = useDarkTheme ? blockNoteColorScheme[4] - : blockNoteColorScheme[3]; + : blockNoteColorScheme[2]; const primaryBackground = useDarkTheme ? blockNoteColorScheme[6] @@ -52,7 +52,7 @@ export const getBlockNoteTheme = ( const primaryText = useDarkTheme ? blockNoteColorScheme[2] - : blockNoteColorScheme[6]; + : blockNoteColorScheme[5]; const secondaryText = useDarkTheme ? blockNoteColorScheme[4] : blockNoteColorScheme[4]; @@ -62,11 +62,11 @@ export const getBlockNoteTheme = ( : blockNoteColorScheme[1]; const hoveredText = useDarkTheme ? blockNoteColorScheme[2] - : blockNoteColorScheme[6]; + : blockNoteColorScheme[5]; const selectedBackground = useDarkTheme ? blockNoteColorScheme[8] - : blockNoteColorScheme[6]; + : blockNoteColorScheme[5]; const selectedText = useDarkTheme ? blockNoteColorScheme[2] : blockNoteColorScheme[0]; diff --git a/packages/website/docs/.vitepress/theme/components/Examples/BlockNote/BlockNoteElement.vue b/packages/website/docs/.vitepress/theme/components/Examples/BlockNote/BlockNoteElement.vue index 0026e4879c..1d424c0375 100644 --- a/packages/website/docs/.vitepress/theme/components/Examples/BlockNote/BlockNoteElement.vue +++ b/packages/website/docs/.vitepress/theme/components/Examples/BlockNote/BlockNoteElement.vue @@ -1,20 +1,20 @@ diff --git a/packages/website/docs/data.ts b/packages/website/docs/data.ts index 6b5adc2f01..fa61843941 100644 --- a/packages/website/docs/data.ts +++ b/packages/website/docs/data.ts @@ -7,17 +7,17 @@ export interface Sponsors { export const sponsors: Sponsors[] = [ { name: "Fermat", - imgDark: "/img/sponsors/typecell.svg", + imgDark: "/img/sponsors/typecell-dark.svg", imgLight: "/img/sponsors/typecell.svg", }, { name: "NLNet", - imgDark: "/img/sponsors/fermat.png", + imgDark: "/img/sponsors/fermat-dark.png", imgLight: "/img/sponsors/fermat.png", }, { name: "TypeCell", - imgDark: "/img/sponsors/nlnet.svg", + imgDark: "/img/sponsors/nlnet-dark.svg", imgLight: "/img/sponsors/nlnet.svg", }, ]; @@ -33,44 +33,44 @@ export const featuresCardData: FeaturesCardData[] = [ { title: "Animations", description: "", - bgImgDark: "/img/features/animations.gif", + bgImgDark: "/img/features/animations-dark.gif", bgImgLight: "/img/features/animations.gif", }, { title: "Real-time collaboration", description: "", - bgImgDark: "/img/features/collaboration.gif", + bgImgDark: "/img/features/collaboration-dark.gif", bgImgLight: "/img/features/collaboration.gif", }, { title: "Helpful placeholders", description: "", - bgImgDark: "/img/features/placeholders.gif", + bgImgDark: "/img/features/placeholders-dark.gif", bgImgLight: "/img/features/placeholders.gif", }, { title: "Nesting & indentation", description: "", - bgImgDark: "/img/features/nesting.gif", + bgImgDark: "/img/features/nesting-dark.gif", bgImgLight: "/img/features/nesting.gif", }, { title: "Drag and drop blocks", description: "", - bgImgDark: "/img/features/dragdrop.gif", + bgImgDark: "/img/features/dragdrop-dark.gif", bgImgLight: "/img/features/dragdrop.gif", }, { title: "Customizable slash (/) menu", description: "", - bgImgDark: "/img/features/slashmenu.gif", + bgImgDark: "/img/features/slashmenu-dark.gif", bgImgLight: "/img/features/slashmenu.gif", }, { title: "Format menu", description: "", - bgImgDark: "/img/features/selectmenu.gif", - bgImgLight: "/img/features/selectmenu.gif", + bgImgDark: "/img/features/formattingtoolbar-dark.gif", + bgImgLight: "/img/features/formattingtoolbar.gif", }, ]; diff --git a/packages/website/docs/docs/block-types.md b/packages/website/docs/docs/block-types.md index ecb59f73de..e405533cdc 100644 --- a/packages/website/docs/docs/block-types.md +++ b/packages/website/docs/docs/block-types.md @@ -5,6 +5,13 @@ imageTitle: Block Types & Properties path: /docs/block-types --- + + # Block Types & Properties A block's type affects how it looks and behaves in the editor. Each type also comes with its own set of properties, each having a string value, which further affect the block's appearance and behaviour. @@ -17,7 +24,7 @@ BlockNote includes a number of built-in block types, each with their own set of **Appearance** -image +image **Type & Props** @@ -35,7 +42,7 @@ type ParagraphBlock = { **Appearance** -image +image **Type & Props** @@ -57,7 +64,7 @@ type HeadingBlock = { **Appearance** -image +image **Type & Props** @@ -75,7 +82,7 @@ type BulletListItemBlock = { **Appearance** -image +image **Type & Props** @@ -113,7 +120,7 @@ In addition to the default block types that BlockNote offers, you can also make ::: sandbox {template=react-ts} -```typescript /App.tsx +```typescript-vue /App.tsx import { BlockNoteEditor, defaultBlockSchema, @@ -142,15 +149,8 @@ export default function App() { }, containsInlineContent: true, render: ({ block }) => ( -
+
{"Image"} +import { useData } from 'vitepress'; +import { getTheme, getStyles } from "./demoUtils"; + +const { isDark } = useData(); + + # Introduction to Blocks So, you've set up a BlockNote editor and your users can start writing content, organized in blocks. What are blocks exactly, and how do we access the blocks from code? @@ -38,7 +45,7 @@ function App() { So, BlockNote is centered around the idea of blocks. A block - like a heading, paragraph, or list item - contains a piece of content and optionally nested blocks: -image +image In code, the `Block` type is used to describe any given block in the editor: @@ -68,7 +75,7 @@ Now that we know how blocks are represented in code, let's take a look at the li ::: sandbox {template=react-ts} -```typescript /App.tsx +```typescript-vue /App.tsx import { useState } from "react"; import { BlockNoteEditor, Block } from "@blocknote/core"; import { BlockNoteView, useBlockNote } from "@blocknote/react"; @@ -80,6 +87,7 @@ export default function App() { // Creates a new editor instance. const editor: BlockNoteEditor | null = useBlockNote({ + theme: "{{ getTheme(isDark) }}", // Listens for when the editor's contents change. onEditorContentChange: (editor: BlockNoteEditor) => // Converts the editor's contents to an array of Block objects. @@ -97,4 +105,12 @@ export default function App() { } ``` +```css-vue /styles.css [hidden] +{{ getStyles(isDark) }} + +pre { + color: gray; +} +``` + ::: diff --git a/packages/website/docs/docs/converting-blocks.md b/packages/website/docs/docs/converting-blocks.md index 3a78593fbc..0f214f5e2c 100644 --- a/packages/website/docs/docs/converting-blocks.md +++ b/packages/website/docs/docs/converting-blocks.md @@ -5,6 +5,13 @@ imageTitle: Markdown & HTML path: /docs/converting-blocks --- + + # Markdown & HTML It's possible to export or import Blocks to and from Markdown and HTML. @@ -43,7 +50,7 @@ The output is simplified as Markdown does not support all features of BlockNote ::: sandbox {template=react-ts} -```typescript /App.tsx +```typescript-vue /App.tsx import { useState } from "react"; import { BlockNoteEditor } from "@blocknote/core"; import { BlockNoteView, useBlockNote } from "@blocknote/react"; @@ -55,6 +62,7 @@ export default function App() { // Creates a new editor instance. const editor: BlockNoteEditor | null = useBlockNote({ + theme: "{{ getTheme(isDark) }}", // Listens for when the editor's contents change. onEditorContentChange: (editor: BlockNoteEditor) => { // Converts the editor's contents from Block objects to Markdown and @@ -72,12 +80,21 @@ export default function App() { return (
-
{markdown}
+
{markdown}
); } ``` +```css-vue /styles.css [hidden] +{{ getStyles(isDark) }} + +pre { + color: gray; + white-space: pre-wrap; +} +``` + ::: ### Converting Markdown to Blocks @@ -104,7 +121,7 @@ Tries to create `Block` and `InlineNode` objects based on Markdown syntax, thoug ::: sandbox {template=react-ts} -```typescript /App.tsx +```typescript-vue /App.tsx import { useEffect, useState } from "react"; import { BlockNoteEditor, Block } from "@blocknote/core"; import { BlockNoteView, useBlockNote } from "@blocknote/react"; @@ -116,6 +133,7 @@ export default function App() { // Creates a new editor instance. const editor: BlockNoteEditor | null = useBlockNote({ + theme: "{{ getTheme(isDark) }}", // Makes the editor non-editable. editable: false }) @@ -137,7 +155,6 @@ export default function App() { return (