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

refactor: Extract Mantine & Ariakit packages #689

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
},
},
},
ignorePatterns: ["**/ui/*"],
rules: {
curly: 1,
"import/no-extraneous-dependencies": [
Expand Down
5 changes: 3 additions & 2 deletions docs/components/pages/landing/hero/DemoEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { uploadToTmpFilesDotOrg_DEV_ONLY } from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import { useCallback, useMemo, useState } from "react";
import YPartyKitProvider from "y-partykit/provider";
import * as Y from "yjs";
Expand Down
3 changes: 3 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"dependencies": {
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"@headlessui/react": "^1.7.18",
"@mantine/core": "^7.5.0",
"@next/bundle-analyzer": "^14.1.0",
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Getting started with BlockNote is quick and easy. Install the required packages
To install BlockNote with [NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), run:

```console
npm install @blocknote/core @blocknote/react
npm install @blocknote/core @blocknote/react @blocknote/mantine
```

## Creating an Editor
Expand All @@ -26,7 +26,7 @@ With the `useCreateBlockNote` hook, we can create a new editor instance, then us

<Example name="basic/minimal" />

We also import `@blocknote/react/style.css` to add default styling for the editor and the `Inter` font that BlockNote exports (optional).
We also import `@blocknote/mantine/style.css` to add default styling for the editor and the `Inter` font that BlockNote exports (optional).

<Callout type="warning" emoji={""}>
<strong>Next.js usage (or other server-side React frameworks)</strong>
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/01-minimal/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";

export default function App() {
// Creates a new editor instance.
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/01-minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/02-block-objects/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Block } from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import { useState } from "react";

import "./styles.css";
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/02-block-objects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/03-all-blocks/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";

export default function App() {
// Creates a new editor instance.
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/03-all-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/04-selection-blocks/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Block } from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import { useState } from "react";

import "./styles.css";
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/04-selection-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/05-block-manipulation/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";

import "./styles.css";

Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/05-block-manipulation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions examples/01-basic/06-file-uploading/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";

// Uploads a file to tmpfiles.org and returns the URL to the uploaded file.
async function uploadFile(file: File) {
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/06-file-uploading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/01-basic/07-saving-loading/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Block, BlockNoteEditor, PartialBlock } from "@blocknote/core";
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView } from "@blocknote/react";
import "@blocknote/react/style.css";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import { useEffect, useMemo, useState } from "react";

async function saveToStorage(jsonBlocks: Block[]) {
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/07-saving-loading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
14 changes: 12 additions & 2 deletions examples/01-basic/08-shadcn/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import "@blocknote/core/fonts/inter.css";
import { useCreateBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";
import { BlockNoteView } from "@blocknote/shadcn";
import "@blocknote/shadcn/style.css";

export default function App() {
// Creates a new editor instance.
const editor = useCreateBlockNote();

// Renders the editor instance using a React component.
return <BlockNoteView editor={editor} />;
return (
<BlockNoteView
editor={editor}
shadCNComponents={
{
// Pass modified ShadCN components from your project here.
// Otherwise, the default ShadCN components will be used.
}
}
/>
);
}
4 changes: 2 additions & 2 deletions examples/01-basic/08-shadcn/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Basic Setup TODO
# Use with ShadCN

This example shows the minimal code required to set up a BlockNote editor in React.
This example shows how you can integrate BlockNote with ShadCN, replacing the default Mantine UI with ShadCN components.

**Relevant Docs:**

Expand Down
2 changes: 1 addition & 1 deletion examples/01-basic/08-shadcn/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Basic Setup TODO</title>
<title>Use with ShadCN</title>
</head>
<body>
<div id="root"></div>
Expand Down
7 changes: 5 additions & 2 deletions examples/01-basic/08-shadcn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.0",
"@blocknote/react": "^0.12.0",
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
6 changes: 6 additions & 0 deletions examples/01-basic/09-ariakit/.bnexample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"playground": true,
"docs": true,
"author": "matthewlipski",
"tags": ["Basic"]
}
12 changes: 12 additions & 0 deletions examples/01-basic/09-ariakit/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "@blocknote/core/fonts/inter.css";
import { useCreateBlockNote } from "@blocknote/react";
import { BlockNoteView } from "@blocknote/ariakit";
import "@blocknote/ariakit/style.css";

export default function App() {
// Creates a new editor instance.
const editor = useCreateBlockNote();

// Renders the editor instance using a React component.
return <BlockNoteView editor={editor} />;
}
7 changes: 7 additions & 0 deletions examples/01-basic/09-ariakit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use with Ariakit

This example shows how you can integrate BlockNote with Ariakit, replacing the default Mantine UI with Ariakit components.

**Relevant Docs:**

- [Editor Setup](/docs/editor-basics/setup)
14 changes: 14 additions & 0 deletions examples/01-basic/09-ariakit/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html lang="en">
<head>
<script>
<!-- AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY -->
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Use with Ariakit</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";

import { Button } from "./components/ui/button";
import "./style.css";
const root = createRoot(document.getElementById("root")!);
root.render(
<React.StrictMode>
<Button variant="ghost" size="icon">
{/* <Archive className="h-4 w-4" /> */}
hello
</Button>
<App />
</React.StrictMode>
);
37 changes: 37 additions & 0 deletions examples/01-basic/09-ariakit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@blocknote/example-ariakit",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.0",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@blocknote/core": "^0.12.1",
"@blocknote/react": "^0.12.2",
"@blocknote/ariakit": "^0.12.2",
"@blocknote/mantine": "^0.12.2",
"@blocknote/shadcn": "^0.12.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^4.0.4",
"eslint": "^8.10.0",
"vite": "^4.4.8"
},
"eslintConfig": {
"extends": [
"../../../.eslintrc.js"
]
},
"eslintIgnore": [
"dist"
]
}
Loading
Loading