@reacteditor/core 0.0.1-alpha.0
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/README.md +85 -0
- package/dist/Editor-GBV2O5RD.css +415 -0
- package/dist/Editor-IKMJILGR.mjs +204 -0
- package/dist/Render-EFT7YD2C.css +103 -0
- package/dist/Render-VDC7AEQK.mjs +55 -0
- package/dist/actions-BCDhqbeL.d.mts +849 -0
- package/dist/actions-BCDhqbeL.d.ts +849 -0
- package/dist/chunk-2YLS65V2.mjs +103 -0
- package/dist/chunk-6B2Q5R3C.mjs +53 -0
- package/dist/chunk-DXGQXXQG.mjs +63 -0
- package/dist/chunk-F7S5S6I2.mjs +114 -0
- package/dist/chunk-GAUBBDIR.mjs +463 -0
- package/dist/chunk-GUMYXUO3.mjs +33 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MFI3RDA4.mjs +11 -0
- package/dist/chunk-QNHSXCWU.mjs +8692 -0
- package/dist/chunk-SURZYH7D.mjs +1726 -0
- package/dist/chunk-V2OPYD42.mjs +708 -0
- package/dist/chunk-VD3EVRUF.mjs +476 -0
- package/dist/chunk-VOLQMQPK.mjs +146 -0
- package/dist/chunk-VUEM62JF.mjs +523 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-ELX6RALJ.css +311 -0
- package/dist/full-OBTPW7TC.mjs +93 -0
- package/dist/index-ComBHfdn.d.ts +117 -0
- package/dist/index-DVwiIwYU.d.mts +117 -0
- package/dist/index.css +3033 -0
- package/dist/index.d.mts +396 -0
- package/dist/index.d.ts +396 -0
- package/dist/index.js +14688 -0
- package/dist/index.mjs +87 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +931 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-35WC23HJ.mjs +60 -0
- package/dist/loaded-TBSVRJPY.css +90 -0
- package/dist/loaded-ULSROV73.mjs +57 -0
- package/dist/loaded-YYRJPIWZ.mjs +57 -0
- package/dist/no-external.css +3031 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +14688 -0
- package/dist/no-external.mjs +87 -0
- package/dist/rsc.css +103 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1493 -0
- package/dist/rsc.mjs +148 -0
- package/dist/walk-tree-BPIigVTF.d.mts +29 -0
- package/dist/walk-tree-BZq1CPCH.d.ts +29 -0
- package/package.json +139 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/RichTextMenu/styles.module.css/#css-module-data */
|
|
2
|
+
._RichTextMenu_7muaf_1 {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
flex-wrap: nowrap;
|
|
6
|
+
}
|
|
7
|
+
._RichTextMenu--form_7muaf_7 {
|
|
8
|
+
border-top-left-radius: var(--re-radius-md);
|
|
9
|
+
border-top-right-radius: var(--re-radius-md);
|
|
10
|
+
padding: 6px 6px;
|
|
11
|
+
background-color: var(--re-surface-sunken);
|
|
12
|
+
position: relative;
|
|
13
|
+
scrollbar-width: none;
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
}
|
|
16
|
+
._RichTextMenu-group_7muaf_17 {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: space-between;
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
flex-wrap: nowrap;
|
|
21
|
+
padding-inline: 6px;
|
|
22
|
+
gap: 2px;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
._RichTextMenu-group_7muaf_17:first-of-type {
|
|
26
|
+
padding-left: 0;
|
|
27
|
+
}
|
|
28
|
+
._RichTextMenu-group_7muaf_17:last-of-type {
|
|
29
|
+
padding-right: 0;
|
|
30
|
+
}
|
|
31
|
+
._RichTextMenu--inline_7muaf_35 ._RichTextMenu-group_7muaf_17 {
|
|
32
|
+
color: var(--re-text-inverse);
|
|
33
|
+
opacity: 0.85;
|
|
34
|
+
gap: 0px;
|
|
35
|
+
flex-wrap: nowrap;
|
|
36
|
+
}
|
|
37
|
+
._RichTextMenu-group_7muaf_17 + ._RichTextMenu-group_7muaf_17 {
|
|
38
|
+
border-left: 1px solid var(--re-border-subtle);
|
|
39
|
+
}
|
|
40
|
+
._RichTextMenu--inline_7muaf_35 ._RichTextMenu-group_7muaf_17 + ._RichTextMenu-group_7muaf_17 {
|
|
41
|
+
border-left: 0.5px solid rgba(255, 255, 255, 0.2);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/IconButton/IconButton.module.css/#css-module-data */
|
|
45
|
+
._IconButton_19x6h_1 {
|
|
46
|
+
align-items: center;
|
|
47
|
+
background: transparent;
|
|
48
|
+
border: none;
|
|
49
|
+
border-radius: var(--re-radius-md);
|
|
50
|
+
color: currentColor;
|
|
51
|
+
display: flex;
|
|
52
|
+
font-family: var(--re-font-family);
|
|
53
|
+
justify-content: center;
|
|
54
|
+
padding: 4px;
|
|
55
|
+
transition: background-color var(--re-motion-fast) var(--re-ease), color var(--re-motion-fast) var(--re-ease);
|
|
56
|
+
}
|
|
57
|
+
._IconButton--active_19x6h_15 {
|
|
58
|
+
color: var(--re-text-accent);
|
|
59
|
+
background: var(--re-accent-soft);
|
|
60
|
+
}
|
|
61
|
+
._IconButton_19x6h_1:focus-visible {
|
|
62
|
+
outline: none;
|
|
63
|
+
box-shadow: var(--re-ring);
|
|
64
|
+
}
|
|
65
|
+
@media (hover: hover) and (pointer: fine) {
|
|
66
|
+
._IconButton_19x6h_1:hover:not(._IconButton--disabled_19x6h_26) {
|
|
67
|
+
background: var(--re-surface-hover);
|
|
68
|
+
color: var(--re-text-accent);
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
transition: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
._IconButton_19x6h_1:active {
|
|
74
|
+
background: var(--re-accent-soft);
|
|
75
|
+
transition: none;
|
|
76
|
+
}
|
|
77
|
+
._IconButton-title_19x6h_39 {
|
|
78
|
+
clip: rect(0 0 0 0);
|
|
79
|
+
clip-path: inset(100%);
|
|
80
|
+
height: 1px;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
position: absolute;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
width: 1px;
|
|
85
|
+
}
|
|
86
|
+
._IconButton--disabled_19x6h_26 {
|
|
87
|
+
color: var(--re-text-tertiary);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
|
|
91
|
+
@keyframes _loader-animation_nacdm_1 {
|
|
92
|
+
0% {
|
|
93
|
+
transform: rotate(0deg) scale(1);
|
|
94
|
+
}
|
|
95
|
+
50% {
|
|
96
|
+
transform: rotate(180deg) scale(0.8);
|
|
97
|
+
}
|
|
98
|
+
100% {
|
|
99
|
+
transform: rotate(360deg) scale(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
._Loader_nacdm_13 {
|
|
103
|
+
background: transparent;
|
|
104
|
+
border-radius: 100%;
|
|
105
|
+
border: 2px solid currentColor;
|
|
106
|
+
border-bottom-color: transparent;
|
|
107
|
+
display: inline-block;
|
|
108
|
+
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
|
109
|
+
animation-fill-mode: both;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
|
113
|
+
._ActionBar_5kf61_1 {
|
|
114
|
+
align-items: center;
|
|
115
|
+
cursor: default;
|
|
116
|
+
display: flex;
|
|
117
|
+
width: auto;
|
|
118
|
+
padding: 4px;
|
|
119
|
+
padding-inline-start: 0;
|
|
120
|
+
padding-inline-end: 0;
|
|
121
|
+
border-top-left-radius: var(--re-radius-lg);
|
|
122
|
+
border-top-right-radius: var(--re-radius-lg);
|
|
123
|
+
border-radius: var(--re-radius-lg);
|
|
124
|
+
background: var(--re-primary);
|
|
125
|
+
color: var(--re-primary-foreground);
|
|
126
|
+
font-family: var(--re-font-family);
|
|
127
|
+
min-height: 26px;
|
|
128
|
+
box-shadow: var(--re-shadow-md);
|
|
129
|
+
}
|
|
130
|
+
._ActionBar-label_5kf61_19 {
|
|
131
|
+
color: var(--re-primary-foreground);
|
|
132
|
+
opacity: 0.85;
|
|
133
|
+
font-size: var(--re-font-size-xxxs);
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
padding-inline-start: 8px;
|
|
136
|
+
padding-inline-end: 8px;
|
|
137
|
+
margin-inline-start: 4px;
|
|
138
|
+
margin-inline-end: 4px;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
}
|
|
142
|
+
._ActionBarAction_5kf61_32 + ._ActionBar-label_5kf61_19 {
|
|
143
|
+
padding-inline-start: 0;
|
|
144
|
+
}
|
|
145
|
+
._ActionBar-label_5kf61_19 + ._ActionBarAction_5kf61_32 {
|
|
146
|
+
margin-inline-start: -4px;
|
|
147
|
+
}
|
|
148
|
+
._ActionBar-group_5kf61_40 {
|
|
149
|
+
align-items: center;
|
|
150
|
+
border-inline-start: 0.5px solid rgba(255, 255, 255, 0.2);
|
|
151
|
+
display: flex;
|
|
152
|
+
height: 100%;
|
|
153
|
+
padding-inline-start: 4px;
|
|
154
|
+
padding-inline-end: 4px;
|
|
155
|
+
}
|
|
156
|
+
._ActionBar-group_5kf61_40:first-of-type {
|
|
157
|
+
border-inline-start: 0;
|
|
158
|
+
}
|
|
159
|
+
._ActionBar-group_5kf61_40:empty {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
._ActionBarAction_5kf61_32 {
|
|
163
|
+
background: transparent;
|
|
164
|
+
border: none;
|
|
165
|
+
color: var(--re-primary-foreground);
|
|
166
|
+
opacity: 0.85;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
padding: 6px;
|
|
169
|
+
margin-inline-start: 4px;
|
|
170
|
+
margin-inline-end: 4px;
|
|
171
|
+
border-radius: var(--re-radius-sm);
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
justify-content: center;
|
|
176
|
+
transition: opacity var(--re-motion-fast) var(--re-ease), background-color var(--re-motion-fast) var(--re-ease);
|
|
177
|
+
}
|
|
178
|
+
._ActionBarAction--disabled_5kf61_75 {
|
|
179
|
+
cursor: auto;
|
|
180
|
+
opacity: 0.4;
|
|
181
|
+
}
|
|
182
|
+
._ActionBarAction_5kf61_32 svg {
|
|
183
|
+
max-width: none !important;
|
|
184
|
+
}
|
|
185
|
+
._ActionBarAction_5kf61_32:focus-visible {
|
|
186
|
+
outline: none;
|
|
187
|
+
box-shadow: var(--re-ring);
|
|
188
|
+
}
|
|
189
|
+
@media (hover: hover) and (pointer: fine) {
|
|
190
|
+
._ActionBarAction_5kf61_32:hover:not(._ActionBarAction--disabled_5kf61_75) {
|
|
191
|
+
opacity: 1;
|
|
192
|
+
background: rgba(255, 255, 255, 0.12);
|
|
193
|
+
transition: none;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
._ActionBarAction_5kf61_32:active:not(._ActionBarAction--disabled_5kf61_75),
|
|
197
|
+
._ActionBarAction--active_5kf61_98 {
|
|
198
|
+
opacity: 1;
|
|
199
|
+
background: rgba(255, 255, 255, 0.18);
|
|
200
|
+
transition: none;
|
|
201
|
+
}
|
|
202
|
+
._ActionBar-group_5kf61_40 * {
|
|
203
|
+
margin: 0;
|
|
204
|
+
}
|
|
205
|
+
._ActionBar-separator_5kf61_108 {
|
|
206
|
+
background: rgba(255, 255, 255, 0.2);
|
|
207
|
+
margin-inline: 4px;
|
|
208
|
+
width: 0.5px;
|
|
209
|
+
height: 100%;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/RichTextMenu/components/Control/styles.module.css/#css-module-data */
|
|
213
|
+
._Control_1aveu_1 .lucide {
|
|
214
|
+
height: 18px;
|
|
215
|
+
width: 18px;
|
|
216
|
+
}
|
|
217
|
+
._Control--inline_1aveu_6 .lucide {
|
|
218
|
+
height: 16px;
|
|
219
|
+
width: 16px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
|
|
223
|
+
._Select_6nen1_1 {
|
|
224
|
+
position: relative;
|
|
225
|
+
z-index: 1;
|
|
226
|
+
}
|
|
227
|
+
._Select-button_6nen1_6 {
|
|
228
|
+
align-items: center;
|
|
229
|
+
background: transparent;
|
|
230
|
+
border: none;
|
|
231
|
+
border-radius: var(--re-radius-sm);
|
|
232
|
+
display: flex;
|
|
233
|
+
justify-content: center;
|
|
234
|
+
gap: 0px;
|
|
235
|
+
height: 100%;
|
|
236
|
+
padding: 4px;
|
|
237
|
+
padding-right: 2px;
|
|
238
|
+
transition: background-color var(--re-motion-fast) var(--re-ease), color var(--re-motion-fast) var(--re-ease);
|
|
239
|
+
}
|
|
240
|
+
._Select--hasOptions_6nen1_21 ._Select-button_6nen1_6 {
|
|
241
|
+
color: currentColor;
|
|
242
|
+
}
|
|
243
|
+
._Select--hasOptions_6nen1_21:not(._Select--disabled_6nen1_25) ._Select-button_6nen1_6 {
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
}
|
|
246
|
+
._Select-buttonIcon_6nen1_29 {
|
|
247
|
+
align-items: center;
|
|
248
|
+
display: flex;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
}
|
|
251
|
+
._Select--standalone_6nen1_35 ._Select-buttonIcon_6nen1_29 .lucide {
|
|
252
|
+
height: 18px;
|
|
253
|
+
width: 18px;
|
|
254
|
+
}
|
|
255
|
+
._Select--actionBar_6nen1_40 ._Select-buttonIcon_6nen1_29 .lucide {
|
|
256
|
+
height: 16px;
|
|
257
|
+
width: 16px;
|
|
258
|
+
}
|
|
259
|
+
._Select--hasOptions_6nen1_21:not(._Select--disabled_6nen1_25) ._Select-button_6nen1_6:hover,
|
|
260
|
+
._Select--hasValue_6nen1_46 ._Select-button_6nen1_6 {
|
|
261
|
+
background: var(--re-surface-hover);
|
|
262
|
+
color: var(--re-text-accent);
|
|
263
|
+
}
|
|
264
|
+
._Select--disabled_6nen1_25 ._Select-button_6nen1_6 {
|
|
265
|
+
color: var(--re-text-tertiary);
|
|
266
|
+
}
|
|
267
|
+
._Select--actionBar_6nen1_40 {
|
|
268
|
+
&._Select--hasOptions_6nen1_21 ._Select-button_6nen1_6:hover,
|
|
269
|
+
&._Select--hasValue_6nen1_46 ._Select-button_6nen1_6 {
|
|
270
|
+
background: rgba(255, 255, 255, 0.12);
|
|
271
|
+
color: var(--re-text-inverse);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
._Select-items_6nen1_63 {
|
|
275
|
+
background: var(--re-surface-panel);
|
|
276
|
+
border: 1px solid var(--re-border-subtle);
|
|
277
|
+
border-radius: var(--re-radius-lg);
|
|
278
|
+
box-shadow: var(--re-shadow-lg);
|
|
279
|
+
margin: 10px 8px;
|
|
280
|
+
margin-left: 0;
|
|
281
|
+
padding: 4px;
|
|
282
|
+
z-index: 2;
|
|
283
|
+
list-style: none;
|
|
284
|
+
}
|
|
285
|
+
._SelectItem_6nen1_75 {
|
|
286
|
+
background: transparent;
|
|
287
|
+
border-radius: var(--re-radius-sm);
|
|
288
|
+
border: none;
|
|
289
|
+
color: var(--re-text-secondary);
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
display: flex;
|
|
292
|
+
gap: 8px;
|
|
293
|
+
align-items: center;
|
|
294
|
+
font-size: var(--re-font-size-xxs);
|
|
295
|
+
margin: 0;
|
|
296
|
+
padding: 8px 12px;
|
|
297
|
+
width: 100%;
|
|
298
|
+
transition: background-color var(--re-motion-fast) var(--re-ease), color var(--re-motion-fast) var(--re-ease);
|
|
299
|
+
}
|
|
300
|
+
._SelectItem--isSelected_6nen1_92 {
|
|
301
|
+
background: var(--re-accent-soft);
|
|
302
|
+
color: var(--re-text-accent);
|
|
303
|
+
font-weight: 500;
|
|
304
|
+
}
|
|
305
|
+
._SelectItem--isSelected_6nen1_92 ._SelectItem-icon_6nen1_98 {
|
|
306
|
+
color: var(--re-text-accent);
|
|
307
|
+
}
|
|
308
|
+
._SelectItem_6nen1_75:hover {
|
|
309
|
+
background: var(--re-surface-hover);
|
|
310
|
+
color: var(--re-text-accent);
|
|
311
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoadedRichTextMenuInner
|
|
3
|
+
} from "./chunk-V2OPYD42.mjs";
|
|
4
|
+
import "./chunk-6B2Q5R3C.mjs";
|
|
5
|
+
import "./chunk-DXGQXXQG.mjs";
|
|
6
|
+
import "./chunk-GUMYXUO3.mjs";
|
|
7
|
+
import "./chunk-SURZYH7D.mjs";
|
|
8
|
+
import "./chunk-VUEM62JF.mjs";
|
|
9
|
+
import "./chunk-VOLQMQPK.mjs";
|
|
10
|
+
import "./chunk-Y2EFNT5P.mjs";
|
|
11
|
+
import "./chunk-GAUBBDIR.mjs";
|
|
12
|
+
import {
|
|
13
|
+
__spreadValues,
|
|
14
|
+
init_react_import
|
|
15
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
16
|
+
|
|
17
|
+
// components/RichTextMenu/full.tsx
|
|
18
|
+
init_react_import();
|
|
19
|
+
import { useEditorState } from "@tiptap/react";
|
|
20
|
+
import { useMemo } from "react";
|
|
21
|
+
|
|
22
|
+
// components/RichTextEditor/selector.ts
|
|
23
|
+
init_react_import();
|
|
24
|
+
var defaultEditorState = (ctx, readOnly) => {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
26
|
+
const editor = ctx.editor;
|
|
27
|
+
if (!editor) return {};
|
|
28
|
+
const canChain = () => editor.can().chain();
|
|
29
|
+
return {
|
|
30
|
+
isAlignLeft: editor.isActive({ textAlign: "left" }),
|
|
31
|
+
canAlignLeft: !readOnly && ((_b = (_a = canChain()).setTextAlign) == null ? void 0 : _b.call(_a, "left").run()),
|
|
32
|
+
isAlignCenter: editor.isActive({ textAlign: "center" }),
|
|
33
|
+
canAlignCenter: !readOnly && ((_d = (_c = canChain()).setTextAlign) == null ? void 0 : _d.call(_c, "center").run()),
|
|
34
|
+
isAlignRight: editor.isActive({ textAlign: "right" }),
|
|
35
|
+
canAlignRight: !readOnly && ((_f = (_e = canChain()).setTextAlign) == null ? void 0 : _f.call(_e, "right").run()),
|
|
36
|
+
isAlignJustify: editor.isActive({ textAlign: "justify" }),
|
|
37
|
+
canAlignJustify: !readOnly && ((_h = (_g = canChain()).setTextAlign) == null ? void 0 : _h.call(_g, "justify").run()),
|
|
38
|
+
isBold: editor.isActive("bold"),
|
|
39
|
+
canBold: !readOnly && ((_j = (_i = canChain()).toggleBold) == null ? void 0 : _j.call(_i).run()),
|
|
40
|
+
isItalic: editor.isActive("italic"),
|
|
41
|
+
canItalic: !readOnly && ((_l = (_k = canChain()).toggleItalic) == null ? void 0 : _l.call(_k).run()),
|
|
42
|
+
isUnderline: editor.isActive("underline"),
|
|
43
|
+
canUnderline: !readOnly && ((_n = (_m = canChain()).toggleUnderline) == null ? void 0 : _n.call(_m).run()),
|
|
44
|
+
isStrike: editor.isActive("strike"),
|
|
45
|
+
canStrike: !readOnly && ((_p = (_o = canChain()).toggleStrike) == null ? void 0 : _p.call(_o).run()),
|
|
46
|
+
isInlineCode: editor.isActive("code"),
|
|
47
|
+
canInlineCode: !readOnly && ((_r = (_q = canChain()).toggleCode) == null ? void 0 : _r.call(_q).run()),
|
|
48
|
+
isBulletList: editor.isActive("bulletList"),
|
|
49
|
+
canBulletList: !readOnly && ((_t = (_s = canChain()).toggleBulletList) == null ? void 0 : _t.call(_s).run()),
|
|
50
|
+
isOrderedList: editor.isActive("orderedList"),
|
|
51
|
+
canOrderedList: !readOnly && ((_v = (_u = canChain()).toggleOrderedList) == null ? void 0 : _v.call(_u).run()),
|
|
52
|
+
isCodeBlock: editor.isActive("codeBlock"),
|
|
53
|
+
canCodeBlock: !readOnly && ((_x = (_w = canChain()).toggleCodeBlock) == null ? void 0 : _x.call(_w).run()),
|
|
54
|
+
isBlockquote: editor.isActive("blockquote"),
|
|
55
|
+
canBlockquote: !readOnly && ((_z = (_y = canChain()).toggleBlockquote) == null ? void 0 : _z.call(_y).run()),
|
|
56
|
+
canHorizontalRule: !readOnly && ((_B = (_A = canChain()).setHorizontalRule) == null ? void 0 : _B.call(_A).run())
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// components/RichTextMenu/full.tsx
|
|
61
|
+
import { jsx } from "react/jsx-runtime";
|
|
62
|
+
var LoadedRichTextMenuFull = ({
|
|
63
|
+
editor,
|
|
64
|
+
field,
|
|
65
|
+
readOnly,
|
|
66
|
+
inline
|
|
67
|
+
}) => {
|
|
68
|
+
const { tiptap = {} } = field;
|
|
69
|
+
const { selector } = tiptap;
|
|
70
|
+
const resolvedSelector = useMemo(() => {
|
|
71
|
+
return (ctx) => __spreadValues(__spreadValues({}, defaultEditorState(ctx, readOnly)), selector ? selector(ctx, readOnly) : {});
|
|
72
|
+
}, [selector, readOnly]);
|
|
73
|
+
const editorState = useEditorState({
|
|
74
|
+
editor,
|
|
75
|
+
selector: resolvedSelector
|
|
76
|
+
});
|
|
77
|
+
if (!editor || !editorState) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
LoadedRichTextMenuInner,
|
|
82
|
+
{
|
|
83
|
+
editor,
|
|
84
|
+
editorState,
|
|
85
|
+
field,
|
|
86
|
+
readOnly,
|
|
87
|
+
inline
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
LoadedRichTextMenuFull
|
|
93
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BCDhqbeL.js';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
|
|
4
|
+
type HistorySlice<D = any> = {
|
|
5
|
+
index: number;
|
|
6
|
+
hasPast: () => boolean;
|
|
7
|
+
hasFuture: () => boolean;
|
|
8
|
+
histories: History<D>[];
|
|
9
|
+
record: (data: D) => void;
|
|
10
|
+
back: VoidFunction;
|
|
11
|
+
forward: VoidFunction;
|
|
12
|
+
currentHistory: () => History;
|
|
13
|
+
nextHistory: () => History<D> | null;
|
|
14
|
+
prevHistory: () => History<D> | null;
|
|
15
|
+
setHistories: (histories: History[]) => void;
|
|
16
|
+
setHistoryIndex: (index: number) => void;
|
|
17
|
+
initialAppState: D;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type NodeHandle = {
|
|
21
|
+
sync: () => void;
|
|
22
|
+
hideOverlay: () => void;
|
|
23
|
+
showOverlay: () => void;
|
|
24
|
+
};
|
|
25
|
+
type NodesSlice = {
|
|
26
|
+
registerNode: (id: string, handle: NodeHandle) => void;
|
|
27
|
+
unregisterNode: (id: string) => void;
|
|
28
|
+
syncNode: (id?: string | null) => void;
|
|
29
|
+
syncNodes: (ids: Array<string | null | undefined>) => void;
|
|
30
|
+
setOverlayVisible: (id: string | null | undefined, visible: boolean) => void;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
34
|
+
item?: G["UserComponentData"] | null;
|
|
35
|
+
type?: keyof G["UserProps"];
|
|
36
|
+
root?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
39
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
40
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
41
|
+
type Cache = Record<string, {
|
|
42
|
+
lastPermissions: Partial<Permissions>;
|
|
43
|
+
lastData: ComponentData | null;
|
|
44
|
+
lastParentId: string | null;
|
|
45
|
+
}>;
|
|
46
|
+
type PermissionsSlice = {
|
|
47
|
+
cache: Cache;
|
|
48
|
+
globalPermissions: Permissions;
|
|
49
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
50
|
+
getPermissions: GetPermissions<Config>;
|
|
51
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
52
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
56
|
+
type FieldsSlice = {
|
|
57
|
+
fields: Fields | Partial<Fields>;
|
|
58
|
+
loading: boolean;
|
|
59
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
60
|
+
id: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
64
|
+
type ZoomConfig = {
|
|
65
|
+
autoZoom: number;
|
|
66
|
+
rootHeight: number;
|
|
67
|
+
zoom: number;
|
|
68
|
+
};
|
|
69
|
+
type ComponentState = Record<string, {
|
|
70
|
+
loadingCount: number;
|
|
71
|
+
}>;
|
|
72
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
73
|
+
instanceId: string;
|
|
74
|
+
state: G["UserAppState"];
|
|
75
|
+
dispatch: (action: EditorAction) => void;
|
|
76
|
+
config: UserConfig;
|
|
77
|
+
componentState: ComponentState;
|
|
78
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
79
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
80
|
+
unsetComponentLoading: (id: string) => void;
|
|
81
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
82
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
83
|
+
node: T;
|
|
84
|
+
didChange: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
resolveAndCommitData: () => void;
|
|
87
|
+
plugins: Plugin[];
|
|
88
|
+
overrides: Partial<Overrides>;
|
|
89
|
+
viewports: Viewports;
|
|
90
|
+
zoomConfig: ZoomConfig;
|
|
91
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
92
|
+
status: Status;
|
|
93
|
+
setStatus: (status: Status) => void;
|
|
94
|
+
iframe: IframeConfig;
|
|
95
|
+
fullScreenCanvas: boolean;
|
|
96
|
+
_experimentalVirtualization: boolean;
|
|
97
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
98
|
+
getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
|
|
99
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
100
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
101
|
+
onAction?: (action: EditorAction, newState: AppState, state: AppState) => void;
|
|
102
|
+
metadata: Metadata;
|
|
103
|
+
fields: FieldsSlice;
|
|
104
|
+
history: HistorySlice;
|
|
105
|
+
nodes: NodesSlice;
|
|
106
|
+
permissions: PermissionsSlice;
|
|
107
|
+
fieldTransforms: FieldTransforms;
|
|
108
|
+
currentRichText?: {
|
|
109
|
+
inlineComponentId?: string;
|
|
110
|
+
inline: boolean;
|
|
111
|
+
field: RichtextField;
|
|
112
|
+
editor: Editor;
|
|
113
|
+
id: string;
|
|
114
|
+
} | null;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BCDhqbeL.mjs';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
|
|
4
|
+
type HistorySlice<D = any> = {
|
|
5
|
+
index: number;
|
|
6
|
+
hasPast: () => boolean;
|
|
7
|
+
hasFuture: () => boolean;
|
|
8
|
+
histories: History<D>[];
|
|
9
|
+
record: (data: D) => void;
|
|
10
|
+
back: VoidFunction;
|
|
11
|
+
forward: VoidFunction;
|
|
12
|
+
currentHistory: () => History;
|
|
13
|
+
nextHistory: () => History<D> | null;
|
|
14
|
+
prevHistory: () => History<D> | null;
|
|
15
|
+
setHistories: (histories: History[]) => void;
|
|
16
|
+
setHistoryIndex: (index: number) => void;
|
|
17
|
+
initialAppState: D;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type NodeHandle = {
|
|
21
|
+
sync: () => void;
|
|
22
|
+
hideOverlay: () => void;
|
|
23
|
+
showOverlay: () => void;
|
|
24
|
+
};
|
|
25
|
+
type NodesSlice = {
|
|
26
|
+
registerNode: (id: string, handle: NodeHandle) => void;
|
|
27
|
+
unregisterNode: (id: string) => void;
|
|
28
|
+
syncNode: (id?: string | null) => void;
|
|
29
|
+
syncNodes: (ids: Array<string | null | undefined>) => void;
|
|
30
|
+
setOverlayVisible: (id: string | null | undefined, visible: boolean) => void;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
34
|
+
item?: G["UserComponentData"] | null;
|
|
35
|
+
type?: keyof G["UserProps"];
|
|
36
|
+
root?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
39
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
40
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
41
|
+
type Cache = Record<string, {
|
|
42
|
+
lastPermissions: Partial<Permissions>;
|
|
43
|
+
lastData: ComponentData | null;
|
|
44
|
+
lastParentId: string | null;
|
|
45
|
+
}>;
|
|
46
|
+
type PermissionsSlice = {
|
|
47
|
+
cache: Cache;
|
|
48
|
+
globalPermissions: Permissions;
|
|
49
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
50
|
+
getPermissions: GetPermissions<Config>;
|
|
51
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
52
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
56
|
+
type FieldsSlice = {
|
|
57
|
+
fields: Fields | Partial<Fields>;
|
|
58
|
+
loading: boolean;
|
|
59
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
60
|
+
id: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
64
|
+
type ZoomConfig = {
|
|
65
|
+
autoZoom: number;
|
|
66
|
+
rootHeight: number;
|
|
67
|
+
zoom: number;
|
|
68
|
+
};
|
|
69
|
+
type ComponentState = Record<string, {
|
|
70
|
+
loadingCount: number;
|
|
71
|
+
}>;
|
|
72
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
73
|
+
instanceId: string;
|
|
74
|
+
state: G["UserAppState"];
|
|
75
|
+
dispatch: (action: EditorAction) => void;
|
|
76
|
+
config: UserConfig;
|
|
77
|
+
componentState: ComponentState;
|
|
78
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
79
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
80
|
+
unsetComponentLoading: (id: string) => void;
|
|
81
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
82
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
83
|
+
node: T;
|
|
84
|
+
didChange: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
resolveAndCommitData: () => void;
|
|
87
|
+
plugins: Plugin[];
|
|
88
|
+
overrides: Partial<Overrides>;
|
|
89
|
+
viewports: Viewports;
|
|
90
|
+
zoomConfig: ZoomConfig;
|
|
91
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
92
|
+
status: Status;
|
|
93
|
+
setStatus: (status: Status) => void;
|
|
94
|
+
iframe: IframeConfig;
|
|
95
|
+
fullScreenCanvas: boolean;
|
|
96
|
+
_experimentalVirtualization: boolean;
|
|
97
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
98
|
+
getCurrentData: () => G["UserData"]["content"][0] | G["UserData"]["root"];
|
|
99
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
100
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
101
|
+
onAction?: (action: EditorAction, newState: AppState, state: AppState) => void;
|
|
102
|
+
metadata: Metadata;
|
|
103
|
+
fields: FieldsSlice;
|
|
104
|
+
history: HistorySlice;
|
|
105
|
+
nodes: NodesSlice;
|
|
106
|
+
permissions: PermissionsSlice;
|
|
107
|
+
fieldTransforms: FieldTransforms;
|
|
108
|
+
currentRichText?: {
|
|
109
|
+
inlineComponentId?: string;
|
|
110
|
+
inline: boolean;
|
|
111
|
+
field: RichtextField;
|
|
112
|
+
editor: Editor;
|
|
113
|
+
id: string;
|
|
114
|
+
} | null;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|