@blocknote/core 0.4.6-alpha.1 → 0.4.6-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -34
- package/dist/blocknote.js +31 -29
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +2 -2
- package/dist/blocknote.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/BlockNoteEditor.ts +2 -2
- package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +3 -3
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +2 -2
- package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +2 -2
- package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +1 -1
- package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.ts +6 -0
- package/types/src/BlockNoteEditor.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocknote/core",
|
|
3
|
-
"homepage": "https://github.com/
|
|
3
|
+
"homepage": "https://github.com/TypeCellOS/BlockNote",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "0.4.6-alpha.
|
|
6
|
+
"version": "0.4.6-alpha.4",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"types",
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"access": "public",
|
|
110
110
|
"registry": "https://registry.npmjs.org/"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "4ec9f17bdaa504a53eb080909e0e6c22ba071b61"
|
|
113
113
|
}
|
package/src/BlockNoteEditor.ts
CHANGED
|
@@ -38,7 +38,7 @@ export type BlockNoteEditorOptions = {
|
|
|
38
38
|
slashCommands: BaseSlashMenuItem[];
|
|
39
39
|
parentElement: HTMLElement;
|
|
40
40
|
editorDOMAttributes: Record<string, string>;
|
|
41
|
-
|
|
41
|
+
onEditorReady: (editor: BlockNoteEditor) => void;
|
|
42
42
|
onEditorContentChange: (editor: BlockNoteEditor) => void;
|
|
43
43
|
onTextCursorPositionChange: (editor: BlockNoteEditor) => void;
|
|
44
44
|
|
|
@@ -75,7 +75,7 @@ export class BlockNoteEditor {
|
|
|
75
75
|
...blockNoteTipTapOptions,
|
|
76
76
|
...options._tiptapOptions,
|
|
77
77
|
onCreate: () => {
|
|
78
|
-
options.
|
|
78
|
+
options.onEditorReady?.(this);
|
|
79
79
|
},
|
|
80
80
|
onUpdate: () => {
|
|
81
81
|
options.onEditorContentChange?.(this);
|
|
@@ -48,17 +48,17 @@ export const HeadingBlockContent = Node.create({
|
|
|
48
48
|
{
|
|
49
49
|
tag: "h1",
|
|
50
50
|
attrs: { level: "1" },
|
|
51
|
-
node: "
|
|
51
|
+
node: "heading",
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
tag: "h2",
|
|
55
55
|
attrs: { level: "2" },
|
|
56
|
-
node: "
|
|
56
|
+
node: "heading",
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
tag: "h3",
|
|
60
60
|
attrs: { level: "3" },
|
|
61
|
-
node: "
|
|
61
|
+
node: "heading",
|
|
62
62
|
},
|
|
63
63
|
];
|
|
64
64
|
},
|
|
@@ -53,7 +53,7 @@ export const BulletListItemBlockContent = Node.create({
|
|
|
53
53
|
|
|
54
54
|
return false;
|
|
55
55
|
},
|
|
56
|
-
node: "
|
|
56
|
+
node: "bulletListItem",
|
|
57
57
|
},
|
|
58
58
|
// Case for BlockNote list structure.
|
|
59
59
|
{
|
|
@@ -76,7 +76,7 @@ export const BulletListItemBlockContent = Node.create({
|
|
|
76
76
|
return false;
|
|
77
77
|
},
|
|
78
78
|
priority: 300,
|
|
79
|
-
node: "
|
|
79
|
+
node: "bulletListItem",
|
|
80
80
|
},
|
|
81
81
|
];
|
|
82
82
|
},
|
|
@@ -73,7 +73,7 @@ export const NumberedListItemBlockContent = Node.create({
|
|
|
73
73
|
|
|
74
74
|
return false;
|
|
75
75
|
},
|
|
76
|
-
node: "
|
|
76
|
+
node: "numberedListItem",
|
|
77
77
|
},
|
|
78
78
|
// Case for BlockNote list structure.
|
|
79
79
|
// (e.g.: when pasting from blocknote)
|
|
@@ -97,7 +97,7 @@ export const NumberedListItemBlockContent = Node.create({
|
|
|
97
97
|
return false;
|
|
98
98
|
},
|
|
99
99
|
priority: 300,
|
|
100
|
-
node: "
|
|
100
|
+
node: "numberedListItem",
|
|
101
101
|
},
|
|
102
102
|
];
|
|
103
103
|
},
|
|
@@ -38,6 +38,12 @@ function getDraggableBlockFromCoords(
|
|
|
38
38
|
coords: { left: number; top: number },
|
|
39
39
|
view: EditorView
|
|
40
40
|
) {
|
|
41
|
+
if (!view.dom.isConnected) {
|
|
42
|
+
// view is not connected to the DOM, this can cause posAtCoords to fail
|
|
43
|
+
// (Cannot read properties of null (reading 'nearestDesc'), https://github.com/TypeCellOS/BlockNote/issues/123)
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
let pos = view.posAtCoords(coords);
|
|
42
48
|
if (!pos) {
|
|
43
49
|
return undefined;
|
|
@@ -10,7 +10,7 @@ export type BlockNoteEditorOptions = {
|
|
|
10
10
|
slashCommands: BaseSlashMenuItem[];
|
|
11
11
|
parentElement: HTMLElement;
|
|
12
12
|
editorDOMAttributes: Record<string, string>;
|
|
13
|
-
|
|
13
|
+
onEditorReady: (editor: BlockNoteEditor) => void;
|
|
14
14
|
onEditorContentChange: (editor: BlockNoteEditor) => void;
|
|
15
15
|
onTextCursorPositionChange: (editor: BlockNoteEditor) => void;
|
|
16
16
|
_tiptapOptions: any;
|