@jackuait/blok 0.4.1-beta.4 → 0.4.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 +9 -0
- package/dist/blok-BwPfU8ro.mjs +21510 -0
- package/dist/blok.mjs +1 -1
- package/dist/blok.umd.js +54 -37
- package/dist/{index-XWGz4gev.mjs → index-CBkApZKo.mjs} +1 -1
- package/dist/vendor.LICENSE.txt +0 -102
- package/package.json +5 -11
- package/types/api/styles.d.ts +28 -10
- package/types/configs/blok-config.d.ts +8 -0
- package/types/index.d.ts +13 -1
- package/types/tools/header.d.ts +18 -0
- package/types/tools/index.d.ts +1 -0
- package/types/tools/list.d.ts +84 -0
- package/types/tools/paragraph.d.ts +71 -0
- package/types/tools/tool-settings.d.ts +8 -1
- package/types/utils/popover/popover-item.d.ts +6 -0
- package/dist/blok-B870U2fw.mjs +0 -25803
package/dist/vendor.LICENSE.txt
CHANGED
|
@@ -378,108 +378,6 @@ Apache License
|
|
|
378
378
|
|
|
379
379
|
---
|
|
380
380
|
|
|
381
|
-
Name: react
|
|
382
|
-
Version: 18.3.1
|
|
383
|
-
License: MIT
|
|
384
|
-
Private: false
|
|
385
|
-
Description: React is a JavaScript library for building user interfaces.
|
|
386
|
-
Repository: https://github.com/facebook/react.git
|
|
387
|
-
Homepage: https://reactjs.org/
|
|
388
|
-
License Copyright:
|
|
389
|
-
===
|
|
390
|
-
|
|
391
|
-
MIT License
|
|
392
|
-
|
|
393
|
-
Copyright (c) Facebook, Inc. and its affiliates.
|
|
394
|
-
|
|
395
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
396
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
397
|
-
in the Software without restriction, including without limitation the rights
|
|
398
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
399
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
400
|
-
furnished to do so, subject to the following conditions:
|
|
401
|
-
|
|
402
|
-
The above copyright notice and this permission notice shall be included in all
|
|
403
|
-
copies or substantial portions of the Software.
|
|
404
|
-
|
|
405
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
406
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
407
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
408
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
409
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
410
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
411
|
-
SOFTWARE.
|
|
412
|
-
|
|
413
|
-
---
|
|
414
|
-
|
|
415
|
-
Name: react-dom
|
|
416
|
-
Version: 18.3.1
|
|
417
|
-
License: MIT
|
|
418
|
-
Private: false
|
|
419
|
-
Description: React package for working with the DOM.
|
|
420
|
-
Repository: https://github.com/facebook/react.git
|
|
421
|
-
Homepage: https://reactjs.org/
|
|
422
|
-
License Copyright:
|
|
423
|
-
===
|
|
424
|
-
|
|
425
|
-
MIT License
|
|
426
|
-
|
|
427
|
-
Copyright (c) Facebook, Inc. and its affiliates.
|
|
428
|
-
|
|
429
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
430
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
431
|
-
in the Software without restriction, including without limitation the rights
|
|
432
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
433
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
434
|
-
furnished to do so, subject to the following conditions:
|
|
435
|
-
|
|
436
|
-
The above copyright notice and this permission notice shall be included in all
|
|
437
|
-
copies or substantial portions of the Software.
|
|
438
|
-
|
|
439
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
440
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
441
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
442
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
443
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
444
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
445
|
-
SOFTWARE.
|
|
446
|
-
|
|
447
|
-
---
|
|
448
|
-
|
|
449
|
-
Name: scheduler
|
|
450
|
-
Version: 0.23.2
|
|
451
|
-
License: MIT
|
|
452
|
-
Private: false
|
|
453
|
-
Description: Cooperative scheduler for the browser environment.
|
|
454
|
-
Repository: https://github.com/facebook/react.git
|
|
455
|
-
Homepage: https://reactjs.org/
|
|
456
|
-
License Copyright:
|
|
457
|
-
===
|
|
458
|
-
|
|
459
|
-
MIT License
|
|
460
|
-
|
|
461
|
-
Copyright (c) Facebook, Inc. and its affiliates.
|
|
462
|
-
|
|
463
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
464
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
465
|
-
in the Software without restriction, including without limitation the rights
|
|
466
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
467
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
468
|
-
furnished to do so, subject to the following conditions:
|
|
469
|
-
|
|
470
|
-
The above copyright notice and this permission notice shall be included in all
|
|
471
|
-
copies or substantial portions of the Software.
|
|
472
|
-
|
|
473
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
474
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
475
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
476
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
477
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
478
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
479
|
-
SOFTWARE.
|
|
480
|
-
|
|
481
|
-
---
|
|
482
|
-
|
|
483
381
|
Name: sortablejs
|
|
484
382
|
Version: 1.15.6
|
|
485
383
|
License: MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackuait/blok",
|
|
3
|
-
"version": "0.4.1
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -49,14 +49,15 @@
|
|
|
49
49
|
"prepublishOnly": "yarn build",
|
|
50
50
|
"prepare": "husky",
|
|
51
51
|
"release": "./scripts/release.sh release",
|
|
52
|
-
"release:beta": "./scripts/release.sh prerelease beta",
|
|
53
52
|
"release:alpha": "./scripts/release.sh prerelease alpha",
|
|
54
53
|
"release:rc": "./scripts/release.sh prerelease rc",
|
|
55
54
|
"release:dry": "./scripts/release.sh release beta true",
|
|
56
55
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
57
|
-
"storybook:build": "storybook build",
|
|
56
|
+
"storybook:build": "storybook build --stats-json",
|
|
58
57
|
"storybook:test": "vitest --project=storybook --run",
|
|
59
|
-
"chromatic": "chromatic --exit-zero-on-changes"
|
|
58
|
+
"chromatic": "chromatic --exit-zero-on-changes",
|
|
59
|
+
"release:beta": "npm version prerelease --preid=beta",
|
|
60
|
+
"publish:beta": "npm publish --tag beta"
|
|
60
61
|
},
|
|
61
62
|
"author": "JackUait",
|
|
62
63
|
"contributors": [
|
|
@@ -73,7 +74,6 @@
|
|
|
73
74
|
"@chromatic-com/storybook": "4.1.3",
|
|
74
75
|
"@commitlint/cli": "20.1.0",
|
|
75
76
|
"@commitlint/config-conventional": "20.0.0",
|
|
76
|
-
"@eslint-react/eslint-plugin": "^2.3.12",
|
|
77
77
|
"@playwright/test": "1.57.0",
|
|
78
78
|
"@storybook/addon-a11y": "10.1.1",
|
|
79
79
|
"@storybook/addon-vitest": "10.1.1",
|
|
@@ -81,8 +81,6 @@
|
|
|
81
81
|
"@storybook/html-vite": "10.1.1",
|
|
82
82
|
"@types/eslint-plugin-tailwindcss": "3",
|
|
83
83
|
"@types/node": "22.19.0",
|
|
84
|
-
"@types/react": "18.3.1",
|
|
85
|
-
"@types/react-dom": "18.3.1",
|
|
86
84
|
"@types/sortablejs": "1.15.9",
|
|
87
85
|
"@vitest/browser-playwright": "4.0.14",
|
|
88
86
|
"@vitest/coverage-v8": "4.0.14",
|
|
@@ -94,8 +92,6 @@
|
|
|
94
92
|
"eslint-plugin-jest": "29.2.1",
|
|
95
93
|
"eslint-plugin-jsdoc": "61.4.1",
|
|
96
94
|
"eslint-plugin-playwright": "2.3.0",
|
|
97
|
-
"eslint-plugin-react": "^7.37.5",
|
|
98
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
99
95
|
"eslint-plugin-sonarjs": "3.0.5",
|
|
100
96
|
"eslint-plugin-storybook": "10.1.1",
|
|
101
97
|
"eslint-plugin-tailwindcss": "3.18.2",
|
|
@@ -120,8 +116,6 @@
|
|
|
120
116
|
"dependencies": {
|
|
121
117
|
"@types/lodash": "4.17.21",
|
|
122
118
|
"lodash": "4.17.21",
|
|
123
|
-
"react": "18.3.1",
|
|
124
|
-
"react-dom": "18.3.1",
|
|
125
119
|
"sortablejs": "1.15.6",
|
|
126
120
|
"tailwind-merge": "3.4.0"
|
|
127
121
|
}
|
package/types/api/styles.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style class names for tool styling.
|
|
3
|
+
* These are single CSS class names that can be safely used with element.classList.add().
|
|
4
|
+
* The actual styles are defined using Tailwind's @apply directive in the CSS.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Add styles to an element
|
|
8
|
+
* element.classList.add(api.styles.block);
|
|
9
|
+
*
|
|
10
|
+
* // Combine with other classes using tailwind-merge
|
|
11
|
+
* import { twMerge } from '@jackuait/blok/utils/tw';
|
|
12
|
+
* element.className = twMerge(api.styles.block, 'my-4 bg-gray-100');
|
|
13
|
+
*/
|
|
1
14
|
export interface Styles {
|
|
2
15
|
/**
|
|
3
16
|
* Base block styles - applied to block tool wrappers.
|
|
4
17
|
* Provides vertical padding for consistent block spacing.
|
|
5
18
|
* Includes placeholder styling via pseudo-element.
|
|
6
19
|
*
|
|
7
|
-
* @example '
|
|
20
|
+
* @example 'blok-block'
|
|
8
21
|
*/
|
|
9
22
|
block: string;
|
|
10
23
|
|
|
@@ -12,7 +25,7 @@ export interface Styles {
|
|
|
12
25
|
* Styles for Inline Toolbar button.
|
|
13
26
|
* Provides flexbox centering, transparent background, and proper sizing.
|
|
14
27
|
*
|
|
15
|
-
* @example '
|
|
28
|
+
* @example 'blok-inline-tool-button'
|
|
16
29
|
*/
|
|
17
30
|
inlineToolButton: string;
|
|
18
31
|
|
|
@@ -20,7 +33,7 @@ export interface Styles {
|
|
|
20
33
|
* Styles for active Inline Toolbar button.
|
|
21
34
|
* Apply alongside inlineToolButton when the tool is active.
|
|
22
35
|
*
|
|
23
|
-
* @example '
|
|
36
|
+
* @example 'blok-inline-tool-button--active'
|
|
24
37
|
*/
|
|
25
38
|
inlineToolButtonActive: string;
|
|
26
39
|
|
|
@@ -28,7 +41,7 @@ export interface Styles {
|
|
|
28
41
|
* Styles for input elements.
|
|
29
42
|
* Provides full width, border, padding, shadow, and Firefox placeholder workaround.
|
|
30
43
|
*
|
|
31
|
-
* @example '
|
|
44
|
+
* @example 'blok-input'
|
|
32
45
|
*/
|
|
33
46
|
input: string;
|
|
34
47
|
|
|
@@ -36,7 +49,7 @@ export interface Styles {
|
|
|
36
49
|
* Loader styles for loading states.
|
|
37
50
|
* Provides relative positioning, border, and spinning animation.
|
|
38
51
|
*
|
|
39
|
-
* @example '
|
|
52
|
+
* @example 'blok-loader'
|
|
40
53
|
*/
|
|
41
54
|
loader: string;
|
|
42
55
|
|
|
@@ -45,7 +58,7 @@ export interface Styles {
|
|
|
45
58
|
* Provides flexbox centering, transparent background, minimum sizing,
|
|
46
59
|
* mobile responsive sizing, and hover states.
|
|
47
60
|
*
|
|
48
|
-
* @example '
|
|
61
|
+
* @example 'blok-settings-button'
|
|
49
62
|
*/
|
|
50
63
|
settingsButton: string;
|
|
51
64
|
|
|
@@ -53,7 +66,7 @@ export interface Styles {
|
|
|
53
66
|
* Styles for active Settings box buttons.
|
|
54
67
|
* Apply alongside settingsButton when the button is active.
|
|
55
68
|
*
|
|
56
|
-
* @example '
|
|
69
|
+
* @example 'blok-settings-button--active'
|
|
57
70
|
*/
|
|
58
71
|
settingsButtonActive: string;
|
|
59
72
|
|
|
@@ -61,7 +74,7 @@ export interface Styles {
|
|
|
61
74
|
* Styles for focused Settings box buttons.
|
|
62
75
|
* Apply alongside settingsButton when the button has focus.
|
|
63
76
|
*
|
|
64
|
-
* @example '
|
|
77
|
+
* @example 'blok-settings-button--focused'
|
|
65
78
|
*/
|
|
66
79
|
settingsButtonFocused: string;
|
|
67
80
|
|
|
@@ -69,7 +82,7 @@ export interface Styles {
|
|
|
69
82
|
* Styles for focused Settings box buttons with animation.
|
|
70
83
|
* Apply alongside settingsButton and settingsButtonFocused for click animation.
|
|
71
84
|
*
|
|
72
|
-
* @example '
|
|
85
|
+
* @example 'blok-settings-button--focused-animated'
|
|
73
86
|
*/
|
|
74
87
|
settingsButtonFocusedAnimated: string;
|
|
75
88
|
|
|
@@ -77,7 +90,12 @@ export interface Styles {
|
|
|
77
90
|
* Styles for general buttons.
|
|
78
91
|
* Provides padding, border, background, shadow, hover states, and SVG styling.
|
|
79
92
|
*
|
|
80
|
-
* @example '
|
|
93
|
+
* @example 'blok-button'
|
|
81
94
|
*/
|
|
82
95
|
button: string;
|
|
83
96
|
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use Styles instead
|
|
100
|
+
*/
|
|
101
|
+
export type StyleClasses = Styles;
|
|
@@ -52,6 +52,14 @@ export interface BlokConfig {
|
|
|
52
52
|
*/
|
|
53
53
|
historyDebounceTime?: number;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Enable document-level undo/redo shortcuts.
|
|
57
|
+
* When true, Cmd+Z / Ctrl+Z and Cmd+Shift+Z / Ctrl+Shift+Z work even when
|
|
58
|
+
* the editor is not focused (e.g., after dragging a block).
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
globalUndoRedo?: boolean;
|
|
62
|
+
|
|
55
63
|
/**
|
|
56
64
|
* Map of Tools to use
|
|
57
65
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -144,6 +144,8 @@ export interface API {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
import { HeaderConstructable } from './tools/header';
|
|
147
|
+
import { ParagraphConstructable } from './tools/paragraph';
|
|
148
|
+
import { ListConstructable } from './tools/list';
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
151
|
* Main Blok class
|
|
@@ -156,6 +158,16 @@ declare class Blok {
|
|
|
156
158
|
*/
|
|
157
159
|
public static Header: HeaderConstructable;
|
|
158
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Paragraph tool bundled with Blok
|
|
163
|
+
*/
|
|
164
|
+
public static Paragraph: ParagraphConstructable;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* List tool bundled with Blok
|
|
168
|
+
*/
|
|
169
|
+
public static List: ListConstructable;
|
|
170
|
+
|
|
159
171
|
public isReady: Promise<void>;
|
|
160
172
|
|
|
161
173
|
public blocks: Blocks;
|
|
@@ -217,4 +229,4 @@ declare class Blok {
|
|
|
217
229
|
}
|
|
218
230
|
|
|
219
231
|
export as namespace Blok;
|
|
220
|
-
export default Blok;
|
|
232
|
+
export default Blok;
|
package/types/tools/header.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface HeaderData extends BlockToolData {
|
|
|
11
11
|
level: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Level-specific overrides for customization
|
|
16
|
+
*/
|
|
17
|
+
export interface HeaderLevelConfig {
|
|
18
|
+
/** Custom HTML tag to use (e.g., 'div', 'p', 'span') */
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** Custom display name for this level */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Custom font size (e.g., '3em', '24px') */
|
|
23
|
+
size?: string;
|
|
24
|
+
/** Custom margin top (e.g., '20px', '1rem') */
|
|
25
|
+
marginTop?: string;
|
|
26
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
27
|
+
marginBottom?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
31
|
* Header Tool's configuration
|
|
16
32
|
*/
|
|
@@ -21,6 +37,8 @@ export interface HeaderConfig {
|
|
|
21
37
|
levels?: number[];
|
|
22
38
|
/** Default level */
|
|
23
39
|
defaultLevel?: number;
|
|
40
|
+
/** Level-specific overrides keyed by level number (1-6) */
|
|
41
|
+
levelOverrides?: Record<number, HeaderLevelConfig>;
|
|
24
42
|
}
|
|
25
43
|
|
|
26
44
|
/**
|
package/types/tools/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './paste-events';
|
|
|
12
12
|
export * from './hook-events';
|
|
13
13
|
export * from './menu-config';
|
|
14
14
|
export * from './header';
|
|
15
|
+
export * from './list';
|
|
15
16
|
|
|
16
17
|
export type Tool = BlockTool | InlineTool | BlockTune;
|
|
17
18
|
export type ToolConstructable = BlockToolConstructable | InlineToolConstructable | BlockTuneConstructable;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
import { MenuConfig } from './menu-config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List styles enum
|
|
6
|
+
*/
|
|
7
|
+
export type ListStyle = 'unordered' | 'ordered' | 'checklist';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Single list item data
|
|
11
|
+
*/
|
|
12
|
+
export interface ListItem {
|
|
13
|
+
/** Item content (can include HTML) */
|
|
14
|
+
content: string;
|
|
15
|
+
/** Checked state for checklist items */
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
/** Nested items for indentation */
|
|
18
|
+
items?: ListItem[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* List Tool's input and output data format
|
|
23
|
+
*/
|
|
24
|
+
export interface ListData extends BlockToolData {
|
|
25
|
+
/** List style: unordered, ordered, or checklist */
|
|
26
|
+
style: ListStyle;
|
|
27
|
+
/** Array of list items */
|
|
28
|
+
items: ListItem[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* List Tool's configuration
|
|
33
|
+
*/
|
|
34
|
+
export interface ListConfig {
|
|
35
|
+
/** Default list style */
|
|
36
|
+
defaultStyle?: ListStyle;
|
|
37
|
+
/** Available list styles */
|
|
38
|
+
styles?: ListStyle[];
|
|
39
|
+
/** List styles to show in the toolbox */
|
|
40
|
+
toolboxStyles?: ListStyle[];
|
|
41
|
+
/** Custom color for list items */
|
|
42
|
+
itemColor?: string;
|
|
43
|
+
/** Custom font size for list items */
|
|
44
|
+
itemSize?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* List Tool for the Blok Editor
|
|
49
|
+
* Provides Ordered, Unordered, and Checklist Blocks
|
|
50
|
+
*/
|
|
51
|
+
export interface List extends BlockTool {
|
|
52
|
+
/**
|
|
53
|
+
* Return Tool's view
|
|
54
|
+
*/
|
|
55
|
+
render(): HTMLElement;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns list block tunes config
|
|
59
|
+
*/
|
|
60
|
+
renderSettings(): MenuConfig;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Method that specified how to merge two List blocks.
|
|
64
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
65
|
+
*/
|
|
66
|
+
merge(data: ListData): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Validate List block data
|
|
70
|
+
*/
|
|
71
|
+
validate(blockData: ListData): boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Extract Tool's data from the view
|
|
75
|
+
*/
|
|
76
|
+
save(): ListData;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* List Tool constructor
|
|
81
|
+
*/
|
|
82
|
+
export interface ListConstructable extends BlockToolConstructable {
|
|
83
|
+
new(config: BlockToolConstructorOptions<ListData, ListConfig>): List;
|
|
84
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Paragraph Tool's input and output data format
|
|
5
|
+
*/
|
|
6
|
+
export interface ParagraphData extends BlockToolData {
|
|
7
|
+
/** Paragraph's content. Can include HTML tags: <a><b><i> */
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Style overrides for paragraph customization
|
|
13
|
+
*/
|
|
14
|
+
export interface ParagraphStyleConfig {
|
|
15
|
+
/** Custom font size (e.g., '16px', '1rem') */
|
|
16
|
+
size?: string;
|
|
17
|
+
/** Custom line height (e.g., '1.6', '24px') */
|
|
18
|
+
lineHeight?: string;
|
|
19
|
+
/** Custom margin top (e.g., '10px', '0.5rem') */
|
|
20
|
+
marginTop?: string;
|
|
21
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
22
|
+
marginBottom?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Paragraph Tool's configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ParagraphConfig {
|
|
29
|
+
/** Placeholder for the empty paragraph */
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/** Whether or not to keep blank paragraphs when saving editor data */
|
|
32
|
+
preserveBlank?: boolean;
|
|
33
|
+
/** Style overrides for paragraph customization */
|
|
34
|
+
styles?: ParagraphStyleConfig;
|
|
35
|
+
/** Custom icon SVG string for the toolbox */
|
|
36
|
+
icon?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Paragraph Tool for the Blok Editor
|
|
41
|
+
* Provides Text Block
|
|
42
|
+
*/
|
|
43
|
+
export interface Paragraph extends BlockTool {
|
|
44
|
+
/**
|
|
45
|
+
* Return Tool's view
|
|
46
|
+
*/
|
|
47
|
+
render(): HTMLDivElement;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Method that specified how to merge two Paragraph blocks.
|
|
51
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
52
|
+
*/
|
|
53
|
+
merge(data: ParagraphData): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Validate Paragraph block data
|
|
57
|
+
*/
|
|
58
|
+
validate(savedData: ParagraphData): boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Extract Tool's data from the view
|
|
62
|
+
*/
|
|
63
|
+
save(toolsContent: HTMLDivElement): ParagraphData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Paragraph Tool constructor
|
|
68
|
+
*/
|
|
69
|
+
export interface ParagraphConstructable extends BlockToolConstructable {
|
|
70
|
+
new(config: BlockToolConstructorOptions<ParagraphData, ParagraphConfig>): Paragraph;
|
|
71
|
+
}
|
|
@@ -24,7 +24,14 @@ export interface ToolboxConfigEntry {
|
|
|
24
24
|
/**
|
|
25
25
|
* May contain overrides for tool default data
|
|
26
26
|
*/
|
|
27
|
-
data?: BlockToolData
|
|
27
|
+
data?: BlockToolData;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Unique name for the toolbox entry, used for data-blok-item-name attribute.
|
|
31
|
+
* If not provided, falls back to the tool name.
|
|
32
|
+
* Useful when a tool has multiple toolbox entries (e.g., list with ordered/unordered/checklist variants).
|
|
33
|
+
*/
|
|
34
|
+
name?: string;
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
/**
|
|
@@ -182,6 +182,12 @@ export interface PopoverItemDefaultBaseParams {
|
|
|
182
182
|
*/
|
|
183
183
|
hint?: HintParams;
|
|
184
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Custom data attributes to be added to the item element.
|
|
187
|
+
* Keys should be in camelCase (e.g., 'headerLevel' becomes 'data-header-level')
|
|
188
|
+
*/
|
|
189
|
+
dataset?: Record<string, string>;
|
|
190
|
+
|
|
185
191
|
/**
|
|
186
192
|
* Popover item activation handler
|
|
187
193
|
*
|