@jackuait/blok 0.10.0-beta.11 → 0.10.0-beta.12
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-trqaO1wV.mjs} +7 -6
- package/dist/chunks/{constants-CqrNvkmI.mjs → constants-UyV9cJZk.mjs} +1 -1
- package/dist/chunks/{tools-CSgw3Aym.mjs → tools-DJJP1iOU.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 +13 -0
- package/src/components/modules/toolbar/styles.ts +0 -2
- package/src/tools/table/index.ts +3 -1
package/dist/blok.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-trqaO1wV.mjs";
|
|
2
|
+
import { $n as n } from "./chunks/constants-UyV9cJZk.mjs";
|
|
3
3
|
export { t as Blok, n as DATA_ATTR, e as version };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./chunk-D6kmoKXy.mjs";
|
|
2
|
-
import { $n as t, $t as n, An as r, At as i, Bn as a, Bt as o, C as s, Dn as c, E as l, En as u, Fn as d, Gn as f, Gt as p, Hn as m, In as h, It as g, Jn as _, Jt as v, Kn as ee, Kt as y, Ln as te, Mn as ne, Nn as re, On as ie, Ot as ae, Pn as oe, Qn as se, Qt as ce, Rn as le, S as ue, Sn as de, T as fe, Tn as pe, Un as b, Vn as me, Wn as he, Wt as ge, Xn as _e, Xt as ve, Yn as ye, Yt as be, Zn as x, Zt as xe, _ as Se, _n as Ce, an as we, b as S, bn as Te, dn as Ee, en as De, er as C, fn as Oe, ft as ke, g as Ae, gn as je, gt as Me, h as Ne, hn as Pe, in as w, jn as Fe, k as Ie, kn as Le, ln as Re, m as ze, mn as Be, nn as Ve, p as He, pn as Ue, qn as T, qt as We, rn as E, sn as Ge, tn as Ke, u as qe, un as Je, v as Ye, vn as Xe, vt as Ze, w as Qe, wn as D, x as $e, xn as et, y as tt, yn as nt, zn as rt, zt as it } from "./constants-
|
|
2
|
+
import { $n as t, $t as n, An as r, At as i, Bn as a, Bt as o, C as s, Dn as c, E as l, En as u, Fn as d, Gn as f, Gt as p, Hn as m, In as h, It as g, Jn as _, Jt as v, Kn as ee, Kt as y, Ln as te, Mn as ne, Nn as re, On as ie, Ot as ae, Pn as oe, Qn as se, Qt as ce, Rn as le, S as ue, Sn as de, T as fe, Tn as pe, Un as b, Vn as me, Wn as he, Wt as ge, Xn as _e, Xt as ve, Yn as ye, Yt as be, Zn as x, Zt as xe, _ as Se, _n as Ce, an as we, b as S, bn as Te, dn as Ee, en as De, er as C, fn as Oe, ft as ke, g as Ae, gn as je, gt as Me, h as Ne, hn as Pe, in as w, jn as Fe, k as Ie, kn as Le, ln as Re, m as ze, mn as Be, nn as Ve, p as He, pn as Ue, qn as T, qt as We, rn as E, sn as Ge, tn as Ke, u as qe, un as Je, v as Ye, vn as Xe, vt as Ze, w as Qe, wn as D, x as $e, xn as et, y as tt, yn as nt, zn as rt, zt as it } from "./constants-UyV9cJZk.mjs";
|
|
3
3
|
import { n as at, t as O } from "./objectSpread2-CWwMYL_U.mjs";
|
|
4
4
|
import { n as k, t as ot } from "./tw-CqxBf-1Y.mjs";
|
|
5
5
|
import { r as st, t as ct } from "./lightweight-i18n-Cvv8CWh4.mjs";
|
|
@@ -9097,9 +9097,10 @@ var Du = class extends A {
|
|
|
9097
9097
|
if (r === e || t) return n.readOnlyEnabled;
|
|
9098
9098
|
if (n.supportsInPlaceToggle) {
|
|
9099
9099
|
var i;
|
|
9100
|
+
n.Blok.ModificationsObserver.disable();
|
|
9100
9101
|
let t = (i = n.Blok.BlockManager.blocks) == null ? [] : i;
|
|
9101
9102
|
for (let n of t) n.setReadOnly(e);
|
|
9102
|
-
return n.readOnlyEnabled;
|
|
9103
|
+
return n.Blok.ModificationsObserver.enable(), n.readOnlyEnabled;
|
|
9103
9104
|
}
|
|
9104
9105
|
n.Blok.ModificationsObserver.disable();
|
|
9105
9106
|
let a = await n.Blok.Saver.save();
|
|
@@ -10645,7 +10646,7 @@ var Dd = {
|
|
|
10645
10646
|
toolbarOpened: "block",
|
|
10646
10647
|
toolbarClosed: "hidden",
|
|
10647
10648
|
content: ot("relative mx-auto max-w-blok-content"),
|
|
10648
|
-
actions: ot("absolute flex opacity-0 pr-[5px]", "right-full", "
|
|
10649
|
+
actions: ot("absolute flex opacity-0 pr-[5px]", "right-full", "mobile:right-auto", "group-data-[blok-rtl=true]:right-auto group-data-[blok-rtl=true]:left-[calc(-1*(var(--spacing-toolbox-btn)))]", "mobile:group-data-[blok-rtl=true]:ml-0 mobile:group-data-[blok-rtl=true]:mr-auto mobile:group-data-[blok-rtl=true]:pr-0 mobile:group-data-[blok-rtl=true]:pl-[10px]"),
|
|
10649
10650
|
actionsOpened: "opacity-100",
|
|
10650
10651
|
plusButton: ot("text-dark cursor-pointer w-toolbox-btn h-toolbox-btn rounded-[7px] inline-flex justify-center items-center select-none", "shrink-0", "[&_svg]:h-6 [&_svg]:w-6", "can-hover:hover:bg-bg-light", "group-data-[blok-toolbox-opened=true]:bg-bg-light", "mobile:bg-popover-bg mobile:border mobile:border-mobile-border mobile:shadow-overlay-pane mobile:rounded-[6px] mobile:z-2", "mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile", "group-data-[blok-rtl=true]:right-[calc(-1*(var(--spacing-toolbox-btn)))] group-data-[blok-rtl=true]:left-auto"),
|
|
10651
10652
|
plusButtonShortcutKey: "text-white",
|
|
@@ -10741,11 +10742,11 @@ var Dd = {
|
|
|
10741
10742
|
return {
|
|
10742
10743
|
hide: () => {
|
|
10743
10744
|
var e, t;
|
|
10744
|
-
(e = this.nodes.actions) == null || e.classList.remove(this.CSS.actionsOpened), (t = this.nodes.actions) == null || t.removeAttribute("data-blok-opened");
|
|
10745
|
+
(e = this.nodes.actions) == null || e.classList.remove(this.CSS.actionsOpened), (t = this.nodes.actions) == null || t.removeAttribute("data-blok-opened"), this.nodes.actions && (this.nodes.actions.style.pointerEvents = "none");
|
|
10745
10746
|
},
|
|
10746
10747
|
show: () => {
|
|
10747
10748
|
var e, t;
|
|
10748
|
-
(e = this.nodes.actions) == null || e.classList.add(this.CSS.actionsOpened), (t = this.nodes.actions) == null || t.setAttribute("data-blok-opened", "true");
|
|
10749
|
+
(e = this.nodes.actions) == null || e.classList.add(this.CSS.actionsOpened), (t = this.nodes.actions) == null || t.setAttribute("data-blok-opened", "true"), this.nodes.actions && (this.nodes.actions.style.pointerEvents = "auto");
|
|
10749
10750
|
}
|
|
10750
10751
|
};
|
|
10751
10752
|
}
|
|
@@ -10895,7 +10896,7 @@ var Dd = {
|
|
|
10895
10896
|
]);
|
|
10896
10897
|
e.nodes.wrapper = n, n.setAttribute(t.toolbar, ""), n.setAttribute("data-blok-testid", "toolbar");
|
|
10897
10898
|
let r = D.make("div", e.CSS.content), i = D.make("div", [e.CSS.actions]);
|
|
10898
|
-
e.nodes.content = r, e.nodes.actions = i, i.setAttribute("data-blok-testid", "toolbar-actions"), D.append(n, r), D.append(r, i);
|
|
10899
|
+
i.style.pointerEvents = "none", e.nodes.content = r, e.nodes.actions = i, i.setAttribute("data-blok-testid", "toolbar-actions"), D.append(n, r), D.append(r, i);
|
|
10899
10900
|
let a = e.plusButtonHandler.make(e.nodes);
|
|
10900
10901
|
D.append(i, a);
|
|
10901
10902
|
let o = e.settingsTogglerHandler.make(e.nodes);
|
|
@@ -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.12", 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-UyV9cJZk.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-trqaO1wV.mjs";
|
|
2
|
+
import { $n as n } from "./chunks/constants-UyV9cJZk.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-DJJP1iOU.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-trqaO1wV.mjs";
|
|
2
|
+
import "./chunks/constants-UyV9cJZk.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-UyV9cJZk.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-DJJP1iOU.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.12",
|
|
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
|
}
|
|
@@ -926,6 +932,13 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
926
932
|
this.CSS.actions,
|
|
927
933
|
]);
|
|
928
934
|
|
|
935
|
+
/**
|
|
936
|
+
* Start with pointer-events disabled so invisible (opacity-0) actions
|
|
937
|
+
* don't intercept clicks on elements underneath (e.g. toggle arrows).
|
|
938
|
+
* blockActions.show()/hide() toggles this inline style.
|
|
939
|
+
*/
|
|
940
|
+
actions.style.pointerEvents = 'none';
|
|
941
|
+
|
|
929
942
|
this.nodes.content = content;
|
|
930
943
|
|
|
931
944
|
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');
|