@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/blocknote.js
CHANGED
|
@@ -1444,12 +1444,14 @@ const En = {
|
|
|
1444
1444
|
t.onEditorContentChange(m), t.onEditorSelectionChange(m);
|
|
1445
1445
|
let h;
|
|
1446
1446
|
const f = (b) => {
|
|
1447
|
-
if (!h)
|
|
1447
|
+
if (!h) {
|
|
1448
|
+
!t.isEditable && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d));
|
|
1448
1449
|
return;
|
|
1450
|
+
}
|
|
1449
1451
|
let T;
|
|
1450
1452
|
Lt(n.props.textAlignment) === "center" ? h.handleUsed === "left" ? T = h.initialWidth + (h.initialClientX - b.clientX) * 2 : T = h.initialWidth + (b.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? T = h.initialWidth + h.initialClientX - b.clientX : T = h.initialWidth + b.clientX - h.initialClientX, T < Ht ? l.style.width = `${Ht}px` : T > t.domElement.firstElementChild.clientWidth ? l.style.width = `${t.domElement.firstElementChild.clientWidth}px` : l.style.width = `${T}px`;
|
|
1451
1453
|
}, y = (b) => {
|
|
1452
|
-
|
|
1454
|
+
(!b.target || !a.contains(b.target) || !t.isEditable) && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d)), h && (h = void 0, t.updateBlock(n, {
|
|
1453
1455
|
type: "image",
|
|
1454
1456
|
props: {
|
|
1455
1457
|
// Removes "px" from the end of the width string and converts to float.
|
|
@@ -1465,9 +1467,9 @@ const En = {
|
|
|
1465
1467
|
})
|
|
1466
1468
|
);
|
|
1467
1469
|
}, k = () => {
|
|
1468
|
-
t.isEditable
|
|
1470
|
+
t.isEditable && (a.appendChild(c), a.appendChild(d));
|
|
1469
1471
|
}, g = (b) => {
|
|
1470
|
-
b.relatedTarget === c || b.relatedTarget === d || h || (a.removeChild(c), a.removeChild(d));
|
|
1472
|
+
b.relatedTarget === c || b.relatedTarget === d || h || t.isEditable && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d));
|
|
1471
1473
|
}, v = (b) => {
|
|
1472
1474
|
b.preventDefault(), a.appendChild(c), a.appendChild(d), h = {
|
|
1473
1475
|
handleUsed: "left",
|
|
@@ -1582,7 +1584,7 @@ const En = {
|
|
|
1582
1584
|
addKeyboardShortcuts() {
|
|
1583
1585
|
return {
|
|
1584
1586
|
Enter: () => te(this.editor),
|
|
1585
|
-
"Mod-Shift-
|
|
1587
|
+
"Mod-Shift-8": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
1586
1588
|
type: "bulletListItem",
|
|
1587
1589
|
props: {}
|
|
1588
1590
|
})
|
|
@@ -1701,7 +1703,7 @@ const En = {
|
|
|
1701
1703
|
addKeyboardShortcuts() {
|
|
1702
1704
|
return {
|
|
1703
1705
|
Enter: () => te(this.editor),
|
|
1704
|
-
"Mod-Shift-
|
|
1706
|
+
"Mod-Shift-7": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
|
|
1705
1707
|
type: "numberedListItem",
|
|
1706
1708
|
props: {}
|
|
1707
1709
|
})
|
|
@@ -2137,7 +2139,7 @@ class to {
|
|
|
2137
2139
|
this.preventShow = !1, setTimeout(() => this.update(this.pmView));
|
|
2138
2140
|
});
|
|
2139
2141
|
// For dragging the whole editor.
|
|
2140
|
-
u(this, "
|
|
2142
|
+
u(this, "dragHandler", () => {
|
|
2141
2143
|
var t;
|
|
2142
2144
|
(t = this.formattingToolbarState) != null && t.show && (this.formattingToolbarState.show = !1, this.updateFormattingToolbar());
|
|
2143
2145
|
});
|
|
@@ -2165,7 +2167,7 @@ class to {
|
|
|
2165
2167
|
"Attempting to update uninitialized formatting toolbar"
|
|
2166
2168
|
);
|
|
2167
2169
|
o(this.formattingToolbarState);
|
|
2168
|
-
}, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.
|
|
2170
|
+
}, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.dragHandler), e.dom.addEventListener("dragover", this.dragHandler), e.dom.addEventListener("focus", this.focusHandler), e.dom.addEventListener("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
|
|
2169
2171
|
}
|
|
2170
2172
|
update(t, e) {
|
|
2171
2173
|
var m, h;
|
|
@@ -2192,7 +2194,7 @@ class to {
|
|
|
2192
2194
|
}
|
|
2193
2195
|
}
|
|
2194
2196
|
destroy() {
|
|
2195
|
-
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.
|
|
2197
|
+
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragHandler), this.pmView.dom.removeEventListener("dragover", this.dragHandler), this.pmView.dom.removeEventListener("focus", this.focusHandler), this.pmView.dom.removeEventListener("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
|
|
2196
2198
|
}
|
|
2197
2199
|
getSelectionBoundingBox() {
|
|
2198
2200
|
const { state: t } = this.pmView, { selection: e } = t, { ranges: o } = e, r = Math.min(...o.map((s) => s.$from.pos)), i = Math.max(...o.map((s) => s.$to.pos));
|
|
@@ -2869,7 +2871,7 @@ class mo {
|
|
|
2869
2871
|
if (r === void 0)
|
|
2870
2872
|
return;
|
|
2871
2873
|
const { contentNode: i, startPos: s, endPos: a } = r;
|
|
2872
|
-
if (i.textContent.length !== 0) {
|
|
2874
|
+
if (i.type.spec.content !== "inline*" || i.textContent.length !== 0) {
|
|
2873
2875
|
const c = a + 1, d = c + 2;
|
|
2874
2876
|
this.editor._tiptapEditor.chain().BNCreateBlock(c).BNUpdateBlock(d, { type: "paragraph", props: {} }).setTextSelection(d).run();
|
|
2875
2877
|
} else
|