@jackuait/blok 0.4.1-beta.15 → 0.4.1-beta.16
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-CeuuGrRq.mjs → blok-B9aLxqRM.mjs} +266 -263
- package/dist/chunks/{i18next-loader-Bb7mZZ5c.mjs → i18next-loader-CYVZ-4iE.mjs} +1 -1
- package/dist/chunks/{index-CH3ZRv_X.mjs → index-DI4NIAy_.mjs} +1 -1
- package/dist/chunks/{inline-tool-convert-D8zvXApV.mjs → inline-tool-convert-DPhl4gmP.mjs} +1 -1
- package/dist/full.mjs +2 -2
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/components/utils/data-model-transform.ts +22 -4
|
@@ -18,7 +18,7 @@ let nt = (o = 21) => {
|
|
|
18
18
|
return t;
|
|
19
19
|
};
|
|
20
20
|
var ot = /* @__PURE__ */ ((o) => (o.VERBOSE = "VERBOSE", o.INFO = "INFO", o.WARN = "WARN", o.ERROR = "ERROR", o))(ot || {});
|
|
21
|
-
const rt = () => "0.4.1-beta.
|
|
21
|
+
const rt = () => "0.4.1-beta.16", Ct = {
|
|
22
22
|
BACKSPACE: 8,
|
|
23
23
|
TAB: 9,
|
|
24
24
|
ENTER: 13,
|
package/dist/full.mjs
CHANGED
|
@@ -10,10 +10,10 @@ var e = (a, l, o) => l in a ? n(a, l, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
d.call(l, o) && e(a, o, l[o]);
|
|
11
11
|
return a;
|
|
12
12
|
}, r = (a, l) => t(a, c(l));
|
|
13
|
-
import { B as v, v as A } from "./chunks/blok-
|
|
13
|
+
import { B as v, v as A } from "./chunks/blok-B9aLxqRM.mjs";
|
|
14
14
|
import { List as p, Header as f, Paragraph as I, Link as k, Italic as u, Bold as B } from "./tools.mjs";
|
|
15
15
|
import { defaultBlockTools as H, defaultInlineTools as P } from "./tools.mjs";
|
|
16
|
-
import { D as _ } from "./chunks/inline-tool-convert-
|
|
16
|
+
import { D as _ } from "./chunks/inline-tool-convert-DPhl4gmP.mjs";
|
|
17
17
|
const m = {
|
|
18
18
|
paragraph: {
|
|
19
19
|
class: I,
|
package/dist/tools.mjs
CHANGED
|
@@ -10,8 +10,8 @@ var U = (f, t, e) => t in f ? nt(f, t, { enumerable: !0, configurable: !0, writa
|
|
|
10
10
|
it.call(t, e) && U(f, e, t[e]);
|
|
11
11
|
return f;
|
|
12
12
|
}, P = (f, t) => rt(f, st(t));
|
|
13
|
-
import { t as x, D as m, a9 as et, aa as at, ab as lt, A as ct, ac as dt, ad as ut, ae as ht, af as ft, ag as pt, ah as mt, ai as G, aj as j, ak as $, f as A, al as gt, am as Et, S as H, P as Tt, an as Ct, l as At, J as yt } from "./chunks/inline-tool-convert-
|
|
14
|
-
import { a0 as Dt } from "./chunks/inline-tool-convert-
|
|
13
|
+
import { t as x, D as m, a9 as et, aa as at, ab as lt, A as ct, ac as dt, ad as ut, ae as ht, af as ft, ag as pt, ah as mt, ai as G, aj as j, ak as $, f as A, al as gt, am as Et, S as H, P as Tt, an as Ct, l as At, J as yt } from "./chunks/inline-tool-convert-DPhl4gmP.mjs";
|
|
14
|
+
import { a0 as Dt } from "./chunks/inline-tool-convert-DPhl4gmP.mjs";
|
|
15
15
|
const W = [
|
|
16
16
|
"empty:before:pointer-events-none",
|
|
17
17
|
"empty:before:text-gray-text",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackuait/blok",
|
|
3
|
-
"version": "0.4.1-beta.
|
|
3
|
+
"version": "0.4.1-beta.16",
|
|
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",
|
|
@@ -10,12 +10,13 @@ import { generateBlockId } from '../utils';
|
|
|
10
10
|
/**
|
|
11
11
|
* Legacy list item structure for data model transformation.
|
|
12
12
|
* Used internally for transforming legacy nested list data to the hierarchical model.
|
|
13
|
+
* Can be either an object with content property or a plain string.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
type LegacyListItem = {
|
|
15
16
|
content: string;
|
|
16
17
|
checked?: boolean;
|
|
17
18
|
items?: LegacyListItem[];
|
|
18
|
-
}
|
|
19
|
+
} | string;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Legacy list data structure for data model transformation.
|
|
@@ -41,11 +42,26 @@ export interface DataFormatAnalysis {
|
|
|
41
42
|
hasHierarchy: boolean;
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Normalize a legacy list item to object format
|
|
47
|
+
*/
|
|
48
|
+
const normalizeListItem = (item: LegacyListItem): { content: string; checked?: boolean; items?: LegacyListItem[] } => {
|
|
49
|
+
if (typeof item === 'string') {
|
|
50
|
+
return { content: item };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return item;
|
|
54
|
+
};
|
|
55
|
+
|
|
44
56
|
/**
|
|
45
57
|
* Recursively check if any list item has nested items (for hasHierarchy flag)
|
|
46
58
|
*/
|
|
47
59
|
const hasNestedListItems = (items: LegacyListItem[]): boolean => {
|
|
48
|
-
return items.some(item =>
|
|
60
|
+
return items.some(item => {
|
|
61
|
+
const normalized = normalizeListItem(item);
|
|
62
|
+
|
|
63
|
+
return normalized.items !== undefined && normalized.items.length > 0;
|
|
64
|
+
});
|
|
49
65
|
};
|
|
50
66
|
|
|
51
67
|
/**
|
|
@@ -114,7 +130,9 @@ const expandListItems = (
|
|
|
114
130
|
): BlockId[] => {
|
|
115
131
|
const childIds: BlockId[] = [];
|
|
116
132
|
|
|
117
|
-
items.forEach((
|
|
133
|
+
items.forEach((rawItem, index) => {
|
|
134
|
+
// Normalize item to handle both string and object formats
|
|
135
|
+
const item = normalizeListItem(rawItem);
|
|
118
136
|
const itemId = generateBlockId();
|
|
119
137
|
|
|
120
138
|
childIds.push(itemId);
|