@blocknote/core 0.11.0 → 0.11.1
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/dist/blocknote.js +12 -10
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -5
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +24 -10
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -1
- package/src/editor/Block.css +4 -0
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +5 -3
- package/src/extensions/SideMenu/SideMenuPlugin.ts +4 -1
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +1 -1
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1705891753224,"assets":[{"name":"blocknote.umd.cjs","size":100808},{"name":"blocknote.umd.cjs.map","size":454558}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11959,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2272,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":2687,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1059,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":697,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":432,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1724,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3701,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2781,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1613,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":2796,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/ImageToolbar/ImageToolbarPlugin.ts","size":3772,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":9277,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1106,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":2691,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3148,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":753,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1207,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1025,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":4471,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":549,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2022,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1054,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":4985,"chunks":["a1ee98a"]},{"name":"./src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts","size":7599,"chunks":["a1ee98a"]},{"name":"./src/extensions-shared/suggestion/SuggestionPlugin.ts","size":9492,"chunks":["a1ee98a"]},{"name":"./src/extensions/SlashMenu/SlashMenuPlugin.ts","size":839,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":15225,"chunks":["a1ee98a"]},{"name":"./src/extensions/SlashMenu/defaultSlashMenuItems.ts","size":4114,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":14723,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":2883,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1131,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":688,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderExtension.ts","size":2106,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":748,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":622,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":467,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4572,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":17340,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":3467,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1017,"chunks":["a1ee98a"]},{"name":"./src/editor/Block.css","size":17,"chunks":["a1ee98a"]},{"name":"./src/editor/editor.css","size":18,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":22030,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://github.com/TypeCellOS/BlockNote",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "0.11.
|
|
6
|
+
"version": "0.11.1",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"types",
|
|
@@ -50,9 +50,6 @@
|
|
|
50
50
|
"clean": "rimraf dist && rimraf types"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@emotion/cache": "^11.10.5",
|
|
54
|
-
"@emotion/serialize": "^1.1.1",
|
|
55
|
-
"@emotion/utils": "^1.2.0",
|
|
56
53
|
"@tiptap/core": "^2.0.3",
|
|
57
54
|
"@tiptap/extension-bold": "^2.0.3",
|
|
58
55
|
"@tiptap/extension-code": "^2.0.3",
|
|
@@ -115,5 +112,5 @@
|
|
|
115
112
|
"access": "public",
|
|
116
113
|
"registry": "https://registry.npmjs.org/"
|
|
117
114
|
},
|
|
118
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "5498743a60b9cbca16a973400d6c6dade210d68c"
|
|
119
116
|
}
|
|
@@ -148,6 +148,15 @@ export const renderImage = (
|
|
|
148
148
|
// offset from when the resize began, and which resize handle is being used.
|
|
149
149
|
const windowMouseMoveHandler = (event: MouseEvent) => {
|
|
150
150
|
if (!resizeParams) {
|
|
151
|
+
if (
|
|
152
|
+
!editor.isEditable &&
|
|
153
|
+
imageWrapper.contains(leftResizeHandle) &&
|
|
154
|
+
imageWrapper.contains(rightResizeHandle)
|
|
155
|
+
) {
|
|
156
|
+
imageWrapper.removeChild(leftResizeHandle);
|
|
157
|
+
imageWrapper.removeChild(rightResizeHandle);
|
|
158
|
+
}
|
|
159
|
+
|
|
151
160
|
return;
|
|
152
161
|
}
|
|
153
162
|
|
|
@@ -192,13 +201,11 @@ export const renderImage = (
|
|
|
192
201
|
// Stops mouse movements from resizing the image and updates the block's
|
|
193
202
|
// `width` prop to the new value.
|
|
194
203
|
const windowMouseUpHandler = (event: MouseEvent) => {
|
|
195
|
-
if (!resizeParams) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
204
|
// Hides the drag handles if the cursor is no longer over the image.
|
|
200
205
|
if (
|
|
201
|
-
(!event.target ||
|
|
206
|
+
(!event.target ||
|
|
207
|
+
!imageWrapper.contains(event.target as Node) ||
|
|
208
|
+
!editor.isEditable) &&
|
|
202
209
|
imageWrapper.contains(leftResizeHandle) &&
|
|
203
210
|
imageWrapper.contains(rightResizeHandle)
|
|
204
211
|
) {
|
|
@@ -206,6 +213,10 @@ export const renderImage = (
|
|
|
206
213
|
imageWrapper.removeChild(rightResizeHandle);
|
|
207
214
|
}
|
|
208
215
|
|
|
216
|
+
if (!resizeParams) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
209
220
|
resizeParams = undefined;
|
|
210
221
|
|
|
211
222
|
editor.updateBlock(block, {
|
|
@@ -235,9 +246,6 @@ export const renderImage = (
|
|
|
235
246
|
if (editor.isEditable) {
|
|
236
247
|
imageWrapper.appendChild(leftResizeHandle);
|
|
237
248
|
imageWrapper.appendChild(rightResizeHandle);
|
|
238
|
-
} else {
|
|
239
|
-
imageWrapper.removeChild(leftResizeHandle);
|
|
240
|
-
imageWrapper.removeChild(rightResizeHandle);
|
|
241
249
|
}
|
|
242
250
|
};
|
|
243
251
|
// Hides the resize handles when the cursor leaves the image, unless the
|
|
@@ -254,8 +262,14 @@ export const renderImage = (
|
|
|
254
262
|
return;
|
|
255
263
|
}
|
|
256
264
|
|
|
257
|
-
|
|
258
|
-
|
|
265
|
+
if (
|
|
266
|
+
editor.isEditable &&
|
|
267
|
+
imageWrapper.contains(leftResizeHandle) &&
|
|
268
|
+
imageWrapper.contains(rightResizeHandle)
|
|
269
|
+
) {
|
|
270
|
+
imageWrapper.removeChild(leftResizeHandle);
|
|
271
|
+
imageWrapper.removeChild(rightResizeHandle);
|
|
272
|
+
}
|
|
259
273
|
};
|
|
260
274
|
|
|
261
275
|
// Sets the resize params, allowing the user to begin resizing the image by
|
package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts
CHANGED
|
@@ -37,7 +37,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
37
37
|
addKeyboardShortcuts() {
|
|
38
38
|
return {
|
|
39
39
|
Enter: () => handleEnter(this.editor),
|
|
40
|
-
"Mod-Shift-
|
|
40
|
+
"Mod-Shift-8": () =>
|
|
41
41
|
this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
42
42
|
type: "bulletListItem",
|
|
43
43
|
props: {},
|
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts
CHANGED
|
@@ -52,7 +52,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
52
52
|
addKeyboardShortcuts() {
|
|
53
53
|
return {
|
|
54
54
|
Enter: () => handleEnter(this.editor),
|
|
55
|
-
"Mod-Shift-
|
|
55
|
+
"Mod-Shift-7": () =>
|
|
56
56
|
this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
57
57
|
type: "numberedListItem",
|
|
58
58
|
props: {},
|
package/src/editor/Block.css
CHANGED
|
@@ -52,7 +52,8 @@ export class FormattingToolbarView {
|
|
|
52
52
|
|
|
53
53
|
pmView.dom.addEventListener("mousedown", this.viewMousedownHandler);
|
|
54
54
|
pmView.dom.addEventListener("mouseup", this.viewMouseupHandler);
|
|
55
|
-
pmView.dom.addEventListener("dragstart", this.
|
|
55
|
+
pmView.dom.addEventListener("dragstart", this.dragHandler);
|
|
56
|
+
pmView.dom.addEventListener("dragover", this.dragHandler);
|
|
56
57
|
|
|
57
58
|
pmView.dom.addEventListener("focus", this.focusHandler);
|
|
58
59
|
pmView.dom.addEventListener("blur", this.blurHandler);
|
|
@@ -70,7 +71,7 @@ export class FormattingToolbarView {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
// For dragging the whole editor.
|
|
73
|
-
|
|
74
|
+
dragHandler = () => {
|
|
74
75
|
if (this.formattingToolbarState?.show) {
|
|
75
76
|
this.formattingToolbarState.show = false;
|
|
76
77
|
this.updateFormattingToolbar();
|
|
@@ -177,7 +178,8 @@ export class FormattingToolbarView {
|
|
|
177
178
|
destroy() {
|
|
178
179
|
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler);
|
|
179
180
|
this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler);
|
|
180
|
-
this.pmView.dom.removeEventListener("dragstart", this.
|
|
181
|
+
this.pmView.dom.removeEventListener("dragstart", this.dragHandler);
|
|
182
|
+
this.pmView.dom.removeEventListener("dragover", this.dragHandler);
|
|
181
183
|
|
|
182
184
|
this.pmView.dom.removeEventListener("focus", this.focusHandler);
|
|
183
185
|
this.pmView.dom.removeEventListener("blur", this.blurHandler);
|
|
@@ -550,7 +550,10 @@ export class SideMenuView<
|
|
|
550
550
|
const { contentNode, startPos, endPos } = blockInfo;
|
|
551
551
|
|
|
552
552
|
// Creates a new block if current one is not empty for the suggestion menu to open in.
|
|
553
|
-
if (
|
|
553
|
+
if (
|
|
554
|
+
contentNode.type.spec.content !== "inline*" ||
|
|
555
|
+
contentNode.textContent.length !== 0
|
|
556
|
+
) {
|
|
554
557
|
const newBlockInsertionPos = endPos + 1;
|
|
555
558
|
const newBlockContentPos = newBlockInsertionPos + 2;
|
|
556
559
|
|
|
@@ -23,7 +23,7 @@ export declare class FormattingToolbarView {
|
|
|
23
23
|
constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, updateFormattingToolbar: (formattingToolbarState: FormattingToolbarState) => void);
|
|
24
24
|
viewMousedownHandler: () => void;
|
|
25
25
|
viewMouseupHandler: () => void;
|
|
26
|
-
|
|
26
|
+
dragHandler: () => void;
|
|
27
27
|
focusHandler: () => void;
|
|
28
28
|
blurHandler: (event: FocusEvent) => void;
|
|
29
29
|
scrollHandler: () => void;
|