@jackuait/blok 0.4.0 → 0.4.1-beta.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/codemod/migrate-editorjs-to-blok.js +50 -0
- package/dist/{blok-BYUK8a8t.mjs → blok-C8XbyLHh.mjs} +8545 -7721
- package/dist/blok.mjs +1 -1
- package/dist/blok.umd.js +28 -28
- package/dist/{index-DwNAslPH.mjs → index-CEXLTV6f.mjs} +1 -1
- package/package.json +4 -1
- package/types/api/history.d.ts +33 -0
- package/types/api/index.d.ts +1 -0
- package/types/configs/blok-config.d.ts +12 -0
- package/types/index.d.ts +3 -0
- package/types/utils/popover/popover.d.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackuait/blok",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1-beta.1",
|
|
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
|
"main": "dist/blok.umd.js",
|
|
6
6
|
"module": "dist/blok.mjs",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"@chromatic-com/storybook": "4.1.3",
|
|
74
74
|
"@commitlint/cli": "20.1.0",
|
|
75
75
|
"@commitlint/config-conventional": "20.0.0",
|
|
76
|
+
"@eslint-react/eslint-plugin": "^2.3.12",
|
|
76
77
|
"@playwright/test": "1.57.0",
|
|
77
78
|
"@storybook/addon-a11y": "10.1.1",
|
|
78
79
|
"@storybook/addon-vitest": "10.1.1",
|
|
@@ -93,6 +94,8 @@
|
|
|
93
94
|
"eslint-plugin-jest": "29.2.1",
|
|
94
95
|
"eslint-plugin-jsdoc": "61.4.1",
|
|
95
96
|
"eslint-plugin-playwright": "2.3.0",
|
|
97
|
+
"eslint-plugin-react": "^7.37.5",
|
|
98
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
96
99
|
"eslint-plugin-sonarjs": "3.0.5",
|
|
97
100
|
"eslint-plugin-storybook": "10.1.1",
|
|
98
101
|
"eslint-plugin-tailwindcss": "3.18.2",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History API interface for undo/redo operations
|
|
3
|
+
*/
|
|
4
|
+
export interface History {
|
|
5
|
+
/**
|
|
6
|
+
* Performs undo operation, reverting to the previous state
|
|
7
|
+
* @returns Promise resolving to true if undo was performed, false if nothing to undo
|
|
8
|
+
*/
|
|
9
|
+
undo(): Promise<boolean>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Performs redo operation, restoring the previously undone state
|
|
13
|
+
* @returns Promise resolving to true if redo was performed, false if nothing to redo
|
|
14
|
+
*/
|
|
15
|
+
redo(): Promise<boolean>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Checks if undo is available
|
|
19
|
+
* @returns true if there are states to undo
|
|
20
|
+
*/
|
|
21
|
+
canUndo(): boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Checks if redo is available
|
|
25
|
+
* @returns true if there are states to redo
|
|
26
|
+
*/
|
|
27
|
+
canRedo(): boolean;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Clears the history stacks, removing all undo/redo history
|
|
31
|
+
*/
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
package/types/api/index.d.ts
CHANGED
|
@@ -40,6 +40,18 @@ export interface BlokConfig {
|
|
|
40
40
|
*/
|
|
41
41
|
hideToolbar?: boolean;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Maximum number of history entries for undo/redo
|
|
45
|
+
* @default 30
|
|
46
|
+
*/
|
|
47
|
+
maxHistoryLength?: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Debounce time in milliseconds for batching rapid content changes
|
|
51
|
+
* @default 300
|
|
52
|
+
*/
|
|
53
|
+
historyDebounceTime?: number;
|
|
54
|
+
|
|
43
55
|
/**
|
|
44
56
|
* Map of Tools to use
|
|
45
57
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
Blocks,
|
|
17
17
|
Caret,
|
|
18
18
|
Events,
|
|
19
|
+
History,
|
|
19
20
|
InlineToolbar,
|
|
20
21
|
Listeners,
|
|
21
22
|
Notifier,
|
|
@@ -108,6 +109,7 @@ export interface API {
|
|
|
108
109
|
caret: Caret;
|
|
109
110
|
tools: Tools;
|
|
110
111
|
events: Events;
|
|
112
|
+
history: History;
|
|
111
113
|
listeners: Listeners;
|
|
112
114
|
notifier: Notifier;
|
|
113
115
|
sanitizer: Sanitizer;
|
|
@@ -139,6 +141,7 @@ declare class Blok {
|
|
|
139
141
|
|
|
140
142
|
public blocks: Blocks;
|
|
141
143
|
public caret: Caret;
|
|
144
|
+
public history: History;
|
|
142
145
|
public sanitizer: Sanitizer;
|
|
143
146
|
public saver: Saver;
|
|
144
147
|
public selection: Selection;
|
|
@@ -52,6 +52,12 @@ export interface PopoverParams {
|
|
|
52
52
|
* Popover nesting level. 0 value means that it is a root popover
|
|
53
53
|
*/
|
|
54
54
|
nestingLevel?: number;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Callback fired when user navigates back (ArrowLeft) from nested popover.
|
|
58
|
+
* Used to close nested popover and return focus to parent.
|
|
59
|
+
*/
|
|
60
|
+
onNavigateBack?: () => void;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
|