Skip to content

Commit 509470b

Browse files
docs: Mantine update (#502)
* Updated Mantine & moved theming to CSS * Added `package-lock.json` * Fixed test selectors * Changed styles to not use nesting * add react/style.css * Styling fixes and updated test screenshots * Removed redundant stylesheet * Implemented PR feedback * Small color fix * Implemented PR feedback * Implemented PR feedback * Implemented PR feedback * Implemented PR feedback * Implemented PR feedback * Added `.bn-container` prefix to all BlockNote styles (fixes CSS rule specificity issues caused by prev commit) * Updated theming & styling docs * @blocknote/core/style.css -> @blocknote/react/style.css in docs * Example fix * Added feedback * Removed old comment --------- Co-authored-by: yousefed <[email protected]>
1 parent 2f0bada commit 509470b

23 files changed

+265
-197
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Play with the editor @ [https://blocknote-main.vercel.app/](https://blocknote-ma
3535

3636
```typescript
3737
import { BlockNoteView, useBlockNote } from "@blocknote/react";
38-
import "@blocknote/core/style.css";
38+
import "@blocknote/react/style.css";
3939

4040
function App() {
4141
const editor = useBlockNote({

packages/react/src/editor/BlockNoteTheme.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
export type CombinedColor = {
1+
export type CombinedColor = Partial<{
22
text: string;
33
background: string;
4-
};
4+
}>;
55

6-
export type ColorScheme = {
6+
export type ColorScheme = Partial<{
77
editor: CombinedColor;
88
menu: CombinedColor;
99
tooltip: CombinedColor;
@@ -13,7 +13,7 @@ export type ColorScheme = {
1313
shadow: string;
1414
border: string;
1515
sideMenu: string;
16-
highlights: {
16+
highlights: Partial<{
1717
gray: CombinedColor;
1818
brown: CombinedColor;
1919
red: CombinedColor;
@@ -23,14 +23,14 @@ export type ColorScheme = {
2323
blue: CombinedColor;
2424
purple: CombinedColor;
2525
pink: CombinedColor;
26-
};
27-
};
26+
}>;
27+
}>;
2828

29-
export type Theme = {
29+
export type Theme = Partial<{
3030
colors: ColorScheme;
3131
borderRadius: number;
3232
fontFamily: string;
33-
};
33+
}>;
3434

3535
type NestedObject = { [key: string]: number | string | NestedObject };
3636

packages/react/src/editor/styles.css

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
@import url("@mantine/core/styles.css");
2-
/* TODO: Cannot resolve file? */
32
@import url("@blocknote/core/style.css");
43

54
/* Default theme params */
65
.bn-container {
7-
/* TODO: Do we want this? If yes, we should probably have a similar
8-
shorthand in the Theme object */
9-
--bn-colors-text: #3F3F3F;
10-
--bn-colors-background: #FFFFFF;
11-
12-
--bn-colors-editor-text: var(--bn-colors-text);
13-
--bn-colors-editor-background: var(--bn-colors-background);
14-
--bn-colors-menu-text: var(--bn-colors-text);
15-
--bn-colors-menu-background: var(--bn-colors-background);
16-
--bn-colors-tooltip-text: var(--bn-colors-text);
6+
--bn-colors-editor-text: #3F3F3F;
7+
--bn-colors-editor-background: #FFFFFF;
8+
--bn-colors-menu-text: #3F3F3F;
9+
--bn-colors-menu-background: #FFFFFF;
10+
--bn-colors-tooltip-text: #3F3F3F;
1711
--bn-colors-tooltip-background: #EFEFEF;
18-
--bn-colors-hovered-text: var(--bn-colors-text);
12+
--bn-colors-hovered-text: #3F3F3F;
1913
--bn-colors-hovered-background: #EFEFEF;
2014
--bn-colors-selected-text: #FFFFFF;
21-
--bn-colors-selected-background: var(--bn-colors-text);
15+
--bn-colors-selected-background: #3F3F3F;
2216
--bn-colors-disabled-text: #AFAFAF;
2317
--bn-colors-disabled-background: #EFEFEF;
2418

@@ -58,10 +52,13 @@
5852
}
5953

6054
.bn-container[data-color-scheme="dark"] {
61-
--bn-colors-text: #CFCFCF;
62-
--bn-colors-background: #1F1F1F;
63-
55+
--bn-colors-editor-text: #CFCFCF;
56+
--bn-colors-editor-background: #1F1F1F;
57+
--bn-colors-menu-text: #CFCFCF;
58+
--bn-colors-menu-background: #1F1F1F;
59+
--bn-colors-tooltip-text: #CFCFCF;
6460
--bn-colors-tooltip-background: #161616;
61+
--bn-colors-hovered-text: #CFCFCF;
6562
--bn-colors-hovered-background: #161616;
6663
--bn-colors-selected-text: #CFCFCF;
6764
--bn-colors-selected-background: #0F0F0F;

packages/website/docs/docs/block-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ import {
179179
ReactSlashMenuItem,
180180
getDefaultReactSlashMenuItems,
181181
} from "@blocknote/react";
182-
import "@blocknote/core/style.css";
182+
import "@blocknote/react/style.css";
183183
import { RiText } from "react-icons/ri";
184184

185185
export default function App() {

packages/website/docs/docs/blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ We'll go through the full API later in this section, but let's start with a simp
2323

2424
```typescript
2525
import { BlockNoteView, useBlockNote } from "@blocknote/react";
26-
import "@blocknote/core/style.css";
26+
import "@blocknote/react/style.css";
2727

2828
function App() {
2929
// Creates a new editor instance.
@@ -79,7 +79,7 @@ Now that we know how blocks are represented in code, let's take a look at the li
7979
import { useState } from "react";
8080
import { BlockNoteEditor, Block } from "@blocknote/core";
8181
import { BlockNoteView, useBlockNote } from "@blocknote/react";
82-
import "@blocknote/core/style.css";
82+
import "@blocknote/react/style.css";
8383

8484
export default function App() {
8585
// Stores the editor's contents as an array of Block objects.

packages/website/docs/docs/converting-blocks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The output is simplified as Markdown does not support all features of BlockNote
5454
import { useState } from "react";
5555
import { BlockNoteEditor } from "@blocknote/core";
5656
import { BlockNoteView, useBlockNote } from "@blocknote/react";
57-
import "@blocknote/core/style.css";
57+
import "@blocknote/react/style.css";
5858

5959
export default function App() {
6060
// Stores the editor's contents as Markdown.
@@ -124,7 +124,7 @@ Tries to create `Block` and `InlineNode` objects based on Markdown syntax, thoug
124124
import { useEffect, useState } from "react";
125125
import { BlockNoteEditor, Block } from "@blocknote/core";
126126
import { BlockNoteView, useBlockNote } from "@blocknote/react";
127-
import "@blocknote/core/style.css";
127+
import "@blocknote/react/style.css";
128128

129129
export default function App() {
130130
// Stores the current Markdown content.
@@ -207,7 +207,7 @@ To better conform to HTML standards, children of blocks which aren't list items
207207
import { useState } from "react";
208208
import { BlockNoteEditor } from "@blocknote/core";
209209
import { BlockNoteView, useBlockNote } from "@blocknote/react";
210-
import "@blocknote/core/style.css";
210+
import "@blocknote/react/style.css";
211211

212212
export default function App() {
213213
// Stores the editor's contents as HTML.
@@ -276,7 +276,7 @@ Tries to create `Block` objects out of any HTML block-level elements, and `Inlin
276276
import { useEffect, useState } from "react";
277277
import { BlockNoteEditor, Block } from "@blocknote/core";
278278
import { BlockNoteView, useBlockNote } from "@blocknote/react";
279-
import "@blocknote/core/style.css";
279+
import "@blocknote/react/style.css";
280280

281281
export default function App() {
282282
// Stores the current HTML content.

packages/website/docs/docs/cursor-selections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If you need a visualization for which block contains the text cursor, the demo b
8686
```typescript-vue /App.tsx
8787
import { BlockNoteEditor, Block } from "@blocknote/core";
8888
import { BlockNoteView, useBlockNote } from "@blocknote/react";
89-
import "@blocknote/core/style.css";
89+
import "@blocknote/react/style.css";
9090

9191
export default function App() {
9292
// Creates a new editor instance.
@@ -173,7 +173,7 @@ If you need a visualization for which blocks the text cursor spans, the demo bel
173173
```typescript-vue /App.tsx
174174
import { BlockNoteEditor, Block } from "@blocknote/core";
175175
import { BlockNoteView, useBlockNote } from "@blocknote/react";
176-
import "@blocknote/core/style.css";
176+
import "@blocknote/react/style.css";
177177

178178
export default function App() {
179179
// Creates a new editor instance.

packages/website/docs/docs/formatting-toolbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
useEditorContentChange,
4343
useEditorSelectionChange,
4444
} from "@blocknote/react";
45-
import "@blocknote/core/style.css";
45+
import "@blocknote/react/style.css";
4646

4747
const CustomFormattingToolbar = (props: { editor: BlockNoteEditor }) => {
4848
// Tracks whether the text & background are both blue.

packages/website/docs/docs/image-toolbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
uploadToTmpFilesDotOrg_DEV_ONLY,
4141
} from "@blocknote/core";
4242
import { BlockNoteView, useBlockNote } from "@blocknote/react";
43-
import "@blocknote/core/style.css";
43+
import "@blocknote/react/style.css";
4444

4545
export default function App() {
4646
// Creates a new editor instance.

packages/website/docs/docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ See how to set up your own editor in the [Quickstart](/docs/quickstart). Here's
4848
```typescript-vue /App.tsx
4949
import { BlockNoteEditor } from "@blocknote/core";
5050
import { BlockNoteView, useBlockNote } from "@blocknote/react";
51-
import "@blocknote/core/style.css";
51+
import "@blocknote/react/style.css";
5252

5353
export default function App() {
5454
// Creates a new editor instance.

0 commit comments

Comments
 (0)