@uxf/wysiwyg 2.0.0-beta.2 → 2.0.0-beta.21

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.
Files changed (159) hide show
  1. package/README.md +60 -6
  2. package/config/icons-config.d.ts +2 -0
  3. package/config/icons-config.js +6 -0
  4. package/config/icons.d.ts +183 -0
  5. package/config/icons.js +52 -0
  6. package/create-all-plugins-with-ui.d.ts +55 -0
  7. package/create-all-plugins-with-ui.js +125 -0
  8. package/create-plugins-with-ui.d.ts +4 -0
  9. package/create-plugins-with-ui.js +48 -0
  10. package/icons.js +128 -0
  11. package/index.d.ts +3 -2
  12. package/index.js +18 -6
  13. package/package.json +39 -26
  14. package/plugins/button/constants.d.ts +2 -0
  15. package/plugins/button/constants.js +6 -0
  16. package/plugins/button/create-button-plugin.d.ts +2 -0
  17. package/plugins/button/create-button-plugin.js +12 -0
  18. package/plugins/button/index.d.ts +3 -0
  19. package/plugins/button/index.js +24 -0
  20. package/plugins/button/transforms/get-active-button.d.ts +2 -0
  21. package/plugins/button/transforms/get-active-button.js +10 -0
  22. package/plugins/button/transforms/index.d.ts +4 -0
  23. package/plugins/button/transforms/index.js +12 -0
  24. package/plugins/button/transforms/insert-button.d.ts +2 -0
  25. package/plugins/button/transforms/insert-button.js +17 -0
  26. package/plugins/button/transforms/is-button-active.d.ts +2 -0
  27. package/plugins/button/transforms/is-button-active.js +8 -0
  28. package/plugins/button/transforms/remove-selected-button.d.ts +2 -0
  29. package/plugins/button/transforms/remove-selected-button.js +14 -0
  30. package/plugins/button/transforms/update-button.d.ts +2 -0
  31. package/plugins/button/transforms/update-button.js +10 -0
  32. package/plugins/embedded/utils.d.ts +1 -0
  33. package/plugins/embedded/utils.js +8 -0
  34. package/plugins/embedded/video/create-video-plugin.d.ts +4 -0
  35. package/plugins/embedded/video/create-video-plugin.js +20 -0
  36. package/plugins/embedded/video/get-active-video.d.ts +2 -0
  37. package/plugins/embedded/video/get-active-video.js +10 -0
  38. package/plugins/embedded/video/insert-video.d.ts +2 -0
  39. package/plugins/embedded/video/insert-video.js +19 -0
  40. package/plugins/embedded/video/update-video.d.ts +2 -0
  41. package/plugins/embedded/video/update-video.js +12 -0
  42. package/plugins/heading/create-headings-plugin.d.ts +4 -3
  43. package/plugins/heading/create-headings-plugin.js +4 -4
  44. package/plugins/highlight/createHighlightPlugin.d.ts +3 -0
  45. package/plugins/highlight/createHighlightPlugin.js +28 -0
  46. package/plugins/highlight/types.d.ts +10 -0
  47. package/plugins/highlight/types.js +5 -0
  48. package/plugins/image/create-image-plugin.d.ts +1 -1
  49. package/plugins/image/transforms/get-active-image.js +3 -10
  50. package/plugins/image/transforms/insert-image.js +4 -4
  51. package/plugins/image/transforms/is-image-active.d.ts +2 -0
  52. package/plugins/image/transforms/is-image-active.js +8 -0
  53. package/plugins/image/transforms/remove-selected-image.js +3 -7
  54. package/plugins/image/transforms/update-image.js +3 -3
  55. package/plugins/image/types.d.ts +2 -1
  56. package/plugins/image/utils/is-image-url.js +3 -3
  57. package/plugins/link/create-link-plugin.d.ts +3 -3
  58. package/plugins/link/create-link-plugin.js +10 -3
  59. package/plugins/link/floating-link-wrapper.d.ts +11 -0
  60. package/plugins/link/floating-link-wrapper.js +26 -0
  61. package/plugins/link/hooks/use-link-actions.d.ts +1 -2
  62. package/plugins/link/hooks/use-link-actions.js +4 -21
  63. package/plugins/link/hooks/use-link-submit-on-enter.js +2 -2
  64. package/plugins/link/transforms/get-active-link.js +3 -2
  65. package/plugins/link/transforms/insert-link.js +4 -3
  66. package/plugins/link/transforms/is-link-selected.js +10 -8
  67. package/plugins/link/transforms/submit-link.d.ts +2 -1
  68. package/plugins/link/transforms/submit-link.js +4 -3
  69. package/plugins/link/transforms/unwrap-link.d.ts +2 -0
  70. package/plugins/link/transforms/unwrap-link.js +11 -0
  71. package/plugins/link/types.d.ts +5 -0
  72. package/plugins/link/types.js +3 -0
  73. package/plugins/mark-bold/create-bold-plugin.d.ts +1 -1
  74. package/plugins/mark-bold/create-bold-plugin.js +1 -1
  75. package/plugins/mark-code/create-code-plugin.d.ts +1 -1
  76. package/plugins/mark-code/create-code-plugin.js +1 -1
  77. package/plugins/mark-italic/create-italic-plugin.d.ts +1 -1
  78. package/plugins/mark-italic/create-italic-plugin.js +1 -1
  79. package/plugins/mark-underline/create-underline-plugin.d.ts +1 -1
  80. package/plugins/mark-underline/create-underline-plugin.js +1 -1
  81. package/plugins/paragraph/create-paragraph-plugin.d.ts +2 -2
  82. package/plugins/paragraph/create-paragraph-plugin.js +1 -1
  83. package/plugins/reset-node/create-reset-node.js +4 -4
  84. package/types.d.ts +44 -18
  85. package/ui/block-quote-element.js +3 -2
  86. package/ui/button/button-element.d.ts +2 -0
  87. package/ui/button/button-element.js +27 -0
  88. package/ui/button/index.d.ts +1 -0
  89. package/ui/button/index.js +6 -0
  90. package/ui/button/insert-button-modal-content.d.ts +8 -0
  91. package/ui/button/insert-button-modal-content.js +48 -0
  92. package/ui/components/element/element-action-buttons.d.ts +8 -0
  93. package/ui/components/element/element-action-buttons.js +14 -0
  94. package/ui/components/element/element-with-action-buttons.d.ts +9 -0
  95. package/ui/components/element/element-with-action-buttons.js +10 -0
  96. package/ui/components/modal/modal-button-cancel.d.ts +9 -0
  97. package/ui/components/modal/modal-button-cancel.js +20 -0
  98. package/ui/components/modal/modal-button-submit.d.ts +7 -0
  99. package/ui/components/modal/modal-button-submit.js +10 -0
  100. package/ui/components/modal/modal-buttons.d.ts +11 -0
  101. package/ui/components/modal/modal-buttons.js +11 -0
  102. package/ui/components/modal/modal-content.d.ts +6 -0
  103. package/ui/components/modal/modal-content.js +9 -0
  104. package/ui/create-uxf-ui.d.ts +3 -1
  105. package/ui/create-uxf-ui.js +7 -1
  106. package/ui/floating-link.js +41 -32
  107. package/ui/heading-elements.js +7 -7
  108. package/ui/highlight-mark.d.ts +3 -0
  109. package/ui/highlight-mark.js +9 -0
  110. package/ui/image/image-element.js +15 -15
  111. package/ui/image/insert-image-modal-content.d.ts +8 -0
  112. package/ui/image/insert-image-modal-content.js +53 -0
  113. package/ui/link-element.d.ts +1 -1
  114. package/ui/link-element.js +2 -2
  115. package/ui/list-ordered-element.js +2 -2
  116. package/ui/list-unordered-element.js +2 -2
  117. package/ui/toolbar/buttons/button-toolbar-button.d.ts +8 -0
  118. package/ui/toolbar/buttons/button-toolbar-button.js +14 -0
  119. package/ui/toolbar/buttons/element-toolbar-button.d.ts +3 -3
  120. package/ui/toolbar/buttons/element-toolbar-button.js +5 -10
  121. package/ui/toolbar/buttons/image-toolbar-button.d.ts +2 -3
  122. package/ui/toolbar/buttons/image-toolbar-button.js +8 -16
  123. package/ui/toolbar/buttons/link-toolbar-button.d.ts +2 -3
  124. package/ui/toolbar/buttons/link-toolbar-button.js +7 -11
  125. package/ui/toolbar/buttons/list-toolbar-button.d.ts +2 -3
  126. package/ui/toolbar/buttons/list-toolbar-button.js +4 -9
  127. package/ui/toolbar/buttons/mark-toolbar-button.d.ts +4 -3
  128. package/ui/toolbar/buttons/mark-toolbar-button.js +5 -9
  129. package/ui/toolbar/buttons/modal-toolbar-button.d.ts +14 -0
  130. package/ui/toolbar/buttons/modal-toolbar-button.js +17 -0
  131. package/ui/toolbar/buttons/toolbar-button.d.ts +14 -0
  132. package/ui/toolbar/buttons/toolbar-button.js +25 -0
  133. package/ui/toolbar/buttons/undo-redo-button-group.d.ts +2 -0
  134. package/ui/toolbar/buttons/undo-redo-button-group.js +33 -0
  135. package/ui/toolbar/buttons/video-toolbar-button.d.ts +8 -0
  136. package/ui/toolbar/buttons/video-toolbar-button.js +14 -0
  137. package/ui/toolbar/toolbar.d.ts +2 -10
  138. package/ui/toolbar/toolbar.js +19 -2
  139. package/ui/toolbar/types.d.ts +9 -0
  140. package/ui/toolbar/types.js +3 -0
  141. package/ui/utils.d.ts +2 -0
  142. package/ui/utils.js +14 -0
  143. package/ui/video/insert-video-modal-content.d.ts +8 -0
  144. package/ui/video/insert-video-modal-content.js +43 -0
  145. package/ui/video/video-element.d.ts +2 -0
  146. package/ui/video/video-element.js +26 -0
  147. package/utils.d.ts +22 -15
  148. package/utils.js +68 -7
  149. package/wysiwyg-editor.js +17 -0
  150. package/WysiwygEditor.js +0 -32
  151. package/create-all-uxf-plugins.d.ts +0 -2
  152. package/create-all-uxf-plugins.js +0 -33
  153. package/plugins/create-uxf-plugins.d.ts +0 -5
  154. package/plugins/create-uxf-plugins.js +0 -23
  155. package/ui/image/image-upload-dialog.d.ts +0 -10
  156. package/ui/image/image-upload-dialog.js +0 -63
  157. package/ui/toolbar/buttons/icons.d.ts +0 -16
  158. package/ui/toolbar/buttons/icons.js +0 -37
  159. /package/{WysiwygEditor.d.ts → wysiwyg-editor.d.ts} +0 -0
package/README.md CHANGED
@@ -1,8 +1,62 @@
1
- ## Wysiwyg Mvp
2
- `yarn add @udecode/plate`
3
- ### required peer deps
4
- ```bash
5
- yarn install slate slate-react slate-history slate-hyperscript react react-dom react-dnd react-dnd-html5-backend styled-components @styled-icons/material
1
+ [![npm](https://img.shields.io/npm/v/@uxf/wysiwyg)](https://www.npmjs.com/package/@uxf/wysiwyg)
2
+ [![size](https://img.shields.io/bundlephobia/min/@uxf/wysiwyg)](https://www.npmjs.com/package/@uxf/wysiwyg)
3
+ [![quality](https://img.shields.io/npms-io/quality-score/@uxf/wysiwyg)](https://www.npmjs.com/package/@uxf/wysiwyg)
4
+ [![license](https://img.shields.io/npm/l/@uxf/wysiwyg)](https://www.npmjs.com/package/@uxf/wysiwyg)
5
+
6
+ # UXF Wysiwyg editor
7
+
8
+ ## @uxf/ui configuration
9
+ - wrap your app with `UiContextProvider`
10
+ - add `<Modal ref={getModalRef()} />` to make modals work
11
+
12
+ ```tsx
13
+ <UiContextProvider value={getProviderConfig()}>
14
+ <App />
15
+ <Modal ref={getModalRef()} />
16
+ </UiContextProvider>
6
17
  ```
7
18
 
8
- soft break & exit break: @udecode/plate-break
19
+ ## Usage with all available plugins
20
+ ```tsx
21
+ const plugins = useMemo(
22
+ () =>
23
+ createUxfPlugins({
24
+ headings: { disabledLevels: [1] },
25
+ image: {
26
+ uploadImage: fileUpload,
27
+ getImageUrl: getOriginalFileUrl,
28
+ },
29
+ }),
30
+ [],
31
+ );
32
+
33
+ <WysiwygEditor initialValue={initialValue} onChange={onChange} plugins={plugins} />
34
+ ```
35
+
36
+ ## Usage with specific plugins
37
+ ```tsx
38
+ const onlySelectedPlugins = useMemo(
39
+ () =>
40
+ createPluginsWithUi([
41
+ createHeadingsPluginWithUi({
42
+ disabledLevels: [1],
43
+ }),
44
+ createImagePluginWithUi({
45
+ uploadImage: fileUpload,
46
+ getImageUrl: getOriginalFileUrl,
47
+ }),
48
+ createBlockQuotePluginWithUi(),
49
+ createBoldPluginWithUi(),
50
+ createItalicPluginWithUi(),
51
+ createUnderlinePluginWithUi(),
52
+ createCodePluginWithUi(),
53
+ createListPluginWithUi(),
54
+ createLinkPluginWithUi(),
55
+ createVideoPluginWithUi(),
56
+ ]),
57
+
58
+ [],
59
+ );
60
+
61
+ <WysiwygEditor initialValue={initialValue} onChange={onChange} plugins={onlySelectedPlugins} />
62
+ ```
@@ -0,0 +1,2 @@
1
+ export declare const ICONS_VERSION = "1681909549492";
2
+ export declare const ICON_SPRITE = "/icons-generated/_icon-sprite.svg";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICON_SPRITE = exports.ICONS_VERSION = void 0;
4
+ exports.ICONS_VERSION = "1681909549492";
5
+ exports.ICON_SPRITE = "/icons-generated/_icon-sprite.svg";
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbnMtY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy9pY29ucy1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxhQUFhLEdBQUcsZUFBZSxDQUFDO0FBQ2hDLFFBQUEsV0FBVyxHQUFHLG1DQUFtQyxDQUFDIn0=
@@ -0,0 +1,183 @@
1
+ export declare const ICONS: {
2
+ readonly calendar: {
3
+ readonly w: 448;
4
+ readonly h: 512;
5
+ };
6
+ readonly camera: {
7
+ readonly w: 512;
8
+ readonly h: 512;
9
+ };
10
+ readonly caretDown: {
11
+ readonly w: 320;
12
+ readonly h: 512;
13
+ };
14
+ readonly clock: {
15
+ readonly w: 512;
16
+ readonly h: 512;
17
+ };
18
+ readonly bars: {
19
+ readonly w: 448;
20
+ readonly h: 512;
21
+ };
22
+ readonly check: {
23
+ readonly w: 512;
24
+ readonly h: 512;
25
+ };
26
+ readonly chevronDown: {
27
+ readonly w: 512;
28
+ readonly h: 512;
29
+ };
30
+ readonly chevronLeft: {
31
+ readonly w: 384;
32
+ readonly h: 512;
33
+ };
34
+ readonly chevronsLeft: {
35
+ readonly w: 512;
36
+ readonly h: 512;
37
+ };
38
+ readonly chevronRight: {
39
+ readonly w: 384;
40
+ readonly h: 512;
41
+ };
42
+ readonly chevronsRight: {
43
+ readonly w: 512;
44
+ readonly h: 512;
45
+ };
46
+ readonly chevronUp: {
47
+ readonly w: 512;
48
+ readonly h: 512;
49
+ };
50
+ readonly cloud: {
51
+ readonly w: 640;
52
+ readonly h: 512;
53
+ };
54
+ readonly copy: {
55
+ readonly w: 512;
56
+ readonly h: 512;
57
+ };
58
+ readonly "ellipsis-vertical": {
59
+ readonly w: 128;
60
+ readonly h: 512;
61
+ };
62
+ readonly file: {
63
+ readonly w: 384;
64
+ readonly h: 512;
65
+ };
66
+ readonly imageFile: {
67
+ readonly w: 384;
68
+ readonly h: 512;
69
+ };
70
+ readonly videoFile: {
71
+ readonly w: 384;
72
+ readonly h: 512;
73
+ };
74
+ readonly user: {
75
+ readonly w: 448;
76
+ readonly h: 512;
77
+ };
78
+ readonly xmarkLarge: {
79
+ readonly w: 448;
80
+ readonly h: 512;
81
+ };
82
+ readonly h1: {
83
+ readonly w: 576;
84
+ readonly h: 512;
85
+ };
86
+ readonly h2: {
87
+ readonly w: 640;
88
+ readonly h: 512;
89
+ };
90
+ readonly h3: {
91
+ readonly w: 640;
92
+ readonly h: 512;
93
+ };
94
+ readonly h4: {
95
+ readonly w: 640;
96
+ readonly h: 512;
97
+ };
98
+ readonly h5: {
99
+ readonly w: 640;
100
+ readonly h: 512;
101
+ };
102
+ readonly h6: {
103
+ readonly w: 640;
104
+ readonly h: 512;
105
+ };
106
+ readonly bold: {
107
+ readonly w: 384;
108
+ readonly h: 512;
109
+ };
110
+ readonly italic: {
111
+ readonly w: 384;
112
+ readonly h: 512;
113
+ };
114
+ readonly underline: {
115
+ readonly w: 448;
116
+ readonly h: 512;
117
+ };
118
+ readonly ol: {
119
+ readonly w: 512;
120
+ readonly h: 512;
121
+ };
122
+ readonly ul: {
123
+ readonly w: 576;
124
+ readonly h: 512;
125
+ };
126
+ readonly "code-simple": {
127
+ readonly w: 576;
128
+ readonly h: 512;
129
+ };
130
+ readonly link: {
131
+ readonly w: 640;
132
+ readonly h: 512;
133
+ };
134
+ readonly image: {
135
+ readonly w: 512;
136
+ readonly h: 512;
137
+ };
138
+ readonly youtube: {
139
+ readonly w: 576;
140
+ readonly h: 512;
141
+ };
142
+ readonly "block-quote": {
143
+ readonly w: 576;
144
+ readonly h: 512;
145
+ };
146
+ readonly "arrow-left": {
147
+ readonly w: 448;
148
+ readonly h: 512;
149
+ };
150
+ readonly "arrow-right": {
151
+ readonly w: 448;
152
+ readonly h: 512;
153
+ };
154
+ readonly "arrow-turn-down-left": {
155
+ readonly w: 512;
156
+ readonly h: 512;
157
+ };
158
+ readonly "arrow-turn-down-right": {
159
+ readonly w: 512;
160
+ readonly h: 512;
161
+ };
162
+ readonly "rectangle-wide": {
163
+ readonly w: 640;
164
+ readonly h: 512;
165
+ };
166
+ readonly edit: {
167
+ readonly w: 512;
168
+ readonly h: 512;
169
+ };
170
+ readonly delete: {
171
+ readonly w: 448;
172
+ readonly h: 512;
173
+ };
174
+ readonly "open-link-in-new-tab": {
175
+ readonly w: 512;
176
+ readonly h: 512;
177
+ };
178
+ readonly "highlighter-line": {
179
+ readonly w: 576;
180
+ readonly h: 512;
181
+ };
182
+ };
183
+ export type IconsSet = keyof typeof ICONS;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ // this file is generated automatically, do not change anything manually in the contents of this file
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ICONS = void 0;
5
+ exports.ICONS = {
6
+ "calendar": { w: 448, h: 512 },
7
+ "camera": { w: 512, h: 512 },
8
+ "caretDown": { w: 320, h: 512 },
9
+ "clock": { w: 512, h: 512 },
10
+ "bars": { w: 448, h: 512 },
11
+ "check": { w: 512, h: 512 },
12
+ "chevronDown": { w: 512, h: 512 },
13
+ "chevronLeft": { w: 384, h: 512 },
14
+ "chevronsLeft": { w: 512, h: 512 },
15
+ "chevronRight": { w: 384, h: 512 },
16
+ "chevronsRight": { w: 512, h: 512 },
17
+ "chevronUp": { w: 512, h: 512 },
18
+ "cloud": { w: 640, h: 512 },
19
+ "copy": { w: 512, h: 512 },
20
+ "ellipsis-vertical": { w: 128, h: 512 },
21
+ "file": { w: 384, h: 512 },
22
+ "imageFile": { w: 384, h: 512 },
23
+ "videoFile": { w: 384, h: 512 },
24
+ "user": { w: 448, h: 512 },
25
+ "xmarkLarge": { w: 448, h: 512 },
26
+ "h1": { w: 576, h: 512 },
27
+ "h2": { w: 640, h: 512 },
28
+ "h3": { w: 640, h: 512 },
29
+ "h4": { w: 640, h: 512 },
30
+ "h5": { w: 640, h: 512 },
31
+ "h6": { w: 640, h: 512 },
32
+ "bold": { w: 384, h: 512 },
33
+ "italic": { w: 384, h: 512 },
34
+ "underline": { w: 448, h: 512 },
35
+ "ol": { w: 512, h: 512 },
36
+ "ul": { w: 576, h: 512 },
37
+ "code-simple": { w: 576, h: 512 },
38
+ "link": { w: 640, h: 512 },
39
+ "image": { w: 512, h: 512 },
40
+ "youtube": { w: 576, h: 512 },
41
+ "block-quote": { w: 576, h: 512 },
42
+ "arrow-left": { w: 448, h: 512 },
43
+ "arrow-right": { w: 448, h: 512 },
44
+ "arrow-turn-down-left": { w: 512, h: 512 },
45
+ "arrow-turn-down-right": { w: 512, h: 512 },
46
+ "rectangle-wide": { w: 640, h: 512 },
47
+ "edit": { w: 512, h: 512 },
48
+ "delete": { w: 448, h: 512 },
49
+ "open-link-in-new-tab": { w: 512, h: 512 },
50
+ "highlighter-line": { w: 576, h: 512 },
51
+ };
52
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlnL2ljb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxxR0FBcUc7OztBQUV4RixRQUFBLEtBQUssR0FBRztJQUNqQixVQUFVLEVBQUUsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUU7SUFDOUIsUUFBUSxFQUFFLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFO0lBQzVCLFdBQVcsRUFBRSxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRTtJQUMvQixPQUFPLEVBQUUsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUU7SUFDM0IsTUFBTSxFQUFFLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFO0lBQzFCLE9BQU8sRUFBRSxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRTtJQUMzQixhQUFhLEVBQUUsRUFBRSxDQUFDLEVBQUUsR0FBRyxFQUFFLENBQUMsRUFBRSxHQUFHLEVBQUU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QyxFQUFFLEdBQUcsRUFBRTtDQUNoQyxDQUFDIn0=
@@ -0,0 +1,55 @@
1
+ import { HeadingsPluginOptions } from "./plugins/heading/create-headings-plugin";
2
+ import { UxfImagePluginOptions } from "./plugins/image/types";
3
+ import { ElementUiComponent } from "./types";
4
+ import { CSSProperties } from "react";
5
+ export declare const createHeadingsPluginWithUi: (options?: HeadingsPluginOptions) => {
6
+ plugin: import("@udecode/plate-core").PlatePlugin<HeadingsPluginOptions, import("./types").WysiwygContent, import("@udecode/plate-core").PlateEditor<import("./types").WysiwygContent>>;
7
+ components: {
8
+ [key: string]: ElementUiComponent<import("./types").UxfBlockElement>;
9
+ };
10
+ };
11
+ export declare const createBlockQuotePluginWithUi: () => {
12
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").HotkeyPlugin, import("./types").WysiwygContent, import("./types").UxfEditor>;
13
+ component: ElementUiComponent<import("./types").UxfBlockElement>;
14
+ };
15
+ export declare const createBoldPluginWithUi: () => {
16
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").ToggleMarkPlugin, import("./types").WysiwygContent, import("./types").UxfEditor>;
17
+ component: import("./types").LeafUiComponent<import("./types").RichText>;
18
+ };
19
+ export declare const createHighlightPluginWithUi: (color?: CSSProperties["color"]) => {
20
+ plugin: import("@udecode/plate-core").PlatePlugin<import("./plugins/highlight/types").HighlightPluginOptions, import("./types").WysiwygContent, import("@udecode/plate-core").PlateEditor<import("./types").WysiwygContent>>;
21
+ component: import("react").FC<import("./plugins/highlight/types").HighlightLeafElementProps>;
22
+ };
23
+ export declare const createItalicPluginWithUi: () => {
24
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").ToggleMarkPlugin, import("./types").WysiwygContent, import("./types").UxfEditor>;
25
+ component: ElementUiComponent<import("./types").UxfBlockElement>;
26
+ };
27
+ export declare const createUnderlinePluginWithUi: () => {
28
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").ToggleMarkPlugin, import("./types").WysiwygContent, import("./types").UxfEditor>;
29
+ component: import("./types").LeafUiComponent<import("./types").RichText>;
30
+ };
31
+ export declare const createCodePluginWithUi: () => {
32
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").ToggleMarkPlugin, import("./types").WysiwygContent, import("./types").UxfEditor>;
33
+ component: import("./types").LeafUiComponent<import("./types").RichText>;
34
+ };
35
+ export declare const createListPluginWithUi: () => {
36
+ plugin: import("./types").UxfPlatePlugin<import("@udecode/plate-list").ListPlugin>;
37
+ components: {
38
+ ul: ElementUiComponent<import("./types").UxfBlockElement>;
39
+ ol: ElementUiComponent<import("./types").UxfBlockElement>;
40
+ li: ElementUiComponent<import("./types").UxfBlockElement>;
41
+ };
42
+ };
43
+ export declare const createImagePluginWithUi: (options: UxfImagePluginOptions) => {
44
+ plugin: import("@udecode/plate-core").PlatePlugin<UxfImagePluginOptions, import("./types").WysiwygContent, import("@udecode/plate-core").PlateEditor<import("./types").WysiwygContent>>;
45
+ component: ElementUiComponent<import("./types").UxfImageElement>;
46
+ };
47
+ export declare const createVideoPluginWithUi: () => {
48
+ plugin: import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-media").MediaPlugin, import("./types").WysiwygContent, import("@udecode/plate-core").PlateEditor<import("./types").WysiwygContent>>;
49
+ component: ElementUiComponent<import("./types").UxfVideoElement>;
50
+ };
51
+ export declare const createAllPluginsWithUi: (options: {
52
+ image: UxfImagePluginOptions;
53
+ headings?: HeadingsPluginOptions;
54
+ highlightColor?: CSSProperties["color"];
55
+ }) => import("./types").UxfPlatePlugin<import("@udecode/utils").AnyObject>[];
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAllPluginsWithUi = exports.createVideoPluginWithUi = exports.createImagePluginWithUi = exports.createListPluginWithUi = exports.createCodePluginWithUi = exports.createUnderlinePluginWithUi = exports.createItalicPluginWithUi = exports.createHighlightPluginWithUi = exports.createBoldPluginWithUi = exports.createBlockQuotePluginWithUi = exports.createHeadingsPluginWithUi = void 0;
4
+ const create_plugins_with_ui_1 = require("./create-plugins-with-ui");
5
+ const create_block_quote_plugin_1 = require("./plugins/block-quote/create-block-quote-plugin");
6
+ const create_video_plugin_1 = require("./plugins/embedded/video/create-video-plugin");
7
+ const constants_1 = require("./plugins/heading/constants");
8
+ const create_headings_plugin_1 = require("./plugins/heading/create-headings-plugin");
9
+ const create_image_plugin_1 = require("./plugins/image/create-image-plugin");
10
+ const create_link_plugin_1 = require("./plugins/link/create-link-plugin");
11
+ const create_list_plugin_1 = require("./plugins/list/create-list-plugin");
12
+ const create_bold_plugin_1 = require("./plugins/mark-bold/create-bold-plugin");
13
+ const create_code_plugin_1 = require("./plugins/mark-code/create-code-plugin");
14
+ const create_italic_plugin_1 = require("./plugins/mark-italic/create-italic-plugin");
15
+ const create_underline_plugin_1 = require("./plugins/mark-underline/create-underline-plugin");
16
+ const block_quote_element_1 = require("./ui/block-quote-element");
17
+ const bold_mark_1 = require("./ui/bold-mark");
18
+ const code_mark_1 = require("./ui/code-mark");
19
+ const heading_elements_1 = require("./ui/heading-elements");
20
+ const image_element_1 = require("./ui/image/image-element");
21
+ const italic_mark_1 = require("./ui/italic-mark");
22
+ const link_element_1 = require("./ui/link-element");
23
+ const list_item_element_1 = require("./ui/list-item-element");
24
+ const list_ordered_element_1 = require("./ui/list-ordered-element");
25
+ const list_unordered_element_1 = require("./ui/list-unordered-element");
26
+ const underline_mark_1 = require("./ui/underline-mark");
27
+ const video_element_1 = require("./ui/video/video-element");
28
+ const button_1 = require("./plugins/button");
29
+ const button_2 = require("./ui/button");
30
+ const createHighlightPlugin_1 = require("./plugins/highlight/createHighlightPlugin");
31
+ const highlight_mark_1 = require("./ui/highlight-mark");
32
+ const tw_colors_1 = require("@uxf/ui/tw-tokens/tw-colors");
33
+ const createHeadingsPluginWithUi = (options) => {
34
+ var _a;
35
+ const disabledLevels = (_a = options === null || options === void 0 ? void 0 : options.disabledLevels) !== null && _a !== void 0 ? _a : [];
36
+ const isDisabled = (level) => disabledLevels.findIndex((e) => e === level) !== -1;
37
+ const components = {};
38
+ const elementsByKey = [heading_elements_1.H1Element, heading_elements_1.H2Element, heading_elements_1.H3Element, heading_elements_1.H4Element, heading_elements_1.H5Element, heading_elements_1.H6Element];
39
+ for (let level = 1; level <= 6; level++) {
40
+ if (isDisabled(level)) {
41
+ continue;
42
+ }
43
+ components[constants_1.KEYS_HEADING[level - 1]] = elementsByKey[level - 1];
44
+ }
45
+ return {
46
+ plugin: (0, create_headings_plugin_1.createHeadingsPlugin)({ options }),
47
+ components,
48
+ };
49
+ };
50
+ exports.createHeadingsPluginWithUi = createHeadingsPluginWithUi;
51
+ const createBlockQuotePluginWithUi = () => ({
52
+ plugin: (0, create_block_quote_plugin_1.createBlockquotePlugin)(),
53
+ component: block_quote_element_1.BlockQuoteElement,
54
+ });
55
+ exports.createBlockQuotePluginWithUi = createBlockQuotePluginWithUi;
56
+ const createBoldPluginWithUi = () => ({
57
+ plugin: (0, create_bold_plugin_1.createBoldPlugin)(),
58
+ component: bold_mark_1.BoldMark,
59
+ });
60
+ exports.createBoldPluginWithUi = createBoldPluginWithUi;
61
+ const createHighlightPluginWithUi = (color = tw_colors_1.twColors.yellow["300"]) => ({
62
+ plugin: (0, createHighlightPlugin_1.createHighlightPlugin)(color),
63
+ component: highlight_mark_1.HighlightMark,
64
+ });
65
+ exports.createHighlightPluginWithUi = createHighlightPluginWithUi;
66
+ const createItalicPluginWithUi = () => ({
67
+ plugin: (0, create_italic_plugin_1.createItalicPlugin)(),
68
+ component: italic_mark_1.ItalicMark,
69
+ });
70
+ exports.createItalicPluginWithUi = createItalicPluginWithUi;
71
+ const createUnderlinePluginWithUi = () => ({
72
+ plugin: (0, create_underline_plugin_1.createUnderlinePlugin)(),
73
+ component: underline_mark_1.UnderlineMark,
74
+ });
75
+ exports.createUnderlinePluginWithUi = createUnderlinePluginWithUi;
76
+ const createCodePluginWithUi = () => ({
77
+ plugin: (0, create_code_plugin_1.createCodePlugin)(),
78
+ component: code_mark_1.CodeMark,
79
+ });
80
+ exports.createCodePluginWithUi = createCodePluginWithUi;
81
+ const createListPluginWithUi = () => ({
82
+ plugin: (0, create_list_plugin_1.createListPlugin)(),
83
+ components: {
84
+ ul: list_unordered_element_1.ListUnorderedElement,
85
+ ol: list_ordered_element_1.ListOrderedElement,
86
+ li: list_item_element_1.ListItemElement,
87
+ },
88
+ });
89
+ exports.createListPluginWithUi = createListPluginWithUi;
90
+ const createLinkPluginWithUi = () => ({
91
+ plugin: (0, create_link_plugin_1.createLinkPlugin)(),
92
+ component: link_element_1.LinkElement,
93
+ });
94
+ const createImagePluginWithUi = (options) => ({
95
+ plugin: (0, create_image_plugin_1.createImagePlugin)({
96
+ options,
97
+ }),
98
+ component: image_element_1.ImageElement,
99
+ });
100
+ exports.createImagePluginWithUi = createImagePluginWithUi;
101
+ const createVideoPluginWithUi = () => ({
102
+ plugin: (0, create_video_plugin_1.createVideoPlugin)(),
103
+ component: video_element_1.VideoElement,
104
+ });
105
+ exports.createVideoPluginWithUi = createVideoPluginWithUi;
106
+ const createButtonPluginWithUi = () => ({
107
+ plugin: (0, button_1.createButtonPlugin)(),
108
+ component: button_2.ButtonElement,
109
+ });
110
+ const createAllPluginsWithUi = (options) => (0, create_plugins_with_ui_1.createPluginsWithUi)([
111
+ (0, exports.createHeadingsPluginWithUi)(options.headings),
112
+ (0, exports.createBlockQuotePluginWithUi)(),
113
+ (0, exports.createBoldPluginWithUi)(),
114
+ (0, exports.createItalicPluginWithUi)(),
115
+ (0, exports.createUnderlinePluginWithUi)(),
116
+ (0, exports.createCodePluginWithUi)(),
117
+ (0, exports.createListPluginWithUi)(),
118
+ createLinkPluginWithUi(),
119
+ (0, exports.createImagePluginWithUi)(options.image),
120
+ (0, exports.createVideoPluginWithUi)(),
121
+ createButtonPluginWithUi(),
122
+ (0, exports.createHighlightPluginWithUi)(options.highlightColor),
123
+ ]);
124
+ exports.createAll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FO0lBQ3hCLElBQUEsOEJBQXNCLEdBQUU7SUFDeEIsc0JBQXNCLEVBQUU7SUFDeEIsSUFBQSwrQkFBdUIsRUFBQyxPQUFPLENBQUMsS0FBSyxDQUFDO0lBQ3RDLElBQUEsK0JBQXVCLEdBQUU7SUFDekIsd0JBQXdCLEVBQUU7SUFDMUIsSUFBQSxtQ0FBMkIsRUFBQyxPQUFPLENBQUMsY0FBYyxDQUFDO0NBQ3RELENBQUMsQ0FBQztBQWxCTSxRQUFBLHNCQUFzQiwwQkFrQjVCIn0=
@@ -0,0 +1,4 @@
1
+ import { MyOverrideByKey, UxfPlatePlugin, WysiwygPlugin, WysiwygRecursivePlugin } from "./types";
2
+ export declare const createPluginsWithUi: (wysiwygPlugins: Array<WysiwygPlugin<any> | WysiwygRecursivePlugin<string>>, options?: {
3
+ overrideByKey?: MyOverrideByKey;
4
+ }) => UxfPlatePlugin[];
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPluginsWithUi = void 0;
4
+ const plate_core_1 = require("@udecode/plate-core");
5
+ const create_exit_break_plugin_1 = require("./plugins/exit-break/create-exit-break-plugin");
6
+ const create_node_id_plugin_1 = require("./plugins/node-id/create-node-id-plugin");
7
+ const create_paragraph_plugin_1 = require("./plugins/paragraph/create-paragraph-plugin");
8
+ const types_1 = require("./plugins/paragraph/types");
9
+ const create_reset_node_1 = require("./plugins/reset-node/create-reset-node");
10
+ const create_select_on_backspace_plugin_1 = require("./plugins/select-on-backspace/create-select-on-backspace-plugin");
11
+ const create_soft_break_plugin_1 = require("./plugins/soft-break/create-soft-break-plugin");
12
+ const create_trailing_block_plugin_1 = require("./plugins/trailing-block/create-trailing-block-plugin");
13
+ const paragraph_element_1 = require("./ui/paragraph-element");
14
+ function isRecursivePlugin(plugin) {
15
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
16
+ return plugin.components !== undefined;
17
+ }
18
+ const createPluginsWithUi = (wysiwygPlugins, options) => {
19
+ const plugins = wysiwygPlugins.map((p) => p.plugin);
20
+ const pluginComponents = {
21
+ [types_1.PARAGRAPH_PLUGIN_KEY]: paragraph_element_1.ParagraphElement,
22
+ };
23
+ wysiwygPlugins.forEach((p) => {
24
+ if (isRecursivePlugin(p)) {
25
+ Object.keys(p.components).forEach((componentKey) => {
26
+ pluginComponents[componentKey] = p.components[componentKey];
27
+ });
28
+ }
29
+ else {
30
+ pluginComponents[p.plugin.key] = p.component;
31
+ }
32
+ });
33
+ return (0, plate_core_1.createPlugins)([
34
+ (0, create_paragraph_plugin_1.createParagraphPlugin)(),
35
+ (0, create_exit_break_plugin_1.createExitBreakPlugin)(),
36
+ (0, create_reset_node_1.createResetNodePlugin)(),
37
+ (0, create_soft_break_plugin_1.createSoftBreakPlugin)(),
38
+ (0, create_node_id_plugin_1.createNodeIdPlugin)(),
39
+ (0, create_select_on_backspace_plugin_1.createSelectOnBackspacePlugin)(),
40
+ (0, create_trailing_block_plugin_1.createTrailingBlockPlugin)(),
41
+ ...plugins,
42
+ ], {
43
+ ...options,
44
+ components: pluginComponents,
45
+ });
46
+ };
47
+ exports.createPluginsWithUi = createPluginsWithUi;
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLXBsdWdpbnMtd2l0aC11aS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGUtcGx1Z2lucy13aXRoLXVpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLG9EQUFvRDtBQUNwRCw0RkFBc0Y7QUFDdEYsbUZBQTZFO0FBQzdFLHlGQUFvRjtBQUNwRixxREFBaUU7QUFDakUsOEVBQStFO0FBQy9FLHVIQUFnSDtBQUNoSCw0RkFBc0Y7QUFDdEYsd0dBQWtHO0FBV2xHLDhEQUEwRDtBQUUxRCxTQUFTLGlCQUFpQixDQUN0QixNQUFzRDtJQU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