@alpaca-editor/core 1.0.3992 → 1.0.3993

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 (103) hide show
  1. package/dist/config/config.js +0 -12
  2. package/dist/config/config.js.map +1 -1
  3. package/dist/config/types.d.ts +6 -3
  4. package/dist/editor/ContentTree.d.ts +2 -1
  5. package/dist/editor/ContentTree.js +2 -2
  6. package/dist/editor/ContentTree.js.map +1 -1
  7. package/dist/editor/ItemInfo.js +1 -1
  8. package/dist/editor/ItemInfo.js.map +1 -1
  9. package/dist/editor/field-types/InternalLinkFieldEditor.js +20 -25
  10. package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -1
  11. package/dist/editor/field-types/RichTextEditor.d.ts +2 -2
  12. package/dist/editor/field-types/RichTextEditor.js +15 -2
  13. package/dist/editor/field-types/RichTextEditor.js.map +1 -1
  14. package/dist/editor/field-types/RichTextEditorComponent.d.ts +5 -5
  15. package/dist/editor/field-types/RichTextEditorComponent.js +40 -51
  16. package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
  17. package/dist/editor/field-types/TreeListEditor.js +7 -5
  18. package/dist/editor/field-types/TreeListEditor.js.map +1 -1
  19. package/dist/editor/field-types/richtext/components/EditorDropdown.d.ts +11 -0
  20. package/dist/editor/field-types/richtext/components/EditorDropdown.js +96 -0
  21. package/dist/editor/field-types/richtext/components/EditorDropdown.js.map +1 -0
  22. package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +5 -0
  23. package/dist/editor/field-types/richtext/components/ReactSlate.js +558 -0
  24. package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -0
  25. package/dist/editor/field-types/richtext/components/ToolbarButton.d.ts +3 -0
  26. package/dist/editor/field-types/richtext/components/ToolbarButton.js +13 -0
  27. package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -0
  28. package/dist/editor/field-types/richtext/config/pluginFactory.d.ts +17 -0
  29. package/dist/editor/field-types/richtext/config/pluginFactory.js +14 -0
  30. package/dist/editor/field-types/richtext/config/pluginFactory.js.map +1 -0
  31. package/dist/editor/field-types/richtext/hooks/useProfileCache.d.ts +68 -0
  32. package/dist/editor/field-types/richtext/hooks/useProfileCache.js +208 -0
  33. package/dist/editor/field-types/richtext/hooks/useProfileCache.js.map +1 -0
  34. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.d.ts +25 -0
  35. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js +64 -0
  36. package/dist/editor/field-types/richtext/hooks/useRichTextProfile.js.map +1 -0
  37. package/dist/editor/field-types/richtext/index.d.ts +5 -0
  38. package/dist/editor/field-types/richtext/index.js +6 -0
  39. package/dist/editor/field-types/richtext/index.js.map +1 -0
  40. package/dist/editor/field-types/richtext/types.d.ts +139 -0
  41. package/dist/editor/field-types/richtext/types.js +107 -0
  42. package/dist/editor/field-types/richtext/types.js.map +1 -0
  43. package/dist/editor/field-types/richtext/utils/conversion.d.ts +5 -0
  44. package/dist/editor/field-types/richtext/utils/conversion.js +539 -0
  45. package/dist/editor/field-types/richtext/utils/conversion.js.map +1 -0
  46. package/dist/editor/field-types/richtext/utils/plugins.d.ts +97 -0
  47. package/dist/editor/field-types/richtext/utils/plugins.js +272 -0
  48. package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -0
  49. package/dist/editor/field-types/richtext/utils/profileMapper.d.ts +38 -0
  50. package/dist/editor/field-types/richtext/utils/profileMapper.js +366 -0
  51. package/dist/editor/field-types/richtext/utils/profileMapper.js.map +1 -0
  52. package/dist/editor/field-types/richtext/utils/profileServiceCache.d.ts +37 -0
  53. package/dist/editor/field-types/richtext/utils/profileServiceCache.js +117 -0
  54. package/dist/editor/field-types/richtext/utils/profileServiceCache.js.map +1 -0
  55. package/dist/editor/services/contentService.d.ts +8 -0
  56. package/dist/editor/services/contentService.js +3 -0
  57. package/dist/editor/services/contentService.js.map +1 -1
  58. package/dist/editor/sidebar/ComponentTree.js +7 -1
  59. package/dist/editor/sidebar/ComponentTree.js.map +1 -1
  60. package/dist/editor/ui/PerfectTree.d.ts +4 -2
  61. package/dist/editor/ui/PerfectTree.js +16 -7
  62. package/dist/editor/ui/PerfectTree.js.map +1 -1
  63. package/dist/editor/utils/itemutils.js +3 -1
  64. package/dist/editor/utils/itemutils.js.map +1 -1
  65. package/dist/editor/views/ItemEditor.js +10 -3
  66. package/dist/editor/views/ItemEditor.js.map +1 -1
  67. package/dist/page-wizard/steps/ContentStep.js +1 -3
  68. package/dist/page-wizard/steps/ContentStep.js.map +1 -1
  69. package/dist/page-wizard/steps/usePageCreator.js +1 -1
  70. package/dist/page-wizard/steps/usePageCreator.js.map +1 -1
  71. package/dist/revision.d.ts +2 -2
  72. package/dist/revision.js +2 -2
  73. package/dist/styles.css +9 -0
  74. package/package.json +4 -1
  75. package/src/config/config.tsx +0 -12
  76. package/src/config/types.ts +6 -3
  77. package/src/editor/ContentTree.tsx +3 -0
  78. package/src/editor/ItemInfo.tsx +2 -2
  79. package/src/editor/field-types/InternalLinkFieldEditor.tsx +73 -69
  80. package/src/editor/field-types/RichTextEditor.tsx +31 -3
  81. package/src/editor/field-types/RichTextEditorComponent.tsx +52 -69
  82. package/src/editor/field-types/TreeListEditor.tsx +7 -7
  83. package/src/editor/field-types/richtext/components/EditorDropdown.tsx +180 -0
  84. package/src/editor/field-types/richtext/components/ReactSlate.css +163 -0
  85. package/src/editor/field-types/richtext/components/ReactSlate.tsx +792 -0
  86. package/src/editor/field-types/richtext/components/ToolbarButton.tsx +23 -0
  87. package/src/editor/field-types/richtext/config/pluginFactory.tsx +22 -0
  88. package/src/editor/field-types/richtext/hooks/useProfileCache.ts +270 -0
  89. package/src/editor/field-types/richtext/hooks/useRichTextProfile.ts +94 -0
  90. package/src/editor/field-types/richtext/index.ts +5 -0
  91. package/src/editor/field-types/richtext/types.ts +269 -0
  92. package/src/editor/field-types/richtext/utils/conversion.ts +589 -0
  93. package/src/editor/field-types/richtext/utils/plugins.ts +346 -0
  94. package/src/editor/field-types/richtext/utils/profileMapper.ts +424 -0
  95. package/src/editor/field-types/richtext/utils/profileServiceCache.ts +154 -0
  96. package/src/editor/services/contentService.ts +12 -0
  97. package/src/editor/sidebar/ComponentTree.tsx +12 -1
  98. package/src/editor/ui/PerfectTree.tsx +19 -6
  99. package/src/editor/utils/{itemutils.ts → itemutils.tsx} +12 -12
  100. package/src/editor/views/ItemEditor.tsx +22 -1
  101. package/src/page-wizard/steps/ContentStep.tsx +1 -3
  102. package/src/page-wizard/steps/usePageCreator.ts +1 -0
  103. package/src/revision.ts +2 -2
@@ -0,0 +1,558 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React, { useCallback, useMemo, useState, forwardRef, useRef } from 'react';
3
+ import { createEditor, Editor, Element, Transforms } from 'slate';
4
+ import { Slate, Editable, withReact, ReactEditor } from 'slate-react';
5
+ import { withHistory } from 'slate-history';
6
+ import isEqual from 'lodash/isEqual';
7
+ import './ReactSlate.css';
8
+ import { SLATE_MARKS, SLATE_BLOCKS, SLATE_ALIGNMENTS } from '../types';
9
+ import EditorDropdown from './EditorDropdown';
10
+ import { ToolbarButton } from './ToolbarButton';
11
+ import { LinkEditorDialog } from '../../../LinkEditorDialog';
12
+ import { htmlToSlate, slateToHtml } from '../utils/conversion';
13
+ import { createPluginsFromConfig } from '../config/pluginFactory';
14
+ import { useCachedSimplifiedProfile } from '../hooks/useProfileCache';
15
+ import { classNames } from 'primereact/utils';
16
+ // Helper function to normalize HTML for comparison
17
+ const normalizeHtmlForComparison = (html) => {
18
+ if (!html)
19
+ return '';
20
+ // Create a temporary DOM element to normalize the HTML
21
+ const temp = document.createElement('div');
22
+ temp.innerHTML = html;
23
+ // Remove extra whitespace and normalize structure
24
+ const normalizedHtml = temp.innerHTML
25
+ .replace(/\s+/g, ' ') // Replace multiple spaces with single space
26
+ .replace(/>\s+</g, '><') // Remove spaces between tags
27
+ .trim();
28
+ // Handle common empty content patterns
29
+ if (normalizedHtml === '<p><br></p>' || normalizedHtml === '<br>' || normalizedHtml === '<p></p>') {
30
+ return '';
31
+ }
32
+ return normalizedHtml;
33
+ };
34
+ // Helper function to check if HTML conversion is stable
35
+ const isHtmlConversionStable = (originalHtml, slateValue, profile) => {
36
+ try {
37
+ // Convert Slate back to HTML
38
+ const convertedHtml = slateToHtml(slateValue, profile);
39
+ // Normalize both HTML strings for comparison
40
+ const normalizedOriginal = normalizeHtmlForComparison(originalHtml);
41
+ const normalizedConverted = normalizeHtmlForComparison(convertedHtml);
42
+ // Debug logging (can be enabled for troubleshooting)
43
+ // console.log('HTML Stability Check:', {
44
+ // original: normalizedOriginal,
45
+ // converted: normalizedConverted,
46
+ // stable: normalizedOriginal === normalizedConverted
47
+ // });
48
+ // Check if they're equivalent
49
+ return normalizedOriginal === normalizedConverted;
50
+ }
51
+ catch (error) {
52
+ console.warn('HTML conversion stability check failed:', error);
53
+ // If we can't check stability, assume it's not stable to be safe
54
+ return false;
55
+ }
56
+ };
57
+ export const ReactSlate = forwardRef((props, ref) => {
58
+ const { value = '', onChange, onFocus, onBlur, readOnly = false, placeholder = 'Enter some text...', profile } = props;
59
+ // Create the Slate editor with plugins
60
+ const editor = useMemo(() => {
61
+ // Start with base editor
62
+ let slateEditor = createEditor();
63
+ // Apply core plugins
64
+ slateEditor = withReact(slateEditor);
65
+ slateEditor = withHistory(slateEditor);
66
+ slateEditor = createPluginsFromConfig(slateEditor);
67
+ return slateEditor;
68
+ }, []);
69
+ const editorProfile = profile || {
70
+ toolbar: {
71
+ groups: []
72
+ }
73
+ };
74
+ // Convert to simplified profile for the conversion functions (with caching)
75
+ const simplifiedProfile = useCachedSimplifiedProfile(editorProfile);
76
+ // Store the original HTML value for comparison
77
+ const originalValueRef = useRef(value);
78
+ const isInitialLoadRef = useRef(true);
79
+ // Update original value when prop value changes
80
+ useMemo(() => {
81
+ if (value !== originalValueRef.current) {
82
+ originalValueRef.current = value;
83
+ isInitialLoadRef.current = true;
84
+ }
85
+ }, [value]);
86
+ // Convert the HTML value to Slate format
87
+ const [internalValue, setInternalValue] = useState(htmlToSlate(value, simplifiedProfile));
88
+ // Update internal value when prop value changes
89
+ useMemo(() => {
90
+ const newValue = htmlToSlate(value, simplifiedProfile);
91
+ if (!isEqual(newValue, internalValue)) {
92
+ setInternalValue(newValue);
93
+ }
94
+ }, [value, simplifiedProfile]);
95
+ // Handle value changes with round-trip validation
96
+ const handleChange = useCallback((newValue) => {
97
+ setInternalValue(newValue);
98
+ if (onChange) {
99
+ const html = slateToHtml(newValue, simplifiedProfile);
100
+ // Check if this is the initial load or if the conversion is stable
101
+ if (isInitialLoadRef.current) {
102
+ // On initial load, check if the HTML conversion is stable
103
+ const isStable = isHtmlConversionStable(originalValueRef.current, newValue, simplifiedProfile);
104
+ if (isStable) {
105
+ // If stable, don't trigger onChange on initial load
106
+ isInitialLoadRef.current = false;
107
+ return;
108
+ }
109
+ // If not stable, we still need to proceed, but mark as no longer initial load
110
+ isInitialLoadRef.current = false;
111
+ }
112
+ // For subsequent changes, only trigger onChange if there's a meaningful difference
113
+ const normalizedNewHtml = normalizeHtmlForComparison(html);
114
+ const normalizedOriginalHtml = normalizeHtmlForComparison(originalValueRef.current);
115
+ if (normalizedNewHtml !== normalizedOriginalHtml) {
116
+ // Update the original value reference to the new HTML
117
+ originalValueRef.current = html;
118
+ onChange(html);
119
+ }
120
+ }
121
+ }, [onChange, simplifiedProfile]);
122
+ const getOption = (type, id) => {
123
+ switch (type) {
124
+ case 'mark':
125
+ const markConfig = SLATE_MARKS[id];
126
+ return markConfig ? {
127
+ id,
128
+ label: markConfig.label,
129
+ icon: markConfig.icon,
130
+ isActive: (editor) => editor.isMarkActive(id),
131
+ toggle: (editor, event) => {
132
+ event.preventDefault();
133
+ editor.toggleMark(id);
134
+ }
135
+ } : undefined;
136
+ case 'block':
137
+ const blockConfig = SLATE_BLOCKS[id];
138
+ return blockConfig ? {
139
+ id,
140
+ label: blockConfig.label,
141
+ icon: blockConfig.icon,
142
+ isActive: (editor) => editor.isBlockActive(id),
143
+ toggle: (editor, event) => {
144
+ event.preventDefault();
145
+ editor.toggleBlock(id);
146
+ }
147
+ } : undefined;
148
+ case 'alignment':
149
+ const alignConfig = SLATE_ALIGNMENTS[id];
150
+ return alignConfig ? {
151
+ id,
152
+ label: alignConfig.label,
153
+ icon: alignConfig.icon,
154
+ isActive: (editor) => editor.isAlignActive(alignConfig.value),
155
+ toggle: (editor, event) => {
156
+ event.preventDefault();
157
+ editor.toggleAlign(alignConfig.value);
158
+ }
159
+ } : undefined;
160
+ case 'link':
161
+ return {
162
+ id: 'link',
163
+ label: 'Link',
164
+ icon: '🔗',
165
+ isActive: (editor) => editor.isLinkActive(),
166
+ toggle: (editor, event) => {
167
+ event.preventDefault();
168
+ handleLinkButtonClick();
169
+ }
170
+ };
171
+ case 'list':
172
+ return {
173
+ id,
174
+ label: id === 'unordered-list' ? 'Bulleted List' : 'Numbered List',
175
+ icon: id === 'unordered-list' ? '•' : '1.',
176
+ isActive: (editor) => editor.isListActive(id === 'unordered-list' ? 'unordered' : 'ordered'),
177
+ toggle: (editor, event) => {
178
+ event.preventDefault();
179
+ editor.toggleList(id === 'unordered-list' ? 'unordered' : 'ordered');
180
+ }
181
+ };
182
+ case 'divider':
183
+ return { id: 'divider', label: 'Divider' };
184
+ default:
185
+ return undefined;
186
+ }
187
+ };
188
+ const optionHandlers = {
189
+ mark: {
190
+ isActive: (id) => editor.isMarkActive(id),
191
+ toggle: (id) => editor.toggleMark(id)
192
+ },
193
+ block: {
194
+ isActive: (id) => editor.isBlockActive(id),
195
+ toggle: (id) => editor.toggleBlock(id)
196
+ },
197
+ alignment: {
198
+ isActive: (id) => {
199
+ const alignConfig = SLATE_ALIGNMENTS[id];
200
+ return alignConfig ? editor.isAlignActive(alignConfig.value) : false;
201
+ },
202
+ toggle: (id) => {
203
+ const alignConfig = SLATE_ALIGNMENTS[id];
204
+ if (alignConfig) {
205
+ editor.toggleAlign(alignConfig.value);
206
+ }
207
+ }
208
+ },
209
+ link: {
210
+ isActive: () => editor.isLinkActive(),
211
+ toggle: () => handleLinkButtonClick()
212
+ },
213
+ list: {
214
+ isActive: (id) => {
215
+ const listType = id === 'unordered-list' ? 'unordered' : 'ordered';
216
+ return editor.isListActive(listType);
217
+ },
218
+ toggle: (id, event) => {
219
+ const listType = id === 'unordered-list' ? 'unordered' : 'ordered';
220
+ editor.toggleList(listType);
221
+ }
222
+ }
223
+ };
224
+ const isOptionActive = (type, id) => {
225
+ const handler = optionHandlers[type];
226
+ return handler ? handler.isActive(id) : false;
227
+ };
228
+ const handleOptionSelect = (type, id) => (event) => {
229
+ event.preventDefault();
230
+ const handler = optionHandlers[type];
231
+ if (handler) {
232
+ return handler.toggle(id, event);
233
+ }
234
+ console.warn(`Unhandled option type: ${type}`);
235
+ };
236
+ const createDropdownOptions = (options) => {
237
+ return options
238
+ .map(option => {
239
+ const optionObj = getOption(option.type, option.id);
240
+ if (!optionObj)
241
+ return null;
242
+ return {
243
+ value: optionObj,
244
+ label: optionObj.label || option.id,
245
+ icon: optionObj.icon,
246
+ style: optionObj.style,
247
+ isActive: (editor) => isOptionActive(option.type, option.id),
248
+ onSelect: (editor, event) => handleOptionSelect(option.type, option.id)(event)
249
+ };
250
+ })
251
+ .filter(Boolean);
252
+ };
253
+ // Helper function to split options by dividers into sub-groups
254
+ const splitOptionsByDividers = (options) => {
255
+ const subGroups = [];
256
+ let currentGroup = [];
257
+ options.forEach(option => {
258
+ if (option.type === 'divider') {
259
+ if (currentGroup.length > 0) {
260
+ subGroups.push(currentGroup);
261
+ currentGroup = [];
262
+ }
263
+ }
264
+ else {
265
+ currentGroup.push(option);
266
+ }
267
+ });
268
+ // Add the last group if it has options
269
+ if (currentGroup.length > 0) {
270
+ subGroups.push(currentGroup);
271
+ }
272
+ return subGroups;
273
+ };
274
+ const renderToolbarGroup = (group, index) => {
275
+ const validOptions = group.options.filter(option => getOption(option.type, option.id) || option.type === 'divider');
276
+ if (validOptions.length === 0)
277
+ return null;
278
+ const groupStyle = {
279
+ display: 'flex',
280
+ alignItems: 'center',
281
+ gap: '8px',
282
+ flexWrap: 'wrap'
283
+ };
284
+ return (_jsx("div", { style: groupStyle, children: group.display === 'buttons' ? ((() => {
285
+ const subGroups = splitOptionsByDividers(validOptions);
286
+ return subGroups.map((subGroup, subGroupIndex) => (_jsx("div", { className: "toolbar-button-group", children: subGroup.map((option, optionIndex) => {
287
+ const optionObj = getOption(option.type, option.id);
288
+ if (!optionObj)
289
+ return null;
290
+ return (_jsx(ToolbarButton, { icon: optionObj.icon, active: isOptionActive(option.type, option.id), onMouseDown: handleOptionSelect(option.type, option.id) }, `${option.type}-${option.id}`));
291
+ }) }, `subgroup-${subGroupIndex}`)));
292
+ })()) : ((() => {
293
+ const dropdownOptions = createDropdownOptions(validOptions);
294
+ const blockOptions = validOptions.filter(option => option.type === 'block');
295
+ // If there's only one block option, render it as a disabled-style button
296
+ if (blockOptions.length === 1) {
297
+ const singleOption = dropdownOptions.find(opt => blockOptions.some(blockOpt => blockOpt.type === 'block' &&
298
+ getOption(blockOpt.type, blockOpt.id) === opt.value));
299
+ return (_jsx("div", { className: "toolbar-dropdown-container", children: _jsx("button", { className: "toolbar-dropdown-button", disabled: true, children: group.label ? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "toolbar-dropdown-content", children: [group.label, ": ", singleOption?.label] }), _jsx("span", { className: "toolbar-dropdown-arrow", children: "\u25BC" })] })) : group.showIconsOnly ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "toolbar-dropdown-icon", children: singleOption?.icon }), _jsx("span", { className: "toolbar-dropdown-arrow", children: "\u25BC" })] })) : (_jsxs(_Fragment, { children: [_jsxs("span", { className: "toolbar-dropdown-icon", children: [singleOption?.icon && (_jsx("span", { className: "toolbar-dropdown-icon", children: singleOption.icon })), _jsx("span", { className: "toolbar-dropdown-content", children: singleOption?.label })] }), _jsx("span", { className: "toolbar-dropdown-arrow", children: "\u25BC" })] })) }) }));
300
+ }
301
+ // Multiple options - render normally wrapped in grey container
302
+ const isActive = dropdownOptions.some(option => option.isActive(editor));
303
+ return (_jsx("div", { className: "toolbar-dropdown-container", children: _jsx(EditorDropdown, { options: dropdownOptions, editor: editor, label: group.label, showIconsOnly: group.showIconsOnly, buttonStyle: {
304
+ padding: '5px 10px',
305
+ margin: '0',
306
+ background: isActive ? '#ffffff' : 'transparent',
307
+ border: 'none',
308
+ borderRadius: '3px',
309
+ cursor: 'pointer',
310
+ boxShadow: isActive ? '0 1px 2px rgba(0,0,0,0.1)' : 'none'
311
+ } }) }));
312
+ })()) }, `group-${group.id || index}`));
313
+ };
314
+ const [showLinkDialog, setShowLinkDialog] = useState(false);
315
+ const [selectedLink, setSelectedLink] = useState(null);
316
+ const [linkDialogCallback, setLinkDialogCallback] = useState(null);
317
+ const editLink = useCallback((element) => {
318
+ const linkType = element.link?.type || 'external';
319
+ let linkData;
320
+ if (linkType === 'internal') {
321
+ linkData = {
322
+ type: 'internal',
323
+ itemId: element.link?.itemId || element.link?.targetItemLongId?.split("/").pop() || '',
324
+ targetItemLongId: element.link?.targetItemLongId || '',
325
+ target: element.link?.target || '',
326
+ queryString: element.link?.queryString || ''
327
+ };
328
+ }
329
+ else {
330
+ linkData = {
331
+ type: 'external',
332
+ url: element.url || element.link?.url || '',
333
+ target: element.link?.target || '_blank',
334
+ queryString: element.link?.queryString || ''
335
+ };
336
+ }
337
+ setSelectedLink(linkData);
338
+ setShowLinkDialog(true);
339
+ }, []);
340
+ const handleLinkUpdate = useCallback((link) => {
341
+ if (linkDialogCallback) {
342
+ linkDialogCallback(link);
343
+ setLinkDialogCallback(null);
344
+ }
345
+ else {
346
+ const [linkNode] = Editor.nodes(editor, {
347
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'link'
348
+ });
349
+ if (linkNode) {
350
+ const [node, path] = linkNode;
351
+ let newProperties;
352
+ if (link.type === 'internal') {
353
+ newProperties = {
354
+ url: '',
355
+ link: {
356
+ type: 'internal',
357
+ targetItemLongId: link.targetItemLongId,
358
+ itemId: link.itemId,
359
+ target: link.target,
360
+ queryString: link.queryString
361
+ }
362
+ };
363
+ }
364
+ else {
365
+ newProperties = {
366
+ url: link.url,
367
+ link: {
368
+ type: 'external',
369
+ url: link.url,
370
+ target: link.target,
371
+ queryString: link.queryString
372
+ }
373
+ };
374
+ }
375
+ Transforms.setNodes(editor, newProperties, { at: path });
376
+ // Move cursor after the link
377
+ const after = Editor.after(editor, path);
378
+ if (after) {
379
+ Transforms.select(editor, after);
380
+ }
381
+ ReactEditor.focus(editor);
382
+ }
383
+ }
384
+ setShowLinkDialog(false);
385
+ setSelectedLink(null);
386
+ }, [editor, linkDialogCallback]);
387
+ const handleLinkButtonClick = useCallback(() => {
388
+ editor.insertLink({
389
+ onOpenLinkDialog: (callback) => {
390
+ setSelectedLink({
391
+ type: 'external',
392
+ url: '',
393
+ target: '_blank'
394
+ });
395
+ setShowLinkDialog(true);
396
+ setLinkDialogCallback(() => callback);
397
+ }
398
+ });
399
+ }, [editor]);
400
+ const handleKeyDown = useCallback((event) => {
401
+ if (event.key === 'Enter' && event.shiftKey) {
402
+ // Handle Shift+Enter for line breaks in all block types
403
+ event.preventDefault();
404
+ if (editor.selection) {
405
+ // Insert literal <br> text
406
+ editor.insertText('<br>');
407
+ }
408
+ }
409
+ else if (event.key === 'Tab') {
410
+ event.preventDefault();
411
+ // Check if we're in a list item more explicitly
412
+ if (editor.selection) {
413
+ // Try to find the closest list item ancestor using Editor.above
414
+ const listItem = Editor.above(editor, {
415
+ at: editor.selection,
416
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'list-item'
417
+ });
418
+ if (listItem) {
419
+ if (event.shiftKey) {
420
+ // Shift+Tab: Outdent
421
+ editor.outdentList();
422
+ }
423
+ else {
424
+ // Tab: Indent
425
+ editor.indentList();
426
+ }
427
+ }
428
+ }
429
+ }
430
+ else if (event.key === 'Backspace' || event.key === 'Delete') {
431
+ // Handle empty list items
432
+ if (editor.selection) {
433
+ const listItem = Editor.above(editor, {
434
+ at: editor.selection,
435
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'list-item'
436
+ });
437
+ if (listItem) {
438
+ const selectedText = Editor.string(editor, editor.selection);
439
+ const [node, path] = listItem;
440
+ const nodeText = Editor.string(editor, path);
441
+ // If the list item is empty or only contains whitespace, convert to paragraph
442
+ if (!nodeText.trim() || (selectedText === nodeText && nodeText.trim())) {
443
+ event.preventDefault();
444
+ Transforms.setNodes(editor, { type: 'paragraph', listType: undefined, indent: undefined }, {
445
+ match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === 'list-item',
446
+ split: true
447
+ });
448
+ }
449
+ }
450
+ }
451
+ }
452
+ }, [editor]);
453
+ return (_jsxs("div", { className: `slate-editor ${props.className}`, children: [_jsxs(Slate, { editor: editor, initialValue: internalValue, onChange: handleChange, children: [!readOnly && (_jsx("div", { className: "toolbar", children: (() => {
454
+ // Group toolbar items by row
455
+ const groupsByRow = editorProfile.toolbar.groups.reduce((acc, group, index) => {
456
+ const row = group.row !== undefined ? group.row : index;
457
+ if (!acc[row])
458
+ acc[row] = [];
459
+ acc[row].push(group);
460
+ return acc;
461
+ }, {});
462
+ // Render each row
463
+ return Object.entries(groupsByRow)
464
+ .sort(([a], [b]) => parseInt(a) - parseInt(b))
465
+ .map(([rowIndex, rowGroups]) => (_jsx("div", { className: "toolbar-row", children: rowGroups.map(group => renderToolbarGroup(group, parseInt(rowIndex))) }, `row-${rowIndex}`)));
466
+ })() })), _jsx(Editable, { className: classNames(readOnly ? "bg-gray-4" : "bg-gray-5", "focus-shadow"), readOnly: readOnly, placeholder: placeholder, onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown, renderElement: ({ attributes, children, element }) => {
467
+ const style = {
468
+ textAlign: element.align || 'left',
469
+ };
470
+ if (element.type === 'link') {
471
+ const isInternal = element.link?.type === 'internal';
472
+ const url = isInternal ? '#' : (element.url || element.link?.url || '#');
473
+ return (_jsx("a", { ...attributes, href: url, style: style, className: `slate-link ${isInternal ? 'internal-link' : 'external-link'}`, onClick: (e) => {
474
+ if (!readOnly) {
475
+ e.preventDefault();
476
+ editLink(element);
477
+ }
478
+ }, children: children }));
479
+ }
480
+ if (element.type === 'list-item') {
481
+ const indent = element.indent || 0;
482
+ const listType = element.listType || 'unordered';
483
+ const isOrdered = listType === 'ordered';
484
+ // Calculate proper numbering for ordered lists
485
+ let listNumber = 1;
486
+ if (isOrdered) {
487
+ // Find the position of this item within its level
488
+ const allElements = editor.children;
489
+ const currentIndex = allElements.findIndex(el => el === element);
490
+ // Count preceding list items at the same indent level and list type
491
+ let count = 0;
492
+ for (let i = 0; i < currentIndex; i++) {
493
+ const prevElement = allElements[i];
494
+ if (prevElement &&
495
+ prevElement.type === 'list-item' &&
496
+ prevElement.listType === 'ordered' &&
497
+ (prevElement.indent || 0) === indent) {
498
+ count++;
499
+ }
500
+ else if (prevElement &&
501
+ prevElement.type === 'list-item' &&
502
+ (prevElement.indent || 0) < indent) {
503
+ // Reset count when we encounter a parent-level item
504
+ count = 0;
505
+ }
506
+ }
507
+ listNumber = count + 1;
508
+ }
509
+ const listStyle = {
510
+ ...style,
511
+ position: 'relative',
512
+ listStyleType: 'none',
513
+ };
514
+ const bulletContent = isOrdered ? `${listNumber}.` : '';
515
+ return (_jsxs("div", { ...attributes, style: listStyle, className: `slate-list-item slate-list-${listType}`, "data-indent": indent, children: [_jsx("span", { className: "slate-list-bullet", children: bulletContent }), _jsx("div", { className: "slate-list-content", children: children })] }));
516
+ }
517
+ // Handle different block types using built-in SLATE_BLOCKS configuration
518
+ const blockConfig = SLATE_BLOCKS[element.type];
519
+ if (blockConfig && element.type === 'no-tag') {
520
+ // Special handling for no-tag blocks (plain text without wrapper)
521
+ return _jsx("span", { ...attributes, style: style, children: children });
522
+ }
523
+ // For standard blocks, use the appropriate HTML tag
524
+ if (blockConfig) {
525
+ const tagName = blockConfig.htmlTag;
526
+ return React.createElement(tagName, { ...attributes, style }, children);
527
+ }
528
+ // Default fallback to paragraph
529
+ return _jsx("p", { ...attributes, style: style, children: children });
530
+ }, renderLeaf: ({ attributes, children, leaf }) => {
531
+ let el = _jsx("span", { ...attributes, children: children });
532
+ // Apply marks using the built-in SLATE_MARKS configuration
533
+ simplifiedProfile.marks.forEach(markId => {
534
+ if (leaf[markId]) {
535
+ const markConfig = SLATE_MARKS[markId];
536
+ if (markConfig) {
537
+ if (markId === 'extrabold') {
538
+ // Special handling for extrabold with CSS class
539
+ el = (_jsx("span", { className: "extrabold", children: el }));
540
+ }
541
+ else {
542
+ // Standard HTML tag rendering
543
+ const tagName = markConfig.htmlTag;
544
+ el = React.createElement(tagName, {}, el);
545
+ }
546
+ }
547
+ }
548
+ });
549
+ return el;
550
+ } })] }), showLinkDialog && selectedLink && (_jsx(LinkEditorDialog, { linkValue: selectedLink, onOk: handleLinkUpdate, onCancel: () => {
551
+ setShowLinkDialog(false);
552
+ setSelectedLink(null);
553
+ setLinkDialogCallback(null);
554
+ } }))] }));
555
+ });
556
+ ReactSlate.displayName = 'ReactSlate';
557
+ export default ReactSlate;
558
+ //# sourceMappingURL=ReactSlate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactSlate.js","sourceRoot":"","sources":["../../../../../src/editor/field-types/richtext/components/ReactSlate.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,YAAY,EAAc,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAQL,WAAW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AAC;wCAC5C,CAAC;oCACH,CAAC;gCACH,CAAC;4BACH,CAAC,CAAC,CAAC;4BAEH,OAAO,EAAE,CAAC;wBACZ,CAAC,GACD,IACI,EAEP,cAAc,IAAI,YAAY,IAAI,CACjC,KAAC,gBAAgB,IACf,SAAS,EAAE,YAAY,EACvB,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,GAAG,EAAE;oBACb,iBAAiB,CAAC,KAAK,CAAC,CAAC;oBACzB,eAAe,CAAC,IAAI,CAAC,CAAC;oBACtB,qBAAqB,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC,GACD,CACH,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ToolbarButtonProps } from '../types';
3
+ export declare const ToolbarButton: React.FC<ToolbarButtonProps>;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const ToolbarButton = ({ icon, active, onMouseDown }) => {
3
+ return (_jsx("button", { className: `toolbar-button ${active ? 'active' : ''}`, onMouseDown: onMouseDown, style: {
4
+ padding: '5px 10px',
5
+ margin: '0 2px',
6
+ background: active ? '#ffffff' : 'transparent',
7
+ border: 'none',
8
+ borderRadius: '3px',
9
+ cursor: 'pointer',
10
+ boxShadow: active ? '0 1px 2px rgba(0,0,0,0.1)' : 'none'
11
+ }, children: icon }));
12
+ };
13
+ //# sourceMappingURL=ToolbarButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarButton.js","sourceRoot":"","sources":["../../../../../src/editor/field-types/richtext/components/ToolbarButton.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE;IAC3F,OAAO,CACL,iBACE,SAAS,EAAE,kBAAkB,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EACrD,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE;YACL,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;YAC9C,MAAM,EAAE,MAAM;YACd,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,MAAM;SACzD,YAEA,IAAI,GACE,CACV,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Editor } from 'slate';
2
+ export declare const createPluginsFromConfig: (editor: Editor) => import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor & {
3
+ isMarkActive(format: string): boolean;
4
+ toggleMark(format: string): void;
5
+ isBlockActive(format: string): boolean;
6
+ toggleBlock(format: string): void;
7
+ isAlignActive(align: string): boolean;
8
+ toggleAlign(align: string): void;
9
+ isLinkActive(): boolean;
10
+ insertLink(options?: {
11
+ onOpenLinkDialog?: (callback: (link: any) => void) => void;
12
+ }): void;
13
+ isListActive(listType?: "unordered" | "ordered"): boolean;
14
+ toggleList(listType: "unordered" | "ordered"): void;
15
+ indentList(): void;
16
+ outdentList(): void;
17
+ };