-
-
Notifications
You must be signed in to change notification settings - Fork 618
refactor: move all blocks to use the custom blocks API #1904
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
Merged
Merged
Changes from 54 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
fcdbf18
feat: wip
nperez0111 e1bb45e
feat: topological sorting, input rules and keyboard shortcuts
nperez0111 6b10846
feat: move code block over too
nperez0111 92952e7
feat: `getContent` parsing for custom blocks
nperez0111 6d85ef5
fix: render toggle lists
nperez0111 ec77940
fix: toggle headings
nperez0111 809ea0a
refactor: custom schema, which depends on no blocks
nperez0111 b46fcc6
refactor: trying to fit it in
nperez0111 5751974
fix: get tables working
nperez0111 c51767a
Made type guards more generic
matthewlipski 97295ce
Updated type guard definitions
matthewlipski 1ff7474
Small fix
matthewlipski 9918510
feat: getting somewhere
nperez0111 1e0e059
Merge branch 'default-blocks-type-guards' into default-blocks
nperez0111 fc9e452
Removed `checkDefaultInlineContentTypeInSchema`
matthewlipski a0fc6e2
Small fixes
matthewlipski cda8eb6
fix: better parsing for headings
nperez0111 55957cd
chore: minor fix
nperez0111 dba7321
fix: widen type?
nperez0111 760be84
Merge branch 'default-blocks-type-guards' into default-blocks
nperez0111 f934d26
fix: remove tiptapblockimplementation
nperez0111 060108a
feat: Default blocks refactor fixes (#1953)
matthewlipski 01478cd
Merge branch 'main' into default-blocks
nperez0111 cb8150c
refactor: settle the API a bit, migrate React to the new API, update …
nperez0111 ba57b93
feat: allow extending `blockSpecs` on a schema
nperez0111 71db2ba
build: trying to get the build to build again
nperez0111 36b9bd9
Merge branch 'main' into default-blocks
nperez0111 e41c137
chore: update prosemirror-model
nperez0111 1ddef1b
build: get things building again
nperez0111 62be3e2
test: get the tests further along
nperez0111 fda7be0
chore: rm unused
nperez0111 81c8d20
fix: better typing & support for hardBreakShortcut
nperez0111 ff2f039
Fixed export/copy test failures
matthewlipski fdbc419
Merge branch 'main' into default-blocks
nperez0111 41b2e43
fix: update the extend types
nperez0111 cf31ed6
chore: avoid withMultiColumn
nperez0111 a6ea62d
Fixed React export tests
matthewlipski 703f86e
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski cd90895
Fixed most parse tests
matthewlipski 258520f
Merge branch 'main' into default-blocks
matthewlipski dbc0c44
fix: minor typing bug
nperez0111 e3e4f5b
feat: inline content custom parse function
nperez0111 fc98fb8
Merge branch 'main' into default-blocks
nperez0111 ac0d392
Fixed remaining parse/paste issues
matthewlipski 467b33d
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski f6cb1f9
Reverted example changes
matthewlipski a0e9443
Made select not render in code block if it has no options
matthewlipski 5e3cad6
Updated unit test snaps
matthewlipski 069f88f
chore: simpler `as const`
nperez0111 f4a0316
fix: rm heading & code-block opts
nperez0111 26b9b1c
Removed `codeBlock` and `heading` editor options & updated custom cod…
matthewlipski 356aedc
Merge branch 'default-blocks-deprecate-options' into default-blocks
matthewlipski 80963f4
Update examples
matthewlipski 8ef6188
Updated code block docs & package export name
matthewlipski 6b7bad8
chore: update comments
nperez0111 5dc2544
Fixed React custom block interactivity not working & added tests
matthewlipski 87e57e3
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski 17398cc
fix: update the types to have better inference based on options provided
nperez0111 95c493a
build: get build working again with better types
nperez0111 41d1449
build: finally get all the builds building
nperez0111 a92d1e7
fix: set default value
nperez0111 422cccb
fix: remove pageBreak from default schema
nperez0111 52a018c
refactor: move `meta` to block implementation instead of block config
nperez0111 84d50ce
test: update snap since order changed
nperez0111 05fbc87
chore: rm unused line
nperez0111 f242a2f
Minor fixes
matthewlipski 59a7a63
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski b16a9ac
refactor: remove the strongly typed tiptap node abstraction
nperez0111 11f8633
feat: add `toExternalHTML` for custom inline content
nperez0111 b17a8d8
feat: support for react custom inline content
nperez0111 caf7ffd
Updated/fixed most e2e tests
matthewlipski b582be8
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski f9bca88
Updated remaining e2e snaps
matthewlipski ce882f1
fix: get the project to build again
nperez0111 eb049e2
refactor: remove `data-index` on numbered list item serialization
nperez0111 474897b
feat: support internal HTML as different from external HTML for inlin…
nperez0111 b4b56a9
chore: must please the linter
nperez0111 4b9d5d0
chore: minor changes
nperez0111 3f83c75
Merge branch 'main' into default-blocks
nperez0111 89ad4d5
Fixed old bug with HTML export not filling in unspecified props which…
matthewlipski 6c0211a
Merge branch 'default-blocks' of github.com:TypeCellOS/BlockNote into…
matthewlipski 52c7075
build: get build working again
nperez0111 4b40c57
refactor: use higher-level APIs
nperez0111 fdcfffb
refactor: export block types (and move blocks to separate sub-export)
nperez0111 3174b5b
chore: use helper function
nperez0111 cd788ad
refactor: move draggable to implementation
nperez0111 ddd3adf
fix: External HTML parse/export cases (#1991)
matthewlipski 6e4beff
Merge branch 'main' into default-blocks
nperez0111 0246290
chore: rm console
nperez0111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# Code Block Syntax Highlighting | ||
|
||
To enable code block syntax highlighting, you can use the `codeBlock` option in the `useCreateBlockNote` hook. This is excluded by default to reduce bundle size. | ||
To enable code block syntax highlighting, you can extend the editor's default schema with a new `codeBlock`, which you can pass options into when creating. By passing the default options from `@blocknote/code-block`, you can enable syntax highlighting. This is excluded by default to reduce bundle size. | ||
|
||
**Relevant Docs:** | ||
|
||
- [Code Block Syntax Highlighting](/docs/features/blocks/code-blocks) | ||
- [Editor Setup](/docs/getting-started/editor-setup) | ||
- [Custom Schema](/docs/features/custom-schemas) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,11 @@ | ||
# Custom Code Block Theme & Language | ||
|
||
To configure a code block highlighting theme and language, you can use the `codeBlock` option in the `useCreateBlockNote` hook. | ||
To configure a code block highlighting theme and language, you can extend the editor's default schema with a new `codeBlock`, which you can pass options into when creating. You can then use a shiki highlighter to add custom syntax highlighting. | ||
|
||
This allows you to configure a shiki highlighter for the code blocks of your editor, allowing you to tailor the themes and languages you would like to use. | ||
|
||
To create a syntax highlighter, you can use the [shiki-codegen](https://shiki.style/packages/codegen) CLI for generating the code to create a syntax highlighter for your languages and themes. | ||
|
||
For example to create a syntax highlighter using the optimized javascript engine, javascript, typescript, vue, with light and dark themes, you can run the following command: | ||
|
||
```bash | ||
npx shiki-codegen --langs javascript,typescript,vue --themes light,dark --engine javascript --precompiled ./shiki.bundle.ts | ||
``` | ||
|
||
This will generate a `shiki.bundle.ts` file that you can use to create a syntax highlighter for your editor. | ||
|
||
Like this: | ||
|
||
```ts | ||
import { createHighlighter } from "./shiki.bundle"; | ||
|
||
export default function App() { | ||
// Creates a new editor instance. | ||
const editor = useCreateBlockNote({ | ||
codeBlock: { | ||
indentLineWithTab: true, | ||
defaultLanguage: "typescript", | ||
supportedLanguages: { | ||
typescript: { | ||
name: "TypeScript", | ||
aliases: ["ts"], | ||
}, | ||
}, | ||
createHighlighter: () => | ||
createHighlighter({ | ||
themes: ["light-plus", "dark-plus"], | ||
langs: [], | ||
}), | ||
}, | ||
}); | ||
|
||
return <BlockNoteView editor={editor} />; | ||
} | ||
``` | ||
First use the [shiki-codegen](https://shiki.style/packages/codegen) CLI to create a `shiki.bundle.ts` file. You can then pass this file into the `codeBlock` options when creating it. | ||
|
||
**Relevant Docs:** | ||
|
||
- [Code Blocks](/docs/features/blocks/code-blocks) | ||
- [shiki-codegen](https://shiki.style/packages/codegen) | ||
- [Custom Schema](/docs/features/custom-schemas) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.