@jackuait/blok 0.4.1-beta.15 → 0.4.1-beta.17
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-BmQiBq7w.mjs} +266 -263
- package/dist/chunks/{i18next-loader-Bb7mZZ5c.mjs → i18next-loader-CtUJZQir.mjs} +1 -1
- package/dist/chunks/{index-CH3ZRv_X.mjs → index-CvHTp5IA.mjs} +1 -1
- package/dist/chunks/{inline-tool-convert-D8zvXApV.mjs → inline-tool-convert-f0-Y0Vcm.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 +46 -6
|
@@ -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.17", 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-BmQiBq7w.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-f0-Y0Vcm.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-f0-Y0Vcm.mjs";
|
|
14
|
+
import { a0 as Dt } from "./chunks/inline-tool-convert-f0-Y0Vcm.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.17",
|
|
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",
|
|
@@ -8,18 +8,30 @@ import type { OutputBlockData, BlockId } from '../../../types';
|
|
|
8
8
|
import { generateBlockId } from '../utils';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Legacy list item
|
|
12
|
-
* Used internally for transforming legacy nested list data to the hierarchical model.
|
|
11
|
+
* Legacy list item as object with content property
|
|
13
12
|
*/
|
|
14
|
-
interface
|
|
13
|
+
interface LegacyListItemObject {
|
|
15
14
|
content: string;
|
|
16
15
|
checked?: boolean;
|
|
17
16
|
items?: LegacyListItem[];
|
|
18
17
|
}
|
|
19
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Old checklist item format (uses 'text' instead of 'content')
|
|
21
|
+
*/
|
|
22
|
+
interface OldChecklistItem {
|
|
23
|
+
text: string;
|
|
24
|
+
checked?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Legacy list item structure for data model transformation.
|
|
29
|
+
* Can be: object with content, object with text (old checklist), or plain string.
|
|
30
|
+
*/
|
|
31
|
+
type LegacyListItem = LegacyListItemObject | OldChecklistItem | string;
|
|
32
|
+
|
|
20
33
|
/**
|
|
21
34
|
* Legacy list data structure for data model transformation.
|
|
22
|
-
* Used internally for transforming legacy nested list data to the hierarchical model.
|
|
23
35
|
*/
|
|
24
36
|
interface LegacyListData {
|
|
25
37
|
style: 'unordered' | 'ordered' | 'checklist';
|
|
@@ -41,11 +53,37 @@ export interface DataFormatAnalysis {
|
|
|
41
53
|
hasHierarchy: boolean;
|
|
42
54
|
}
|
|
43
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Check if item is old checklist format (has 'text' instead of 'content')
|
|
58
|
+
*/
|
|
59
|
+
const isOldChecklistItem = (item: LegacyListItem): item is OldChecklistItem => {
|
|
60
|
+
return typeof item === 'object' && 'text' in item && !('content' in item);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Normalize a legacy list item to object format
|
|
65
|
+
*/
|
|
66
|
+
const normalizeListItem = (item: LegacyListItem): LegacyListItemObject => {
|
|
67
|
+
if (typeof item === 'string') {
|
|
68
|
+
return { content: item };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (isOldChecklistItem(item)) {
|
|
72
|
+
return { content: item.text, checked: item.checked };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return item;
|
|
76
|
+
};
|
|
77
|
+
|
|
44
78
|
/**
|
|
45
79
|
* Recursively check if any list item has nested items (for hasHierarchy flag)
|
|
46
80
|
*/
|
|
47
81
|
const hasNestedListItems = (items: LegacyListItem[]): boolean => {
|
|
48
|
-
return items.some(item =>
|
|
82
|
+
return items.some(item => {
|
|
83
|
+
const normalized = normalizeListItem(item);
|
|
84
|
+
|
|
85
|
+
return normalized.items !== undefined && normalized.items.length > 0;
|
|
86
|
+
});
|
|
49
87
|
};
|
|
50
88
|
|
|
51
89
|
/**
|
|
@@ -114,7 +152,9 @@ const expandListItems = (
|
|
|
114
152
|
): BlockId[] => {
|
|
115
153
|
const childIds: BlockId[] = [];
|
|
116
154
|
|
|
117
|
-
items.forEach((
|
|
155
|
+
items.forEach((rawItem, index) => {
|
|
156
|
+
// Normalize item to handle both string and object formats
|
|
157
|
+
const item = normalizeListItem(rawItem);
|
|
118
158
|
const itemId = generateBlockId();
|
|
119
159
|
|
|
120
160
|
childIds.push(itemId);
|