@jackuait/blok 0.10.0-beta.11 → 0.10.0-beta.13
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/blok.mjs +2 -2
- package/dist/chunks/{blok-LkCv5gCR.mjs → blok-uTkAJyAg.mjs} +263 -264
- package/dist/chunks/{constants-CqrNvkmI.mjs → constants-NpHRgdEj.mjs} +1 -1
- package/dist/chunks/{tools-CSgw3Aym.mjs → tools-bN22O_3E.mjs} +2 -2
- package/dist/full.mjs +3 -3
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/components/modules/readonly.ts +4 -0
- package/src/components/modules/toolbar/index.ts +15 -7
- package/src/components/modules/toolbar/styles.ts +0 -2
- package/src/tools/table/index.ts +3 -1
|
@@ -130,7 +130,7 @@ var a = {
|
|
|
130
130
|
RIGHT: 2,
|
|
131
131
|
BACKWARD: 3,
|
|
132
132
|
FORWARD: 4
|
|
133
|
-
}, l = () => "0.10.0-beta.
|
|
133
|
+
}, l = () => "0.10.0-beta.13", u = /* @__PURE__ */ function(e) {
|
|
134
134
|
return e.VERBOSE = "VERBOSE", e.INFO = "INFO", e.WARN = "WARN", e.ERROR = "ERROR", e;
|
|
135
135
|
}({}), d = (e, t, n = "log", r, i = "color: inherit") => {
|
|
136
136
|
let a = typeof console > "u" ? void 0 : console;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, $n as t, A as n, B as r, Bt as i, Cn as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, H as p, Ht as m, I as h, It as g, J as _, K as v, L as y, Lt as b, M as ee, Mt as x, N as te, Nt as ne, O as re, Ot as ie, P as ae, Pt as oe, Q as se, Qt as S, R as ce, Rt as le, St as ue, Tt as de, U as fe, Ut as pe, V as me, Vt as he, W as ge, Wt as _e, X as ve, Y as ye, Z as be, Zt as xe, _t as Se, a as Ce, at as we, bt as Te, c as Ee, cn as De, ct as Oe, d as ke, dt as Ae, en as je, er as C, et as Me, f as Ne, g as Pe, gt as Fe, h as Ie, ht as Le, i as Re, in as ze, it as Be, j as Ve, jt as He, kt as Ue, l as We, lt as Ge, mt as Ke, n as qe, nt as Je, o as Ye, ot as Xe, p as Ze, pt as Qe, q as $e, qn as et, qt as tt, r as nt, rn as w, rt, s as it, sn as at, st as ot, t as st, tt as ct, u as T, ut as lt, v as ut, wt as dt, xt as ft, yt as pt, z as mt, zt as ht } from "./constants-
|
|
1
|
+
import { $ as e, $n as t, A as n, B as r, Bt as i, Cn as a, Ct as o, D as s, Dt as c, Et as l, F as u, Ft as d, G as f, H as p, Ht as m, I as h, It as g, J as _, K as v, L as y, Lt as b, M as ee, Mt as x, N as te, Nt as ne, O as re, Ot as ie, P as ae, Pt as oe, Q as se, Qt as S, R as ce, Rt as le, St as ue, Tt as de, U as fe, Ut as pe, V as me, Vt as he, W as ge, Wt as _e, X as ve, Y as ye, Z as be, Zt as xe, _t as Se, a as Ce, at as we, bt as Te, c as Ee, cn as De, ct as Oe, d as ke, dt as Ae, en as je, er as C, et as Me, f as Ne, g as Pe, gt as Fe, h as Ie, ht as Le, i as Re, in as ze, it as Be, j as Ve, jt as He, kt as Ue, l as We, lt as Ge, mt as Ke, n as qe, nt as Je, o as Ye, ot as Xe, p as Ze, pt as Qe, q as $e, qn as et, qt as tt, r as nt, rn as w, rt, s as it, sn as at, st as ot, t as st, tt as ct, u as T, ut as lt, v as ut, wt as dt, xt as ft, yt as pt, z as mt, zt as ht } from "./constants-NpHRgdEj.mjs";
|
|
2
2
|
import { t as E } from "./objectSpread2-CWwMYL_U.mjs";
|
|
3
3
|
import { n as D } from "./tw-CqxBf-1Y.mjs";
|
|
4
4
|
//#region src/components/utils/html.ts
|
|
@@ -5264,7 +5264,7 @@ var wr = (e) => {
|
|
|
5264
5264
|
let n = window.getSelection();
|
|
5265
5265
|
if (!n || n.rangeCount === 0) return;
|
|
5266
5266
|
let r = n.getRangeAt(0);
|
|
5267
|
-
r.deleteContents();
|
|
5267
|
+
r.collapsed || r.deleteContents();
|
|
5268
5268
|
let i = document.createDocumentFragment(), a = document.createElement("div");
|
|
5269
5269
|
a.innerHTML = t, Array.from(a.childNodes).forEach((e) => i.appendChild(e)), i.childNodes.length === 0 && i.appendChild(new Text());
|
|
5270
5270
|
let o = i.lastChild;
|
package/dist/full.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as e, t } from "./chunks/blok-
|
|
2
|
-
import { $n as n } from "./chunks/constants-
|
|
1
|
+
import { n as e, t } from "./chunks/blok-uTkAJyAg.mjs";
|
|
2
|
+
import { $n as n } from "./chunks/constants-NpHRgdEj.mjs";
|
|
3
3
|
import { t as r } from "./chunks/objectSpread2-CWwMYL_U.mjs";
|
|
4
|
-
import { _ as i, a, c as o, g as s, i as c, l, m as u, n as d, o as f, s as p, t as m, v as h } from "./chunks/tools-
|
|
4
|
+
import { _ as i, a, c as o, g as s, i as c, l, m as u, n as d, o as f, s as p, t as m, v as h } from "./chunks/tools-bN22O_3E.mjs";
|
|
5
5
|
//#region src/full.ts
|
|
6
6
|
var g = {
|
|
7
7
|
paragraph: {
|
package/dist/react.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./chunks/blok-
|
|
2
|
-
import "./chunks/constants-
|
|
1
|
+
import { t as e } from "./chunks/blok-uTkAJyAg.mjs";
|
|
2
|
+
import "./chunks/constants-NpHRgdEj.mjs";
|
|
3
3
|
import { t } from "./chunks/objectSpread2-CWwMYL_U.mjs";
|
|
4
4
|
import { t as n } from "./chunks/objectWithoutProperties-D0XxKB4n.mjs";
|
|
5
5
|
import { forwardRef as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
package/dist/tools.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { m as e } from "./chunks/constants-
|
|
2
|
-
import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v } from "./chunks/tools-
|
|
1
|
+
import { m as e } from "./chunks/constants-NpHRgdEj.mjs";
|
|
2
|
+
import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v } from "./chunks/tools-bN22O_3E.mjs";
|
|
3
3
|
export { l as Bold, p as Callout, _ as Code, e as Convert, a as Divider, t as Header, m as InlineCode, r as Italic, h as Link, o as List, f as Marker, v as Paragraph, i as Quote, c as Strikethrough, s as Table, u as Toggle, n as Underline, g as defaultBlockTools, d as defaultInlineTools };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackuait/blok",
|
|
3
|
-
"version": "0.10.0-beta.
|
|
3
|
+
"version": "0.10.0-beta.13",
|
|
4
4
|
"description": "Blok — headless, highly extensible rich text editor built for developers who need to implement a block-based editing experience (similar to Notion) without building it from scratch",
|
|
5
5
|
"module": "dist/blok.mjs",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -128,12 +128,16 @@ export class ReadOnly extends Module {
|
|
|
128
128
|
* instead of the full save/clear/render cycle
|
|
129
129
|
*/
|
|
130
130
|
if (this.supportsInPlaceToggle) {
|
|
131
|
+
this.Blok.ModificationsObserver.disable();
|
|
132
|
+
|
|
131
133
|
const blocks = (this.Blok.BlockManager as { blocks?: Array<{ setReadOnly: (s: boolean) => void }> }).blocks ?? [];
|
|
132
134
|
|
|
133
135
|
for (const block of blocks) {
|
|
134
136
|
block.setReadOnly(state);
|
|
135
137
|
}
|
|
136
138
|
|
|
139
|
+
this.Blok.ModificationsObserver.enable();
|
|
140
|
+
|
|
137
141
|
return this.readOnlyEnabled;
|
|
138
142
|
}
|
|
139
143
|
|
|
@@ -289,11 +289,17 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
289
289
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
290
290
|
this.nodes.actions?.classList.remove(this.CSS.actionsOpened);
|
|
291
291
|
this.nodes.actions?.removeAttribute('data-blok-opened');
|
|
292
|
+
if (this.nodes.actions) {
|
|
293
|
+
this.nodes.actions.style.pointerEvents = 'none';
|
|
294
|
+
}
|
|
292
295
|
},
|
|
293
296
|
show: (): void => {
|
|
294
297
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
295
298
|
this.nodes.actions?.classList.add(this.CSS.actionsOpened);
|
|
296
299
|
this.nodes.actions?.setAttribute('data-blok-opened', 'true');
|
|
300
|
+
if (this.nodes.actions) {
|
|
301
|
+
this.nodes.actions.style.pointerEvents = 'auto';
|
|
302
|
+
}
|
|
297
303
|
},
|
|
298
304
|
};
|
|
299
305
|
}
|
|
@@ -505,14 +511,11 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
505
511
|
* consumer CSS overrides the block content's margin.
|
|
506
512
|
*
|
|
507
513
|
* Runs after open() so the toolbar is visible and actions have correct offsetWidth.
|
|
508
|
-
* Clamp to the actions element width so toolbar buttons (plus, settings)
|
|
509
|
-
* never overflow off-screen to the left when content is flush-left.
|
|
510
514
|
*/
|
|
511
515
|
if (blockContentElement && this.nodes.content) {
|
|
512
516
|
const blockMarginLeft = parseFloat(getComputedStyle(blockContentElement).marginLeft) || 0;
|
|
513
|
-
const actionsWidth = this.nodes.actions?.offsetWidth ?? 0;
|
|
514
517
|
|
|
515
|
-
this.nodes.content.style.marginLeft = `${
|
|
518
|
+
this.nodes.content.style.marginLeft = `${blockMarginLeft}px`;
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
521
|
|
|
@@ -635,13 +638,11 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
635
638
|
/**
|
|
636
639
|
* Sync toolbar content wrapper's margin with the block content element.
|
|
637
640
|
* Runs after open() so the toolbar is visible and actions have correct offsetWidth.
|
|
638
|
-
* Clamp to the actions width so buttons never overflow off-screen to the left.
|
|
639
641
|
*/
|
|
640
642
|
if (blockContentElement && this.nodes.content) {
|
|
641
643
|
const blockMarginLeft = parseFloat(getComputedStyle(blockContentElement).marginLeft) || 0;
|
|
642
|
-
const actionsWidth = this.nodes.actions?.offsetWidth ?? 0;
|
|
643
644
|
|
|
644
|
-
this.nodes.content.style.marginLeft = `${
|
|
645
|
+
this.nodes.content.style.marginLeft = `${blockMarginLeft}px`;
|
|
645
646
|
}
|
|
646
647
|
}
|
|
647
648
|
|
|
@@ -926,6 +927,13 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
926
927
|
this.CSS.actions,
|
|
927
928
|
]);
|
|
928
929
|
|
|
930
|
+
/**
|
|
931
|
+
* Start with pointer-events disabled so invisible (opacity-0) actions
|
|
932
|
+
* don't intercept clicks on elements underneath (e.g. toggle arrows).
|
|
933
|
+
* blockActions.show()/hide() toggles this inline style.
|
|
934
|
+
*/
|
|
935
|
+
actions.style.pointerEvents = 'none';
|
|
936
|
+
|
|
929
937
|
this.nodes.content = content;
|
|
930
938
|
|
|
931
939
|
this.nodes.actions = actions;
|
|
@@ -19,8 +19,6 @@ export const getToolbarStyles = (): { [name: string]: string } => {
|
|
|
19
19
|
actions: twJoin(
|
|
20
20
|
'absolute flex opacity-0 pr-[5px]',
|
|
21
21
|
'right-full',
|
|
22
|
-
// Re-enable pointer events for interactive elements
|
|
23
|
-
'pointer-events-auto',
|
|
24
22
|
// Mobile styles
|
|
25
23
|
'mobile:right-auto',
|
|
26
24
|
// RTL styles
|
package/src/tools/table/index.ts
CHANGED
|
@@ -1727,7 +1727,9 @@ export class Table implements BlockTool {
|
|
|
1727
1727
|
|
|
1728
1728
|
const range = selection.getRangeAt(0);
|
|
1729
1729
|
|
|
1730
|
-
range.
|
|
1730
|
+
if (!range.collapsed) {
|
|
1731
|
+
range.deleteContents();
|
|
1732
|
+
}
|
|
1731
1733
|
|
|
1732
1734
|
const fragment = document.createDocumentFragment();
|
|
1733
1735
|
const wrapper = document.createElement('div');
|