@pega/cosmos-react-rte 10.0.0-build.1.4 → 10.0.0-build.1.6
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/lib/components/Editor/Editor.context.d.ts +1 -1
- package/lib/components/Editor/Editor.context.d.ts.map +1 -1
- package/lib/components/Editor/Editor.context.js.map +1 -1
- package/lib/components/Editor/Editor.d.ts.map +1 -1
- package/lib/components/Editor/Editor.js +31 -9
- package/lib/components/Editor/Editor.js.map +1 -1
- package/lib/components/Editor/Editor.types.d.ts +19 -0
- package/lib/components/Editor/Editor.types.d.ts.map +1 -1
- package/lib/components/Editor/Editor.types.js.map +1 -1
- package/lib/components/Editor/ImageEditDialog.d.ts +3 -1
- package/lib/components/Editor/ImageEditDialog.d.ts.map +1 -1
- package/lib/components/Editor/ImageEditDialog.js +108 -17
- package/lib/components/Editor/ImageEditDialog.js.map +1 -1
- package/lib/components/Editor/Toolbar/ImageButton.d.ts +3 -1
- package/lib/components/Editor/Toolbar/ImageButton.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/ImageButton.js +120 -21
- package/lib/components/Editor/Toolbar/ImageButton.js.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.d.ts +3 -2
- package/lib/components/Editor/Toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.js +2 -2
- package/lib/components/Editor/Toolbar/Toolbar.js.map +1 -1
- package/lib/components/Editor/hooks/useImageActions.d.ts.map +1 -1
- package/lib/components/Editor/hooks/useImageActions.js +10 -1
- package/lib/components/Editor/hooks/useImageActions.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
2
|
interface EditorContextValue {
|
|
3
|
-
addImage: (image: File, imageId?: string, alt?: string) => void;
|
|
3
|
+
addImage: (image: File, imageId?: string, alt?: string, actionUrl?: string) => void;
|
|
4
4
|
editor: Editor | null;
|
|
5
5
|
}
|
|
6
6
|
declare const EditorContext: import("react").Context<EditorContextValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.context.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Editor.context.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,aAAa,6CAGjB,CAAC;AAEH,eAAO,MAAM,gBAAgB,0BAE5B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.context.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQlD,MAAM,aAAa,GAAG,aAAa,CAAqB;IACtD,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { createContext, useContext } from 'react';\nimport type { Editor } from '@tiptap/core';\n\ninterface EditorContextValue {\n addImage: (image: File, imageId?: string, alt?: string) => void;\n editor: Editor | null;\n}\n\nconst EditorContext = createContext<EditorContextValue>({\n addImage: () => {},\n editor: null\n});\n\nexport const useEditorContext = () => {\n return useContext(EditorContext);\n};\n\nexport default EditorContext;\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.context.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAQlD,MAAM,aAAa,GAAG,aAAa,CAAqB;IACtD,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { createContext, useContext } from 'react';\nimport type { Editor } from '@tiptap/core';\n\ninterface EditorContextValue {\n addImage: (image: File, imageId?: string, alt?: string, actionUrl?: string) => void;\n editor: Editor | null;\n}\n\nconst EditorContext = createContext<EditorContextValue>({\n addImage: () => {},\n editor: null\n});\n\nexport const useEditorContext = () => {\n return useContext(EditorContext);\n};\n\nexport default EditorContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAM/E,OAAO,KAAK,EAAE,WAAW,EAAgC,MAAM,gBAAgB,CAAC;;;;AA+
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAM/E,OAAO,KAAK,EAAE,WAAW,EAAgC,MAAM,gBAAgB,CAAC;;;;AA+qBhF,wBAAqD"}
|
|
@@ -39,7 +39,7 @@ const SuggestionEditor = ({ defaultValue, onGetContent, onContentChange, renderE
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
42
|
-
const { testId, id, label, labelHidden, info, status, required, disabled, readOnly, onChange, onKeyDown, onFocus, onBlur, onImageAdded, onResolveSuggestion, onInit, onUnload, defaultValue, placeholder, children, additionalInfo, toolbar, customActions, customComponents = [], spellcheck = true, imageInsertionMode = 'all', initOptions, onRewriteClick, linkCustomSource, progress, autoFocus, height, autoResize = true, secure = false, preserveTableStyles = false, ...restProps } = props;
|
|
42
|
+
const { testId, id, label, labelHidden, info, status, required, disabled, readOnly, onChange, onKeyDown, onFocus, onBlur, onImageAdded, onResolveSuggestion, onInit, onUnload, defaultValue, placeholder, children, additionalInfo, toolbar, customActions, customComponents = [], spellcheck = true, imageInsertionMode = 'all', initOptions, onRewriteClick, linkCustomSource, imageCustomSource, progress, autoFocus, height, autoResize = true, secure = false, preserveTableStyles = false, ...restProps } = props;
|
|
43
43
|
const theme = useTheme();
|
|
44
44
|
const { styleSheetTarget } = useConfiguration();
|
|
45
45
|
const t = useI18n();
|
|
@@ -59,6 +59,7 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
59
59
|
const formFieldRef = useRef(null);
|
|
60
60
|
const pastedImages = useRef([]);
|
|
61
61
|
const iframeRef = useRef(null);
|
|
62
|
+
const pendingImageActionUrlsRef = useRef(new Map());
|
|
62
63
|
const testIds = useTestIds(testId, getEditorTestIds);
|
|
63
64
|
// Check if images feature is enabled
|
|
64
65
|
const imagesEnabled = toolbar?.includes('images') ?? false;
|
|
@@ -212,15 +213,20 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
212
213
|
};
|
|
213
214
|
// Handle image edit save
|
|
214
215
|
const handleImageEditSave = (attrs) => {
|
|
215
|
-
if (!tiptapEditor || !editingImageElementRef.current)
|
|
216
|
+
if (!tiptapEditor || !editingImageElementRef.current) {
|
|
217
|
+
editingImageElementRef.current = null;
|
|
216
218
|
return;
|
|
219
|
+
}
|
|
217
220
|
// Get exact position from DOM element to handle duplicate images correctly
|
|
218
221
|
const pos = tiptapEditor.view.posAtDOM(editingImageElementRef.current, 0);
|
|
222
|
+
let imageUpdated = false;
|
|
219
223
|
if (pos >= 0) {
|
|
220
224
|
const { state } = tiptapEditor;
|
|
221
225
|
const node = state.doc.nodeAt(pos);
|
|
222
|
-
if (!node || node.type.name !== 'image')
|
|
226
|
+
if (!node || node.type.name !== 'image') {
|
|
227
|
+
editingImageElementRef.current = null;
|
|
223
228
|
return;
|
|
229
|
+
}
|
|
224
230
|
const nodeEnd = pos + node.nodeSize;
|
|
225
231
|
const tr = state.tr;
|
|
226
232
|
// Update image attributes
|
|
@@ -241,9 +247,15 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
241
247
|
tr.addMark(pos, nodeEnd, linkMark);
|
|
242
248
|
}
|
|
243
249
|
tiptapEditor.view.dispatch(tr);
|
|
250
|
+
imageUpdated = true;
|
|
244
251
|
}
|
|
245
252
|
// Clear the ref after save
|
|
246
253
|
editingImageElementRef.current = null;
|
|
254
|
+
// Trigger blur callback to persist image changes to redux
|
|
255
|
+
// Without this, edited images won't be saved until user manually blurs the editor
|
|
256
|
+
if (imageUpdated && onBlur) {
|
|
257
|
+
onBlur();
|
|
258
|
+
}
|
|
247
259
|
};
|
|
248
260
|
// Update editor when props change
|
|
249
261
|
useAfterInitialEffect(() => {
|
|
@@ -289,14 +301,21 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
289
301
|
if (imageData.attachmentId) {
|
|
290
302
|
imgEl.setAttribute('data-attachment-id', imageData.attachmentId);
|
|
291
303
|
}
|
|
292
|
-
|
|
293
|
-
|
|
304
|
+
const anchorEl = iframeDoc.createElement('a');
|
|
305
|
+
const pendingActionUrl = pendingImageActionUrlsRef.current.get(imageId);
|
|
306
|
+
anchorEl.setAttribute('href', pendingActionUrl || imageData.src);
|
|
307
|
+
anchorEl.setAttribute('target', '_blank');
|
|
308
|
+
anchorEl.setAttribute('rel', 'noopener noreferrer');
|
|
309
|
+
anchorEl.appendChild(imgEl);
|
|
310
|
+
// Replace pega-file with linked img in the DOM
|
|
311
|
+
imageUploadEl.replaceWith(anchorEl);
|
|
294
312
|
// Also update the Tiptap document
|
|
295
313
|
const html = tiptapEditor.getHTML();
|
|
296
|
-
const updatedHtml = html.replace(new RegExp(`<pega-file[^>]*data-id=["']${imageId}["'][^>]*>.*?</pega-file>`, 'g'),
|
|
314
|
+
const updatedHtml = html.replace(new RegExp(`<pega-file[^>]*data-id=["']${imageId}["'][^>]*>.*?</pega-file>`, 'g'), anchorEl.outerHTML);
|
|
297
315
|
if (updatedHtml !== html) {
|
|
298
316
|
tiptapEditor.commands.setContent(updatedHtml, { emitUpdate: false });
|
|
299
317
|
}
|
|
318
|
+
pendingImageActionUrlsRef.current.delete(imageId);
|
|
300
319
|
}
|
|
301
320
|
},
|
|
302
321
|
insertText: (text) => iframeEditorRef.current?.insertText(text),
|
|
@@ -307,10 +326,13 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
307
326
|
}), [tiptapEditor]);
|
|
308
327
|
const ctx = useMemo(() => ({
|
|
309
328
|
editor: tiptapEditor,
|
|
310
|
-
addImage: (image, imageId, alt) => {
|
|
329
|
+
addImage: (image, imageId, alt, actionUrl) => {
|
|
311
330
|
if (!tiptapEditor || !image)
|
|
312
331
|
return;
|
|
313
332
|
const imgId = imageId || `img-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
333
|
+
if (actionUrl) {
|
|
334
|
+
pendingImageActionUrlsRef.current.set(imgId, actionUrl);
|
|
335
|
+
}
|
|
314
336
|
// Create pega-file element to show upload progress
|
|
315
337
|
const pegaFileHtml = `<br/><pega-file data-id='${imgId}' data-progress='0' data-name='${image.name}' data-alt='${alt || image.name}' contenteditable='false'></pega-file><br/>`;
|
|
316
338
|
// Insert the pega-file element
|
|
@@ -320,7 +342,7 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
320
342
|
}
|
|
321
343
|
}), [tiptapEditor, onImageAdded]);
|
|
322
344
|
const renderSuggestionEditor = useCallback((suggestionProps) => (_jsx(SuggestionEditor, { defaultValue: suggestionProps.defaultValue, disabled: suggestionProps.disabled, readOnly: suggestionProps.readOnly, onGetContent: suggestionProps.onGetContent, onContentChange: suggestionProps.onContentChange, renderEditor: ({ ref: suggestionEditorRef, onInit: suggestionOnInit, onChange: suggestionOnChange }) => (_jsx(Editor, { ref: suggestionEditorRef, label: t('ai_rewrite_result_label'), labelHidden: true, toolbar: SUGGESTION_TOOLBAR, defaultValue: suggestionProps.defaultValue, disabled: suggestionProps.disabled, readOnly: suggestionProps.readOnly, height: height, onInit: suggestionOnInit, onChange: suggestionOnChange })) })), [height, t]);
|
|
323
|
-
return (_jsxs(EditorContext.Provider, { value: ctx, children: [_jsx(StyledEditorRoot, { testId: testIds, label: label, labelFor: '', labelId: labelId, labelHidden: labelHidden, id: editorId, info: info, status: status, required: required, disabled: disabled, readOnly: readOnly, onResolveSuggestion: onResolveSuggestion, ref: formFieldRef, additionalInfo: additionalInfo, children: _jsxs(_Fragment, { children: [_jsx(FormControl, { ...restProps, ref: editorRef, required: required, disabled: disabled, readOnly: readOnly, status: status, as: StyledRichTextEditor, focused: focused, hasSuggestion: status === 'pending', children: _jsxs(StyledEditorContainer, { ref: editorContainerRef, children: [progress ? (_jsx(Progress, { placement: 'local', message: typeof progress === 'string' ? progress : undefined })) : null, _jsx(StyledEditorIframe, { "data-testid": testIds.iframe, title: typeof label === 'string' ? label : t('rte_text_formatting_toolbar'), role: 'application', "aria-label": typeof label === 'string' ? label : t('rte_text_formatting_toolbar'), "aria-describedby": required ? requiredDescriptionId : undefined, ref: iframeRef, tabIndex: sourceMode ? -1 : 0, "$minHeight": height?.min, "$maxHeight": height?.max, "$hidden": sourceMode }), required ? (_jsx(HiddenText, { id: requiredDescriptionId, children: t('required') })) : null, sourceMode ? (_jsx(StyledSourceTextarea, { value: sourceCode, onChange: e => setSourceCode(e.target.value), spellCheck: false, "aria-label": t('rte_source_code'), "$minHeight": height?.min, "$maxHeight": height?.max })) : null, (toolbar?.length || customActions?.length) && tiptapEditor ? (_jsx(Toolbar, { testId: testIds, features: toolbar || [], editor: tiptapEditor, customActions: customActions, imageInsertionMode: imageInsertionMode, onRewriteClick: onRewriteClick, linkCustomSource: linkCustomSource, renderSuggestionEditor: renderSuggestionEditor, sourceMode: sourceMode, onSourceModeToggle: (isSourceMode) => {
|
|
345
|
+
return (_jsxs(EditorContext.Provider, { value: ctx, children: [_jsx(StyledEditorRoot, { testId: testIds, label: label, labelFor: '', labelId: labelId, labelHidden: labelHidden, id: editorId, info: info, status: status, required: required, disabled: disabled, readOnly: readOnly, onResolveSuggestion: onResolveSuggestion, ref: formFieldRef, additionalInfo: additionalInfo, children: _jsxs(_Fragment, { children: [_jsx(FormControl, { ...restProps, ref: editorRef, required: required, disabled: disabled, readOnly: readOnly, status: status, as: StyledRichTextEditor, focused: focused, hasSuggestion: status === 'pending', children: _jsxs(StyledEditorContainer, { ref: editorContainerRef, children: [progress ? (_jsx(Progress, { placement: 'local', message: typeof progress === 'string' ? progress : undefined })) : null, _jsx(StyledEditorIframe, { "data-testid": testIds.iframe, title: typeof label === 'string' ? label : t('rte_text_formatting_toolbar'), role: 'application', "aria-label": typeof label === 'string' ? label : t('rte_text_formatting_toolbar'), "aria-describedby": required ? requiredDescriptionId : undefined, ref: iframeRef, tabIndex: sourceMode ? -1 : 0, "$minHeight": height?.min, "$maxHeight": height?.max, "$hidden": sourceMode }), required ? (_jsx(HiddenText, { id: requiredDescriptionId, children: t('required') })) : null, sourceMode ? (_jsx(StyledSourceTextarea, { value: sourceCode, onChange: e => setSourceCode(e.target.value), spellCheck: false, "aria-label": t('rte_source_code'), "$minHeight": height?.min, "$maxHeight": height?.max })) : null, (toolbar?.length || customActions?.length) && tiptapEditor ? (_jsx(Toolbar, { testId: testIds, features: toolbar || [], editor: tiptapEditor, customActions: customActions, imageInsertionMode: imageInsertionMode, onRewriteClick: onRewriteClick, linkCustomSource: linkCustomSource, imageCustomSource: imageCustomSource, renderSuggestionEditor: renderSuggestionEditor, sourceMode: sourceMode, onSourceModeToggle: (isSourceMode) => {
|
|
324
346
|
if (isSourceMode) {
|
|
325
347
|
setSourceCode(tiptapEditor.getHTML());
|
|
326
348
|
}
|
|
@@ -339,7 +361,7 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
|
|
|
339
361
|
deleteTable: t('rte_delete_table')
|
|
340
362
|
} })) : null] }) }), toolbar?.includes('word-count') && tiptapEditor ? (_jsx(WordCount, { "data-testid": testIds.wordCount, editor: tiptapEditor })) : null] }) }), children, imageEditDialog.attributes && (_jsx(ImageEditDialog, { isOpen: imageEditDialog.isOpen, onClose: () => {
|
|
341
363
|
setImageEditDialog({ isOpen: false, attributes: null });
|
|
342
|
-
}, onSave: handleImageEditSave, initialAttributes: imageEditDialog.attributes, target: editButtonRef.current }))] }));
|
|
364
|
+
}, onSave: handleImageEditSave, initialAttributes: imageEditDialog.attributes, target: editButtonRef.current, imageCustomSource: imageCustomSource }))] }));
|
|
343
365
|
});
|
|
344
366
|
export default withTestIds(Editor, getEditorTestIds);
|
|
345
367
|
//# sourceMappingURL=Editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,mBAAmB,EACnB,OAAO,EACP,WAAW,EACZ,MAAM,OAAO,CAAC;AAEf,OAAO,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,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACpC,WAAW,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACnC,WAAW,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACnC,cAAc,EAAE,CAAC,CAAC,sBAAsB,CAAC;4CACzC,eAAe,EAAE,CAAC,CAAC,uBAAuB,CAAC;4CAC3C,SAAS,EAAE,CAAC,CAAC,gBAAgB,CAAC;4CAC9B,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACpC,WAAW,EAAE,CAAC,CAAC,kBAAkB,CAAC;yCACnC,GACD,CACH,CAAC,CAAC,CAAC,IAAI,IACc,GACZ,EACb,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CACjD,KAAC,SAAS,mBAAc,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAI,CACpE,CAAC,CAAC,CAAC,IAAI,IACP,GACc,EAClB,QAAQ,EACR,eAAe,CAAC,UAAU,IAAI,CAC7B,KAAC,eAAe,IACd,MAAM,EAAE,eAAe,CAAC,MAAM,EAC9B,OAAO,EAAE,GAAG,EAAE;oBACZ,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1D,CAAC,EACD,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,EAAE,eAAe,CAAC,UAAU,EAC7C,MAAM,EAAE,aAAa,CAAC,OAAO,GAC7B,CACH,IACsB,CAC1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Editor as TiptapEditor } from '@tiptap/core';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useImperativeHandle,\n useMemo,\n useCallback\n} from 'react';\nimport type { PropsWithoutRef, ReactNode, RefObject } from 'react';\nimport { css } from 'styled-components';\n\nimport {\n FormControl,\n Progress,\n HiddenText,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useConsolidatedRef,\n useTestIds,\n withTestIds,\n useConfiguration,\n useI18n\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport StyledRichTextEditor from '../RichTextEditor/RichTextEditor.styles';\nimport type { Features } from '../RichTextEditor/Toolbar/Toolbar.types';\n\nimport EditorContext from './Editor.context';\nimport type { EditorProps, EditorState, CustomComponent } from './Editor.types';\nimport {\n StyledEditorContainer,\n StyledEditorIframe,\n StyledEditorRoot,\n StyledSourceTextarea\n} from './Editor.styles';\nimport { getEditorTestIds } from './Editor.test-ids';\nimport Toolbar from './Toolbar/Toolbar';\nimport WordCount from './Toolbar/WordCount';\nimport { ImageEditDialog } from './ImageEditDialog';\nimport type { ImageAttributes } from './ImageEditDialog';\nimport ImageActionButtons from './ImageActionButtons';\nimport TableCellMenu from './TableCellMenu';\nimport createFileItemElement from './FileItemElement';\nimport useIframeSetup from './hooks/useIframeSetup';\nimport useImageActions from './hooks/useImageActions';\nimport useTableCellMenu from './hooks/useTableCellMenu';\nimport { dispatchEditorClickEvent } from './hooks/useCloseOnEditorClick';\nimport sanitizeHtml from './sanitize';\n\n// Suggestion editor has no toolbar — formatting controls are intentionally omitted\nconst SUGGESTION_TOOLBAR: Features[] = [];\n\ninterface SuggestionEditorRenderProps {\n ref: RefObject<EditorState>;\n onInit: (tiptapEditor: TiptapEditor) => void;\n onChange: (editor?: TiptapEditor) => void;\n}\n\ninterface SuggestionEditorProps {\n defaultValue?: string;\n disabled: boolean;\n readOnly: boolean;\n onGetContent: (getContent: () => string) => void;\n onContentChange: (hasContent: boolean) => void;\n /** Render prop — receives ref and callbacks; must render an Editor-like element */\n renderEditor: (renderProps: SuggestionEditorRenderProps) => ReactNode;\n}\n\nconst SuggestionEditor = ({\n defaultValue,\n onGetContent,\n onContentChange,\n renderEditor\n}: SuggestionEditorProps) => {\n const editorRef = useRef<EditorState>(null);\n\n useEffect(() => {\n onGetContent(() => editorRef.current?.getEditor()?.getHTML() ?? '');\n }, [onGetContent]);\n\n useAfterInitialEffect(() => {\n editorRef.current?.getEditor()?.commands.setContent(defaultValue ?? '');\n }, [defaultValue]);\n\n return renderEditor({\n ref: editorRef,\n onInit: tiptapEditor => {\n // Signal initial content state so submit button enables correctly\n onContentChange(tiptapEditor.getText().trim() !== '');\n },\n onChange: editor => {\n onContentChange((editor?.getText() ?? '').trim() !== '');\n }\n });\n};\n\nconst Editor: ForwardRefForwardPropsComponent<EditorProps> = forwardRef(function ForwardedEditor(\n props: PropsWithoutRef<EditorProps>,\n ref: EditorProps['ref']\n) {\n const {\n testId,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n disabled,\n readOnly,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n onImageAdded,\n onResolveSuggestion,\n onInit,\n onUnload,\n defaultValue,\n placeholder,\n children,\n additionalInfo,\n toolbar,\n customActions,\n customComponents = [],\n spellcheck = true,\n imageInsertionMode = 'all',\n initOptions,\n onRewriteClick,\n linkCustomSource,\n progress,\n autoFocus,\n height,\n autoResize = true,\n secure = false,\n preserveTableStyles = false,\n ...restProps\n } = props;\n\n const theme = useTheme();\n const { styleSheetTarget } = useConfiguration();\n const t = useI18n();\n const [focused, setFocused] = useState(false);\n const [tiptapEditor, setTiptapEditor] = useState<TiptapEditor | null>(null);\n const [imageEditDialog, setImageEditDialog] = useState<{\n isOpen: boolean;\n attributes: ImageAttributes | null;\n }>({ isOpen: false, attributes: null });\n const [sourceMode, setSourceMode] = useState(false);\n const [sourceCode, setSourceCode] = useState('');\n const editButtonRef = useRef<HTMLButtonElement>(null);\n const tableCellMenuButtonRef = useRef<HTMLButtonElement>(null);\n const editorContainerRef = useRef<HTMLDivElement>(null);\n const generatedId = useUID();\n const editorId = id ?? generatedId;\n const labelId = useUID();\n const requiredDescriptionId = `${editorId}-required`;\n const editorRef = useConsolidatedRef(ref);\n const formFieldRef = useRef<HTMLElement>(null);\n const pastedImages = useRef<File[]>([]);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n\n const testIds = useTestIds(testId, getEditorTestIds);\n\n // Check if images feature is enabled\n const imagesEnabled = toolbar?.includes('images') ?? false;\n\n // Check if tables feature is enabled\n const tablesEnabled = toolbar?.includes('tables') ?? false;\n\n // Check if links feature is enabled (controls autolink behavior)\n const linksEnabled = toolbar?.includes('links') ?? false;\n\n // Define built-in custom components and merge with user-provided ones\n const customElements: CustomComponent[] = useMemo(() => {\n const FileItemStyle = css`\n /* stylelint-disable-next-line selector-type-no-unknown */\n pega-file {\n display: inline-block;\n width: ${theme.base['content-width'].md};\n }\n `;\n\n return [\n {\n createCustomElement: createFileItemElement,\n name: 'pega-file',\n style: FileItemStyle.toString(),\n extensionAttributes: ['contenteditable']\n },\n ...customComponents\n ];\n }, [customComponents, theme]);\n\n // Register custom elements in the main window (needed for Tiptap to recognize them)\n useEffect(() => {\n customElements.forEach((component: CustomComponent) => {\n if (\n component.name &&\n component.createCustomElement &&\n !window.customElements.get(component.name)\n ) {\n const CustomElement = component.createCustomElement(window);\n window.customElements.define(component.name, CustomElement);\n }\n });\n }, [customElements]);\n\n // Sanitize defaultValue if secure mode is enabled\n const sanitizedDefaultValue = useMemo(\n () => (secure && defaultValue ? sanitizeHtml(defaultValue) : defaultValue),\n [secure, defaultValue]\n );\n\n // Mount Tiptap inside iframe using custom hook\n const { iframeEditorRef } = useIframeSetup({\n iframeRef,\n theme,\n styleSheetTarget,\n customElements,\n placeholder,\n defaultValue: sanitizedDefaultValue,\n disabled,\n readOnly,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n onInit,\n spellcheck,\n initOptions,\n onImageAdded,\n imagesEnabled,\n linksEnabled,\n imageInsertionMode,\n pastedImages,\n editorId,\n required,\n setTiptapEditor,\n setFocused,\n autoResize,\n secure,\n preserveTableStyles,\n onTabOut: () => {\n // Focus first toolbar button when Tab is pressed in editor\n const toolbarEl = editorContainerRef.current?.querySelector('[data-testid$=\"toolbar\"]');\n const firstButton = toolbarEl?.querySelector<HTMLElement>('button:not([disabled])');\n if (firstButton) {\n firstButton.focus();\n }\n },\n onFocusTableMenu: () => {\n tableCellMenuButtonRef.current?.focus();\n },\n onFocusPreviousCellMenu: () => {\n // Go to previous cell and then focus its menu\n if (tiptapEditor) {\n tiptapEditor.commands.goToPreviousCell();\n setTimeout(() => {\n tableCellMenuButtonRef.current?.focus();\n }, 0);\n }\n }\n });\n\n // Set up unload event listener to save content before iframe is destroyed\n useEffect(() => {\n if (!iframeRef.current?.contentWindow || !onUnload) return;\n\n const iframeWindow = iframeRef.current.contentWindow;\n const abortController = new AbortController();\n\n iframeWindow.addEventListener(\n 'unload',\n () => {\n const html = iframeEditorRef.current?.getHtml() ?? '';\n onUnload(html);\n },\n { signal: abortController.signal }\n );\n\n return () => {\n abortController.abort();\n };\n }, [onUnload]);\n\n // Dispatch event on iframe mousedown to close all open popovers/menus\n useEffect(() => {\n const iframeDoc = iframeRef.current?.contentDocument;\n if (!iframeDoc) return;\n\n const handleMouseDown = () => {\n dispatchEditorClickEvent();\n };\n\n iframeDoc.addEventListener('mousedown', handleMouseDown);\n return () => iframeDoc.removeEventListener('mousedown', handleMouseDown);\n }, [tiptapEditor]);\n\n // Set up image action buttons (edit and delete) using custom hook\n const {\n hoveredImagePosition,\n currentImageAttrs,\n currentImageElement,\n handleDelete: handleImageDelete,\n setIsOverButtons\n } = useImageActions({\n tiptapEditor,\n iframeRef,\n isDialogOpen: imageEditDialog.isOpen\n });\n\n // Set up table cell menu using custom hook (only when tables are active)\n const tableMenuEnabled = tablesEnabled && !readOnly && !disabled;\n const {\n cellPosition,\n setIsOverMenu: setIsOverTableMenu,\n addRowBelow,\n addRowAbove,\n addColumnAfter,\n addColumnBefore,\n deleteRow,\n deleteColumn,\n deleteTable\n } = useTableCellMenu({\n tiptapEditor: tableMenuEnabled ? tiptapEditor : null,\n iframeRef\n });\n\n // Handle keyboard navigation from table menu to next cell (start of content)\n const goToNextCell = useCallback(() => {\n if (tiptapEditor) {\n tiptapEditor.commands.focus();\n tiptapEditor.commands.goToNextCell();\n }\n }, [tiptapEditor]);\n\n // Handle keyboard navigation from table menu back to current cell\n const returnToCell = useCallback(() => {\n tiptapEditor?.commands.focus();\n }, [tiptapEditor]);\n\n // Store the image element when opening the dialog to target the correct node on save\n const editingImageElementRef = useRef<HTMLImageElement | null>(null);\n\n // Handle edit button click from ImageActionButtons\n const onEditButtonClick = () => {\n if (currentImageAttrs && currentImageElement) {\n // Store the element reference to target the correct node on save\n editingImageElementRef.current = currentImageElement;\n setImageEditDialog({\n isOpen: true,\n attributes: currentImageAttrs\n });\n // Don't call handleImageEdit() here - keep buttons visible while dialog is open\n }\n };\n\n // Handle image edit save\n const handleImageEditSave = (attrs: ImageAttributes) => {\n if (!tiptapEditor || !editingImageElementRef.current) return;\n\n // Get exact position from DOM element to handle duplicate images correctly\n const pos = tiptapEditor.view.posAtDOM(editingImageElementRef.current, 0);\n\n if (pos >= 0) {\n const { state } = tiptapEditor;\n const node = state.doc.nodeAt(pos);\n if (!node || node.type.name !== 'image') return;\n\n const nodeEnd = pos + node.nodeSize;\n const tr = state.tr;\n\n // Update image attributes\n tr.setNodeMarkup(pos, undefined, {\n src: attrs.src,\n alt: attrs.alt,\n ...(attrs.width && { width: attrs.width }),\n ...(attrs.height && { height: attrs.height })\n });\n\n // Handle action URL (links are marks in ProseMirror, not nodes)\n // Always remove existing link mark first, then add new one if needed\n tr.removeMark(pos, nodeEnd, state.schema.marks.link);\n if (attrs.actionUrl) {\n const linkMark = state.schema.marks.link.create({\n href: attrs.actionUrl,\n target: '_blank'\n });\n tr.addMark(pos, nodeEnd, linkMark);\n }\n\n tiptapEditor.view.dispatch(tr);\n }\n\n // Clear the ref after save\n editingImageElementRef.current = null;\n };\n\n // Update editor when props change\n useAfterInitialEffect(() => {\n iframeEditorRef.current?.setEditable(!readOnly && !disabled);\n }, [readOnly, disabled]);\n\n // Handle autoFocus\n useEffect(() => {\n if (autoFocus && tiptapEditor) {\n tiptapEditor.commands.focus();\n }\n }, [autoFocus, tiptapEditor]);\n\n // Expose methods via ref\n useImperativeHandle(\n editorRef,\n () => ({\n focus: () => iframeEditorRef.current?.focus(),\n getPlainText: () => iframeEditorRef.current?.getPlainText() ?? '',\n getRichText: () => iframeEditorRef.current?.getRichText() ?? '',\n getHtml: () => iframeEditorRef.current?.getHtml() ?? '',\n clear: () => iframeEditorRef.current?.clear(),\n updateAttachmentAttributes: (imageId: string, uploadProgress?: number, error?: string) => {\n if (!iframeRef.current?.contentDocument) return;\n\n const iframeDoc = iframeRef.current.contentDocument;\n const imageCustomEl = iframeDoc.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n\n if (imageCustomEl) {\n if (error) {\n imageCustomEl.setAttribute('data-error', error);\n } else if (uploadProgress !== undefined) {\n imageCustomEl.setAttribute('data-progress', `${uploadProgress}`);\n }\n }\n },\n appendImage: (\n imageData: { src: string; alt: string; attachmentId?: string },\n imageId: string\n ) => {\n if (!iframeRef.current?.contentDocument || !tiptapEditor) return;\n\n const iframeDoc = iframeRef.current.contentDocument;\n const imageUploadEl = iframeDoc.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n\n if (imageUploadEl) {\n // Create img element\n const imgEl = iframeDoc.createElement('img');\n imgEl.setAttribute('src', imageData.src);\n imgEl.setAttribute('alt', imageData.alt);\n if (imageData.attachmentId) {\n imgEl.setAttribute('data-attachment-id', imageData.attachmentId);\n }\n\n // Replace pega-file with img in the DOM\n imageUploadEl.replaceWith(imgEl);\n\n // Also update the Tiptap document\n const html = tiptapEditor.getHTML();\n const updatedHtml = html.replace(\n new RegExp(`<pega-file[^>]*data-id=[\"']${imageId}[\"'][^>]*>.*?</pega-file>`, 'g'),\n imgEl.outerHTML\n );\n\n if (updatedHtml !== html) {\n tiptapEditor.commands.setContent(updatedHtml, { emitUpdate: false });\n }\n }\n },\n insertText: (text: string) => iframeEditorRef.current?.insertText(text),\n setCursorLocationToStart: () => iframeEditorRef.current?.setCursorLocationToStart(),\n insertHtml: (html: string, overwrite?: boolean) =>\n iframeEditorRef.current?.insertHtml(html, overwrite),\n getEditor: () => iframeEditorRef.current?.getEditor() ?? null,\n element: formFieldRef.current || undefined\n }),\n [tiptapEditor]\n );\n\n const ctx = useMemo(\n () => ({\n editor: tiptapEditor,\n addImage: (image: File, imageId?: string, alt?: string) => {\n if (!tiptapEditor || !image) return;\n\n const imgId = imageId || `img-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;\n\n // Create pega-file element to show upload progress\n const pegaFileHtml = `<br/><pega-file data-id='${imgId}' data-progress='0' data-name='${image.name}' data-alt='${alt || image.name}' contenteditable='false'></pega-file><br/>`;\n\n // Insert the pega-file element\n tiptapEditor.chain().focus().insertContent(pegaFileHtml).run();\n\n // Trigger the onImageAdded callback so consumer can upload and call appendImage\n onImageAdded?.(image, imgId, alt);\n }\n }),\n [tiptapEditor, onImageAdded]\n );\n\n const renderSuggestionEditor = useCallback(\n (suggestionProps: {\n defaultValue?: string;\n disabled: boolean;\n readOnly: boolean;\n onGetContent: (getContent: () => string) => void;\n onContentChange: (hasContent: boolean) => void;\n }) => (\n <SuggestionEditor\n defaultValue={suggestionProps.defaultValue}\n disabled={suggestionProps.disabled}\n readOnly={suggestionProps.readOnly}\n onGetContent={suggestionProps.onGetContent}\n onContentChange={suggestionProps.onContentChange}\n renderEditor={({\n ref: suggestionEditorRef,\n onInit: suggestionOnInit,\n onChange: suggestionOnChange\n }) => (\n <Editor\n ref={suggestionEditorRef}\n label={t('ai_rewrite_result_label')}\n labelHidden\n toolbar={SUGGESTION_TOOLBAR}\n defaultValue={suggestionProps.defaultValue}\n disabled={suggestionProps.disabled}\n readOnly={suggestionProps.readOnly}\n height={height}\n onInit={suggestionOnInit}\n onChange={suggestionOnChange}\n />\n )}\n />\n ),\n [height, t]\n );\n\n return (\n <EditorContext.Provider value={ctx}>\n <StyledEditorRoot\n testId={testIds}\n label={label}\n labelFor=''\n labelId={labelId}\n labelHidden={labelHidden}\n id={editorId}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n onResolveSuggestion={onResolveSuggestion}\n ref={formFieldRef}\n additionalInfo={additionalInfo}\n >\n <>\n <FormControl\n {...restProps}\n ref={editorRef}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n as={StyledRichTextEditor}\n focused={focused}\n hasSuggestion={status === 'pending'}\n >\n <StyledEditorContainer ref={editorContainerRef}>\n {progress ? (\n <Progress\n placement='local'\n message={typeof progress === 'string' ? progress : undefined}\n />\n ) : null}\n {/* Title attribute is required for iframe accessibility (WCAG) */}\n <StyledEditorIframe\n data-testid={testIds.iframe}\n title={typeof label === 'string' ? label : t('rte_text_formatting_toolbar')}\n role='application'\n aria-label={typeof label === 'string' ? label : t('rte_text_formatting_toolbar')}\n aria-describedby={required ? requiredDescriptionId : undefined}\n ref={iframeRef}\n tabIndex={sourceMode ? -1 : 0}\n $minHeight={height?.min}\n $maxHeight={height?.max}\n $hidden={sourceMode}\n />\n {required ? (\n <HiddenText id={requiredDescriptionId}>{t('required')}</HiddenText>\n ) : null}\n {sourceMode ? (\n <StyledSourceTextarea\n value={sourceCode}\n onChange={e => setSourceCode(e.target.value)}\n spellCheck={false}\n aria-label={t('rte_source_code')}\n $minHeight={height?.min}\n $maxHeight={height?.max}\n />\n ) : null}\n {(toolbar?.length || customActions?.length) && tiptapEditor ? (\n <Toolbar\n testId={testIds}\n features={toolbar || []}\n editor={tiptapEditor}\n customActions={customActions}\n imageInsertionMode={imageInsertionMode}\n onRewriteClick={onRewriteClick}\n linkCustomSource={linkCustomSource}\n renderSuggestionEditor={renderSuggestionEditor}\n sourceMode={sourceMode}\n onSourceModeToggle={(isSourceMode: boolean) => {\n if (isSourceMode) {\n setSourceCode(tiptapEditor.getHTML());\n } else {\n tiptapEditor.commands.setContent(sourceCode);\n }\n setSourceMode(isSourceMode);\n }}\n />\n ) : null}\n {imagesEnabled && !readOnly && !disabled ? (\n <ImageActionButtons\n ref={editButtonRef}\n position={hoveredImagePosition}\n containerRef={editorContainerRef}\n onEdit={onEditButtonClick}\n onDelete={handleImageDelete}\n onMouseEnter={() => setIsOverButtons(true)}\n onMouseLeave={() => setIsOverButtons(false)}\n editLabel={t('rte_edit_image', [currentImageAttrs?.alt || ''])}\n deleteLabel={t('rte_delete_image', [currentImageAttrs?.alt || ''])}\n />\n ) : null}\n {tablesEnabled && !readOnly && !disabled && !sourceMode ? (\n <TableCellMenu\n ref={tableCellMenuButtonRef}\n position={cellPosition}\n containerRef={editorContainerRef}\n onAddRowBelow={addRowBelow}\n onAddRowAbove={addRowAbove}\n onAddColumnAfter={addColumnAfter}\n onAddColumnBefore={addColumnBefore}\n onDeleteRow={deleteRow}\n onDeleteColumn={deleteColumn}\n onDeleteTable={deleteTable}\n onGoToNextCell={goToNextCell}\n onReturnToCell={returnToCell}\n onMouseEnter={() => setIsOverTableMenu(true)}\n onMouseLeave={() => setIsOverTableMenu(false)}\n labels={{\n tableOptions: t('rte_table_options'),\n addRowBelow: t('rte_add_row_below'),\n addRowAbove: t('rte_add_row_above'),\n addColumnAfter: t('rte_add_column_after'),\n addColumnBefore: t('rte_add_column_before'),\n deleteRow: t('rte_delete_row'),\n deleteColumn: t('rte_delete_column'),\n deleteTable: t('rte_delete_table')\n }}\n />\n ) : null}\n </StyledEditorContainer>\n </FormControl>\n {toolbar?.includes('word-count') && tiptapEditor ? (\n <WordCount data-testid={testIds.wordCount} editor={tiptapEditor} />\n ) : null}\n </>\n </StyledEditorRoot>\n {children}\n {imageEditDialog.attributes && (\n <ImageEditDialog\n isOpen={imageEditDialog.isOpen}\n onClose={() => {\n setImageEditDialog({ isOpen: false, attributes: null });\n }}\n onSave={handleImageEditSave}\n initialAttributes={imageEditDialog.attributes}\n target={editButtonRef.current}\n />\n )}\n </EditorContext.Provider>\n );\n});\n\nexport default withTestIds(Editor, getEditorTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":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CAAC,mBAAmB,CAAC;4CACpC,WAAW,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACnC,WAAW,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACnC,cAAc,EAAE,CAAC,CAAC,sBAAsB,CAAC;4CACzC,eAAe,EAAE,CAAC,CAAC,uBAAuB,CAAC;4CAC3C,SAAS,EAAE,CAAC,CAAC,gBAAgB,CAAC;4CAC9B,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC;4CACpC,WAAW,EAAE,CAAC,CAAC,kBAAkB,CAAC;yCACnC,GACD,CACH,CAAC,CAAC,CAAC,IAAI,IACc,GACZ,EACb,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CACjD,KAAC,SAAS,mBAAc,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAI,CACpE,CAAC,CAAC,CAAC,IAAI,IACP,GACc,EAClB,QAAQ,EACR,eAAe,CAAC,UAAU,IAAI,CAC7B,KAAC,eAAe,IACd,MAAM,EAAE,eAAe,CAAC,MAAM,EAC9B,OAAO,EAAE,GAAG,EAAE;oBACZ,kBAAkB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1D,CAAC,EACD,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,EAAE,eAAe,CAAC,UAAU,EAC7C,MAAM,EAAE,aAAa,CAAC,OAAO,EAC7B,iBAAiB,EAAE,iBAAiB,GACpC,CACH,IACsB,CAC1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Editor as TiptapEditor } from '@tiptap/core';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useImperativeHandle,\n useMemo,\n useCallback\n} from 'react';\nimport type { PropsWithoutRef, ReactNode, RefObject } from 'react';\nimport { css } from 'styled-components';\n\nimport {\n FormControl,\n Progress,\n HiddenText,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useConsolidatedRef,\n useTestIds,\n withTestIds,\n useConfiguration,\n useI18n\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport StyledRichTextEditor from '../RichTextEditor/RichTextEditor.styles';\nimport type { Features } from '../RichTextEditor/Toolbar/Toolbar.types';\n\nimport EditorContext from './Editor.context';\nimport type { EditorProps, EditorState, CustomComponent } from './Editor.types';\nimport {\n StyledEditorContainer,\n StyledEditorIframe,\n StyledEditorRoot,\n StyledSourceTextarea\n} from './Editor.styles';\nimport { getEditorTestIds } from './Editor.test-ids';\nimport Toolbar from './Toolbar/Toolbar';\nimport WordCount from './Toolbar/WordCount';\nimport { ImageEditDialog } from './ImageEditDialog';\nimport type { ImageAttributes } from './ImageEditDialog';\nimport ImageActionButtons from './ImageActionButtons';\nimport TableCellMenu from './TableCellMenu';\nimport createFileItemElement from './FileItemElement';\nimport useIframeSetup from './hooks/useIframeSetup';\nimport useImageActions from './hooks/useImageActions';\nimport useTableCellMenu from './hooks/useTableCellMenu';\nimport { dispatchEditorClickEvent } from './hooks/useCloseOnEditorClick';\nimport sanitizeHtml from './sanitize';\n\n// Suggestion editor has no toolbar — formatting controls are intentionally omitted\nconst SUGGESTION_TOOLBAR: Features[] = [];\n\ninterface SuggestionEditorRenderProps {\n ref: RefObject<EditorState>;\n onInit: (tiptapEditor: TiptapEditor) => void;\n onChange: (editor?: TiptapEditor) => void;\n}\n\ninterface SuggestionEditorProps {\n defaultValue?: string;\n disabled: boolean;\n readOnly: boolean;\n onGetContent: (getContent: () => string) => void;\n onContentChange: (hasContent: boolean) => void;\n /** Render prop — receives ref and callbacks; must render an Editor-like element */\n renderEditor: (renderProps: SuggestionEditorRenderProps) => ReactNode;\n}\n\nconst SuggestionEditor = ({\n defaultValue,\n onGetContent,\n onContentChange,\n renderEditor\n}: SuggestionEditorProps) => {\n const editorRef = useRef<EditorState>(null);\n\n useEffect(() => {\n onGetContent(() => editorRef.current?.getEditor()?.getHTML() ?? '');\n }, [onGetContent]);\n\n useAfterInitialEffect(() => {\n editorRef.current?.getEditor()?.commands.setContent(defaultValue ?? '');\n }, [defaultValue]);\n\n return renderEditor({\n ref: editorRef,\n onInit: tiptapEditor => {\n // Signal initial content state so submit button enables correctly\n onContentChange(tiptapEditor.getText().trim() !== '');\n },\n onChange: editor => {\n onContentChange((editor?.getText() ?? '').trim() !== '');\n }\n });\n};\n\nconst Editor: ForwardRefForwardPropsComponent<EditorProps> = forwardRef(function ForwardedEditor(\n props: PropsWithoutRef<EditorProps>,\n ref: EditorProps['ref']\n) {\n const {\n testId,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n disabled,\n readOnly,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n onImageAdded,\n onResolveSuggestion,\n onInit,\n onUnload,\n defaultValue,\n placeholder,\n children,\n additionalInfo,\n toolbar,\n customActions,\n customComponents = [],\n spellcheck = true,\n imageInsertionMode = 'all',\n initOptions,\n onRewriteClick,\n linkCustomSource,\n imageCustomSource,\n progress,\n autoFocus,\n height,\n autoResize = true,\n secure = false,\n preserveTableStyles = false,\n ...restProps\n } = props;\n\n const theme = useTheme();\n const { styleSheetTarget } = useConfiguration();\n const t = useI18n();\n const [focused, setFocused] = useState(false);\n const [tiptapEditor, setTiptapEditor] = useState<TiptapEditor | null>(null);\n const [imageEditDialog, setImageEditDialog] = useState<{\n isOpen: boolean;\n attributes: ImageAttributes | null;\n }>({ isOpen: false, attributes: null });\n const [sourceMode, setSourceMode] = useState(false);\n const [sourceCode, setSourceCode] = useState('');\n const editButtonRef = useRef<HTMLButtonElement>(null);\n const tableCellMenuButtonRef = useRef<HTMLButtonElement>(null);\n const editorContainerRef = useRef<HTMLDivElement>(null);\n const generatedId = useUID();\n const editorId = id ?? generatedId;\n const labelId = useUID();\n const requiredDescriptionId = `${editorId}-required`;\n const editorRef = useConsolidatedRef(ref);\n const formFieldRef = useRef<HTMLElement>(null);\n const pastedImages = useRef<File[]>([]);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const pendingImageActionUrlsRef = useRef<Map<string, string>>(new Map());\n\n const testIds = useTestIds(testId, getEditorTestIds);\n\n // Check if images feature is enabled\n const imagesEnabled = toolbar?.includes('images') ?? false;\n\n // Check if tables feature is enabled\n const tablesEnabled = toolbar?.includes('tables') ?? false;\n\n // Check if links feature is enabled (controls autolink behavior)\n const linksEnabled = toolbar?.includes('links') ?? false;\n\n // Define built-in custom components and merge with user-provided ones\n const customElements: CustomComponent[] = useMemo(() => {\n const FileItemStyle = css`\n /* stylelint-disable-next-line selector-type-no-unknown */\n pega-file {\n display: inline-block;\n width: ${theme.base['content-width'].md};\n }\n `;\n\n return [\n {\n createCustomElement: createFileItemElement,\n name: 'pega-file',\n style: FileItemStyle.toString(),\n extensionAttributes: ['contenteditable']\n },\n ...customComponents\n ];\n }, [customComponents, theme]);\n\n // Register custom elements in the main window (needed for Tiptap to recognize them)\n useEffect(() => {\n customElements.forEach((component: CustomComponent) => {\n if (\n component.name &&\n component.createCustomElement &&\n !window.customElements.get(component.name)\n ) {\n const CustomElement = component.createCustomElement(window);\n window.customElements.define(component.name, CustomElement);\n }\n });\n }, [customElements]);\n\n // Sanitize defaultValue if secure mode is enabled\n const sanitizedDefaultValue = useMemo(\n () => (secure && defaultValue ? sanitizeHtml(defaultValue) : defaultValue),\n [secure, defaultValue]\n );\n\n // Mount Tiptap inside iframe using custom hook\n const { iframeEditorRef } = useIframeSetup({\n iframeRef,\n theme,\n styleSheetTarget,\n customElements,\n placeholder,\n defaultValue: sanitizedDefaultValue,\n disabled,\n readOnly,\n onChange,\n onKeyDown,\n onFocus,\n onBlur,\n onInit,\n spellcheck,\n initOptions,\n onImageAdded,\n imagesEnabled,\n linksEnabled,\n imageInsertionMode,\n pastedImages,\n editorId,\n required,\n setTiptapEditor,\n setFocused,\n autoResize,\n secure,\n preserveTableStyles,\n onTabOut: () => {\n // Focus first toolbar button when Tab is pressed in editor\n const toolbarEl = editorContainerRef.current?.querySelector('[data-testid$=\"toolbar\"]');\n const firstButton = toolbarEl?.querySelector<HTMLElement>('button:not([disabled])');\n if (firstButton) {\n firstButton.focus();\n }\n },\n onFocusTableMenu: () => {\n tableCellMenuButtonRef.current?.focus();\n },\n onFocusPreviousCellMenu: () => {\n // Go to previous cell and then focus its menu\n if (tiptapEditor) {\n tiptapEditor.commands.goToPreviousCell();\n setTimeout(() => {\n tableCellMenuButtonRef.current?.focus();\n }, 0);\n }\n }\n });\n\n // Set up unload event listener to save content before iframe is destroyed\n useEffect(() => {\n if (!iframeRef.current?.contentWindow || !onUnload) return;\n\n const iframeWindow = iframeRef.current.contentWindow;\n const abortController = new AbortController();\n\n iframeWindow.addEventListener(\n 'unload',\n () => {\n const html = iframeEditorRef.current?.getHtml() ?? '';\n onUnload(html);\n },\n { signal: abortController.signal }\n );\n\n return () => {\n abortController.abort();\n };\n }, [onUnload]);\n\n // Dispatch event on iframe mousedown to close all open popovers/menus\n useEffect(() => {\n const iframeDoc = iframeRef.current?.contentDocument;\n if (!iframeDoc) return;\n\n const handleMouseDown = () => {\n dispatchEditorClickEvent();\n };\n\n iframeDoc.addEventListener('mousedown', handleMouseDown);\n return () => iframeDoc.removeEventListener('mousedown', handleMouseDown);\n }, [tiptapEditor]);\n\n // Set up image action buttons (edit and delete) using custom hook\n const {\n hoveredImagePosition,\n currentImageAttrs,\n currentImageElement,\n handleDelete: handleImageDelete,\n setIsOverButtons\n } = useImageActions({\n tiptapEditor,\n iframeRef,\n isDialogOpen: imageEditDialog.isOpen\n });\n\n // Set up table cell menu using custom hook (only when tables are active)\n const tableMenuEnabled = tablesEnabled && !readOnly && !disabled;\n const {\n cellPosition,\n setIsOverMenu: setIsOverTableMenu,\n addRowBelow,\n addRowAbove,\n addColumnAfter,\n addColumnBefore,\n deleteRow,\n deleteColumn,\n deleteTable\n } = useTableCellMenu({\n tiptapEditor: tableMenuEnabled ? tiptapEditor : null,\n iframeRef\n });\n\n // Handle keyboard navigation from table menu to next cell (start of content)\n const goToNextCell = useCallback(() => {\n if (tiptapEditor) {\n tiptapEditor.commands.focus();\n tiptapEditor.commands.goToNextCell();\n }\n }, [tiptapEditor]);\n\n // Handle keyboard navigation from table menu back to current cell\n const returnToCell = useCallback(() => {\n tiptapEditor?.commands.focus();\n }, [tiptapEditor]);\n\n // Store the image element when opening the dialog to target the correct node on save\n const editingImageElementRef = useRef<HTMLImageElement | null>(null);\n\n // Handle edit button click from ImageActionButtons\n const onEditButtonClick = () => {\n if (currentImageAttrs && currentImageElement) {\n // Store the element reference to target the correct node on save\n editingImageElementRef.current = currentImageElement;\n setImageEditDialog({\n isOpen: true,\n attributes: currentImageAttrs\n });\n // Don't call handleImageEdit() here - keep buttons visible while dialog is open\n }\n };\n\n // Handle image edit save\n const handleImageEditSave = (attrs: ImageAttributes) => {\n if (!tiptapEditor || !editingImageElementRef.current) {\n editingImageElementRef.current = null;\n return;\n }\n\n // Get exact position from DOM element to handle duplicate images correctly\n const pos = tiptapEditor.view.posAtDOM(editingImageElementRef.current, 0);\n\n let imageUpdated = false;\n\n if (pos >= 0) {\n const { state } = tiptapEditor;\n const node = state.doc.nodeAt(pos);\n if (!node || node.type.name !== 'image') {\n editingImageElementRef.current = null;\n return;\n }\n\n const nodeEnd = pos + node.nodeSize;\n const tr = state.tr;\n\n // Update image attributes\n tr.setNodeMarkup(pos, undefined, {\n src: attrs.src,\n alt: attrs.alt,\n ...(attrs.width && { width: attrs.width }),\n ...(attrs.height && { height: attrs.height })\n });\n\n // Handle action URL (links are marks in ProseMirror, not nodes)\n // Always remove existing link mark first, then add new one if needed\n tr.removeMark(pos, nodeEnd, state.schema.marks.link);\n if (attrs.actionUrl) {\n const linkMark = state.schema.marks.link.create({\n href: attrs.actionUrl,\n target: '_blank'\n });\n tr.addMark(pos, nodeEnd, linkMark);\n }\n\n tiptapEditor.view.dispatch(tr);\n imageUpdated = true;\n }\n\n // Clear the ref after save\n editingImageElementRef.current = null;\n\n // Trigger blur callback to persist image changes to redux\n // Without this, edited images won't be saved until user manually blurs the editor\n if (imageUpdated && onBlur) {\n onBlur();\n }\n };\n\n // Update editor when props change\n useAfterInitialEffect(() => {\n iframeEditorRef.current?.setEditable(!readOnly && !disabled);\n }, [readOnly, disabled]);\n\n // Handle autoFocus\n useEffect(() => {\n if (autoFocus && tiptapEditor) {\n tiptapEditor.commands.focus();\n }\n }, [autoFocus, tiptapEditor]);\n\n // Expose methods via ref\n useImperativeHandle(\n editorRef,\n () => ({\n focus: () => iframeEditorRef.current?.focus(),\n getPlainText: () => iframeEditorRef.current?.getPlainText() ?? '',\n getRichText: () => iframeEditorRef.current?.getRichText() ?? '',\n getHtml: () => iframeEditorRef.current?.getHtml() ?? '',\n clear: () => iframeEditorRef.current?.clear(),\n updateAttachmentAttributes: (imageId: string, uploadProgress?: number, error?: string) => {\n if (!iframeRef.current?.contentDocument) return;\n\n const iframeDoc = iframeRef.current.contentDocument;\n const imageCustomEl = iframeDoc.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n\n if (imageCustomEl) {\n if (error) {\n imageCustomEl.setAttribute('data-error', error);\n } else if (uploadProgress !== undefined) {\n imageCustomEl.setAttribute('data-progress', `${uploadProgress}`);\n }\n }\n },\n appendImage: (\n imageData: { src: string; alt: string; attachmentId?: string },\n imageId: string\n ) => {\n if (!iframeRef.current?.contentDocument || !tiptapEditor) return;\n\n const iframeDoc = iframeRef.current.contentDocument;\n const imageUploadEl = iframeDoc.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n\n if (imageUploadEl) {\n // Create img element\n const imgEl = iframeDoc.createElement('img');\n imgEl.setAttribute('src', imageData.src);\n imgEl.setAttribute('alt', imageData.alt);\n if (imageData.attachmentId) {\n imgEl.setAttribute('data-attachment-id', imageData.attachmentId);\n }\n\n const anchorEl = iframeDoc.createElement('a');\n const pendingActionUrl = pendingImageActionUrlsRef.current.get(imageId);\n anchorEl.setAttribute('href', pendingActionUrl || imageData.src);\n anchorEl.setAttribute('target', '_blank');\n anchorEl.setAttribute('rel', 'noopener noreferrer');\n anchorEl.appendChild(imgEl);\n\n // Replace pega-file with linked img in the DOM\n imageUploadEl.replaceWith(anchorEl);\n\n // Also update the Tiptap document\n const html = tiptapEditor.getHTML();\n const updatedHtml = html.replace(\n new RegExp(`<pega-file[^>]*data-id=[\"']${imageId}[\"'][^>]*>.*?</pega-file>`, 'g'),\n anchorEl.outerHTML\n );\n\n if (updatedHtml !== html) {\n tiptapEditor.commands.setContent(updatedHtml, { emitUpdate: false });\n }\n\n pendingImageActionUrlsRef.current.delete(imageId);\n }\n },\n insertText: (text: string) => iframeEditorRef.current?.insertText(text),\n setCursorLocationToStart: () => iframeEditorRef.current?.setCursorLocationToStart(),\n insertHtml: (html: string, overwrite?: boolean) =>\n iframeEditorRef.current?.insertHtml(html, overwrite),\n getEditor: () => iframeEditorRef.current?.getEditor() ?? null,\n element: formFieldRef.current || undefined\n }),\n [tiptapEditor]\n );\n\n const ctx = useMemo(\n () => ({\n editor: tiptapEditor,\n addImage: (image: File, imageId?: string, alt?: string, actionUrl?: string) => {\n if (!tiptapEditor || !image) return;\n\n const imgId = imageId || `img-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;\n\n if (actionUrl) {\n pendingImageActionUrlsRef.current.set(imgId, actionUrl);\n }\n\n // Create pega-file element to show upload progress\n const pegaFileHtml = `<br/><pega-file data-id='${imgId}' data-progress='0' data-name='${image.name}' data-alt='${alt || image.name}' contenteditable='false'></pega-file><br/>`;\n\n // Insert the pega-file element\n tiptapEditor.chain().focus().insertContent(pegaFileHtml).run();\n\n // Trigger the onImageAdded callback so consumer can upload and call appendImage\n onImageAdded?.(image, imgId, alt);\n }\n }),\n [tiptapEditor, onImageAdded]\n );\n\n const renderSuggestionEditor = useCallback(\n (suggestionProps: {\n defaultValue?: string;\n disabled: boolean;\n readOnly: boolean;\n onGetContent: (getContent: () => string) => void;\n onContentChange: (hasContent: boolean) => void;\n }) => (\n <SuggestionEditor\n defaultValue={suggestionProps.defaultValue}\n disabled={suggestionProps.disabled}\n readOnly={suggestionProps.readOnly}\n onGetContent={suggestionProps.onGetContent}\n onContentChange={suggestionProps.onContentChange}\n renderEditor={({\n ref: suggestionEditorRef,\n onInit: suggestionOnInit,\n onChange: suggestionOnChange\n }) => (\n <Editor\n ref={suggestionEditorRef}\n label={t('ai_rewrite_result_label')}\n labelHidden\n toolbar={SUGGESTION_TOOLBAR}\n defaultValue={suggestionProps.defaultValue}\n disabled={suggestionProps.disabled}\n readOnly={suggestionProps.readOnly}\n height={height}\n onInit={suggestionOnInit}\n onChange={suggestionOnChange}\n />\n )}\n />\n ),\n [height, t]\n );\n\n return (\n <EditorContext.Provider value={ctx}>\n <StyledEditorRoot\n testId={testIds}\n label={label}\n labelFor=''\n labelId={labelId}\n labelHidden={labelHidden}\n id={editorId}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n onResolveSuggestion={onResolveSuggestion}\n ref={formFieldRef}\n additionalInfo={additionalInfo}\n >\n <>\n <FormControl\n {...restProps}\n ref={editorRef}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n as={StyledRichTextEditor}\n focused={focused}\n hasSuggestion={status === 'pending'}\n >\n <StyledEditorContainer ref={editorContainerRef}>\n {progress ? (\n <Progress\n placement='local'\n message={typeof progress === 'string' ? progress : undefined}\n />\n ) : null}\n {/* Title attribute is required for iframe accessibility (WCAG) */}\n <StyledEditorIframe\n data-testid={testIds.iframe}\n title={typeof label === 'string' ? label : t('rte_text_formatting_toolbar')}\n role='application'\n aria-label={typeof label === 'string' ? label : t('rte_text_formatting_toolbar')}\n aria-describedby={required ? requiredDescriptionId : undefined}\n ref={iframeRef}\n tabIndex={sourceMode ? -1 : 0}\n $minHeight={height?.min}\n $maxHeight={height?.max}\n $hidden={sourceMode}\n />\n {required ? (\n <HiddenText id={requiredDescriptionId}>{t('required')}</HiddenText>\n ) : null}\n {sourceMode ? (\n <StyledSourceTextarea\n value={sourceCode}\n onChange={e => setSourceCode(e.target.value)}\n spellCheck={false}\n aria-label={t('rte_source_code')}\n $minHeight={height?.min}\n $maxHeight={height?.max}\n />\n ) : null}\n {(toolbar?.length || customActions?.length) && tiptapEditor ? (\n <Toolbar\n testId={testIds}\n features={toolbar || []}\n editor={tiptapEditor}\n customActions={customActions}\n imageInsertionMode={imageInsertionMode}\n onRewriteClick={onRewriteClick}\n linkCustomSource={linkCustomSource}\n imageCustomSource={imageCustomSource}\n renderSuggestionEditor={renderSuggestionEditor}\n sourceMode={sourceMode}\n onSourceModeToggle={(isSourceMode: boolean) => {\n if (isSourceMode) {\n setSourceCode(tiptapEditor.getHTML());\n } else {\n tiptapEditor.commands.setContent(sourceCode);\n }\n setSourceMode(isSourceMode);\n }}\n />\n ) : null}\n {imagesEnabled && !readOnly && !disabled ? (\n <ImageActionButtons\n ref={editButtonRef}\n position={hoveredImagePosition}\n containerRef={editorContainerRef}\n onEdit={onEditButtonClick}\n onDelete={handleImageDelete}\n onMouseEnter={() => setIsOverButtons(true)}\n onMouseLeave={() => setIsOverButtons(false)}\n editLabel={t('rte_edit_image', [currentImageAttrs?.alt || ''])}\n deleteLabel={t('rte_delete_image', [currentImageAttrs?.alt || ''])}\n />\n ) : null}\n {tablesEnabled && !readOnly && !disabled && !sourceMode ? (\n <TableCellMenu\n ref={tableCellMenuButtonRef}\n position={cellPosition}\n containerRef={editorContainerRef}\n onAddRowBelow={addRowBelow}\n onAddRowAbove={addRowAbove}\n onAddColumnAfter={addColumnAfter}\n onAddColumnBefore={addColumnBefore}\n onDeleteRow={deleteRow}\n onDeleteColumn={deleteColumn}\n onDeleteTable={deleteTable}\n onGoToNextCell={goToNextCell}\n onReturnToCell={returnToCell}\n onMouseEnter={() => setIsOverTableMenu(true)}\n onMouseLeave={() => setIsOverTableMenu(false)}\n labels={{\n tableOptions: t('rte_table_options'),\n addRowBelow: t('rte_add_row_below'),\n addRowAbove: t('rte_add_row_above'),\n addColumnAfter: t('rte_add_column_after'),\n addColumnBefore: t('rte_add_column_before'),\n deleteRow: t('rte_delete_row'),\n deleteColumn: t('rte_delete_column'),\n deleteTable: t('rte_delete_table')\n }}\n />\n ) : null}\n </StyledEditorContainer>\n </FormControl>\n {toolbar?.includes('word-count') && tiptapEditor ? (\n <WordCount data-testid={testIds.wordCount} editor={tiptapEditor} />\n ) : null}\n </>\n </StyledEditorRoot>\n {children}\n {imageEditDialog.attributes && (\n <ImageEditDialog\n isOpen={imageEditDialog.isOpen}\n onClose={() => {\n setImageEditDialog({ isOpen: false, attributes: null });\n }}\n onSave={handleImageEditSave}\n initialAttributes={imageEditDialog.attributes}\n target={editButtonRef.current}\n imageCustomSource={imageCustomSource}\n />\n )}\n </EditorContext.Provider>\n );\n});\n\nexport default withTestIds(Editor, getEditorTestIds);\n"]}
|
|
@@ -50,6 +50,23 @@ export interface LinkCustomSourceConfig {
|
|
|
50
50
|
*/
|
|
51
51
|
onDismissEdit?: (reason?: 'cancel' | 'apply') => void;
|
|
52
52
|
}
|
|
53
|
+
export interface ImageCustomSourceConfig {
|
|
54
|
+
/** Called when editing an existing custom-source image action URL and the source field can be resolved from action URL markup. */
|
|
55
|
+
onEditSelectionChange?: (value: LinkCustomSourceEditValue) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Called when the image edit popover that updated custom-source selection is dismissed.
|
|
58
|
+
* reason is 'apply' when user applies changes, otherwise 'cancel'.
|
|
59
|
+
*/
|
|
60
|
+
onDismissEdit?: (reason?: 'cancel' | 'apply') => void;
|
|
61
|
+
/** A custom picker ReactNode rendered inline in image dialogs when the custom source option is selected. */
|
|
62
|
+
picker?: ReactNode;
|
|
63
|
+
/** Called when Apply is clicked in image dialogs with custom source mode selected. Returns resolved href for image action link.
|
|
64
|
+
* If returning a <pega-reference ...> value, return raw (unescaped) markup; the editor will escape it as needed when inserting into HTML attributes.
|
|
65
|
+
*/
|
|
66
|
+
onSubmit?: (imageAltText: string) => string | undefined;
|
|
67
|
+
/** Indicates whether custom-source submit is currently allowed. Defaults to true when omitted. */
|
|
68
|
+
canSubmit?: boolean;
|
|
69
|
+
}
|
|
53
70
|
export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
|
|
54
71
|
/** An array of strings that activate features on the toolbar */
|
|
55
72
|
toolbar?: Features[];
|
|
@@ -121,6 +138,8 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
|
|
|
121
138
|
onRewriteClick?: (originalText: string, rewriteAction: AIAction, additionalInstructions: string, onSuccess: (rewrittenText: string) => void) => void;
|
|
122
139
|
/** Link custom-source configuration for inserting and editing links using consumer-provided source selection. */
|
|
123
140
|
linkCustomSource?: LinkCustomSourceConfig;
|
|
141
|
+
/** Image custom-source configuration for inserting image action links using consumer-provided source selection. */
|
|
142
|
+
imageCustomSource?: ImageCustomSourceConfig;
|
|
124
143
|
/** If there is a progress state (e.g. AI rewrite in progress), you must indicate as such. Shows a Progress overlay on the editor. */
|
|
125
144
|
progress?: boolean | string;
|
|
126
145
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.types.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,GAAG,EACH,UAAU,IAAI,eAAe,EAC7B,aAAa,IAAI,kBAAkB,EACpC,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC9C,SAAS,EAAE,MAAM,YAAY,GAAG,I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;IACrC,iEAAiE;IACjE,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE;QACZ,sDAAsD;QACtD,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,yDAAyD;QACzD,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,2GAA2G;QAC3G,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,2EAA2E;QAC3E,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;QACtD,iDAAiD;QACjD,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,2BAA2B;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAC5C,8HAA8H;IAC9H,cAAc,CAAC,EAAE,CACf,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,QAAQ,EACvB,sBAAsB,EAAE,MAAM,EAC9B,SAAS,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,KACvC,IAAI,CAAC;IACV,iHAAiH;IACjH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAC1C,mHAAmH;IACnH,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;IAC5C,qIAAqI;IACrI,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.types.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ReactNode,\n Ref,\n MouseEvent as ReactMouseEvent,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\nimport type { Editor as TiptapEditor } from '@tiptap/core';\n\nimport type {\n Action,\n BaseProps,\n FormControlProps,\n TestIdProp,\n AIAction\n} from '@pega/cosmos-react-core';\n\nimport type { Features } from '../RichTextEditor/Toolbar/Toolbar.types';\nimport type { RichTextEditorState } from '../RichTextEditor';\n\nexport type EditorState = RichTextEditorState & {\n getEditor: () => TiptapEditor | null;\n element?: HTMLElement;\n setCursorLocationToStart?: () => void;\n updateAttachmentAttributes: (id: string, progress?: number, error?: string) => void;\n};\n\nexport type CustomAction = {\n text: Action['text'];\n icon: NonNullable<Action['icon']>;\n onMouseDown: (e: ReactMouseEvent | ReactKeyboardEvent) => void;\n active?: (editor: TiptapEditor) => boolean;\n shortcut?: {\n pattern: string;\n description: string;\n command: (editor: TiptapEditor) => void;\n };\n 'data-testid'?: string;\n};\n\nexport type CustomComponent = {\n createCustomElement: (window: typeof globalThis) => CustomElementConstructor;\n name: string;\n extensionAttributes?: string[];\n style?: string;\n};\n\nexport interface LinkCustomSourceEditValue {\n id: string;\n text: string;\n namespace?: string;\n}\n\nexport interface LinkCustomSourceConfig {\n /** A custom picker ReactNode rendered inline in the link popover when the custom source option is selected. */\n picker?: ReactNode;\n /** Called when Apply is clicked in the link popover with custom source mode selected. Receives the link display text. */\n onSubmit?: (linkText: string) => void;\n /** Indicates whether custom-source submit is currently allowed. Defaults to true when omitted. */\n canSubmit?: boolean;\n /** Called when editing an existing custom-source link and the source field can be resolved from link markup. */\n onEditSelectionChange?: (value: LinkCustomSourceEditValue) => void;\n /** When set, opens the link popover in custom source mode with pre-populated text for editing an existing custom-source link. Set to null to dismiss. */\n edit?: LinkCustomSourceEditValue | null | undefined;\n /**\n * Called when the link popover opened via linkCustomSource.edit is dismissed.\n * reason is 'apply' when user applies changes, otherwise 'cancel'.\n * Consumer should set linkCustomSource.edit to null.\n */\n onDismissEdit?: (reason?: 'cancel' | 'apply') => void;\n}\n\nexport interface EditorProps extends FormControlProps, BaseProps, TestIdProp {\n /** An array of strings that activate features on the toolbar */\n toolbar?: Features[];\n /** Children content */\n children?: ReactNode;\n /** A callback that supplies an object with functions that can manipulate the editor and retrieve it's content/state */\n onChange?: (editor?: TiptapEditor) => void;\n /** KeyDown event custom handlers for the editor */\n onKeyDown?: (event?: KeyboardEvent) => void;\n /** A callback that runs if the editor is focused */\n onFocus?: () => void;\n /** A callback that runs if the editor loses focus */\n onBlur?: () => void;\n /** A callback when an image is added through the toolbar image feature */\n onImageAdded?: (image: File, id: string, altText?: string) => void;\n /** A callback for when the editor is finished initializing */\n onInit?: (editor: TiptapEditor) => void;\n /** A callback that runs when the iframe is about to unload, useful for saving editor state */\n onUnload?: (value: string) => void;\n /** Standard placeholder for an input */\n placeholder?: string;\n /** Default value for the RTE - HTML String */\n defaultValue?: string;\n /** Will automatically focus the RTE on render if true */\n autoFocus?: boolean;\n /** Sets the height for the RTE. If no max height is set the RTE will continue to expand, otherwise an overflow will be applied */\n height?: {\n min?: number;\n max?: number;\n };\n /**\n * Determines if the editor resizes its height based on content and user interactions.\n * @default true;\n */\n autoResize?: boolean;\n /** An array of custom components, custom components must use web component API */\n customComponents?: CustomComponent[];\n /** An array of custom buttons to be inserted into the toolbar */\n customActions?: CustomAction[];\n /**\n * Enables browser spellcheck.\n * @default true\n */\n spellcheck?: boolean;\n /** Options used during init of the editor */\n initOptions?: {\n /** Disables pasting of images in editor when false */\n pasteDataImages?: boolean;\n /** Converts formatted text to plain text upon pasting */\n pasteAsText?: boolean;\n /** Disables inline, block, and replacement text patterns when false and can be array of allowed formats */\n textPatterns?: boolean;\n /** Function called during init_instance_callback as part of editor init */\n initInstanceCallback?: (editor: TiptapEditor) => void;\n /** Styles to set within the iframe's document */\n contentStyle?: string;\n };\n /** Handle to the state. */\n ref?: Ref<EditorState>;\n /**\n * Determines the image insertion mode for the editor.\n * - 'file': Only allows uploading image files from local system\n * - 'url': Only allows adding images via URL/link\n * - 'all': Allows all image files upload options\n * @default 'all'\n */\n imageInsertionMode?: 'file' | 'url' | 'all';\n /** A callback when the AI rewrite toolbar button is used. The onSuccess callback should be called with the rewritten text. */\n onRewriteClick?: (\n originalText: string,\n rewriteAction: AIAction,\n additionalInstructions: string,\n onSuccess: (rewrittenText: string) => void\n ) => void;\n /** Link custom-source configuration for inserting and editing links using consumer-provided source selection. */\n linkCustomSource?: LinkCustomSourceConfig;\n /** If there is a progress state (e.g. AI rewrite in progress), you must indicate as such. Shows a Progress overlay on the editor. */\n progress?: boolean | string;\n /**\n * Enables secure mode which sanitizes content to prevent XSS attacks.\n * Strips scripts, iframes, event handlers, and dangerous URLs.\n * @default false\n */\n secure?: boolean;\n /**\n * Preserves inline styles on table elements (table, tr, td, th).\n * Use for correspondence editing where email template styling must be preserved.\n * @default false\n */\n preserveTableStyles?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.types.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ReactNode,\n Ref,\n MouseEvent as ReactMouseEvent,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\nimport type { Editor as TiptapEditor } from '@tiptap/core';\n\nimport type {\n Action,\n BaseProps,\n FormControlProps,\n TestIdProp,\n AIAction\n} from '@pega/cosmos-react-core';\n\nimport type { Features } from '../RichTextEditor/Toolbar/Toolbar.types';\nimport type { RichTextEditorState } from '../RichTextEditor';\n\nexport type EditorState = RichTextEditorState & {\n getEditor: () => TiptapEditor | null;\n element?: HTMLElement;\n setCursorLocationToStart?: () => void;\n updateAttachmentAttributes: (id: string, progress?: number, error?: string) => void;\n};\n\nexport type CustomAction = {\n text: Action['text'];\n icon: NonNullable<Action['icon']>;\n onMouseDown: (e: ReactMouseEvent | ReactKeyboardEvent) => void;\n active?: (editor: TiptapEditor) => boolean;\n shortcut?: {\n pattern: string;\n description: string;\n command: (editor: TiptapEditor) => void;\n };\n 'data-testid'?: string;\n};\n\nexport type CustomComponent = {\n createCustomElement: (window: typeof globalThis) => CustomElementConstructor;\n name: string;\n extensionAttributes?: string[];\n style?: string;\n};\n\nexport interface LinkCustomSourceEditValue {\n id: string;\n text: string;\n namespace?: string;\n}\n\nexport interface LinkCustomSourceConfig {\n /** A custom picker ReactNode rendered inline in the link popover when the custom source option is selected. */\n picker?: ReactNode;\n /** Called when Apply is clicked in the link popover with custom source mode selected. Receives the link display text. */\n onSubmit?: (linkText: string) => void;\n /** Indicates whether custom-source submit is currently allowed. Defaults to true when omitted. */\n canSubmit?: boolean;\n /** Called when editing an existing custom-source link and the source field can be resolved from link markup. */\n onEditSelectionChange?: (value: LinkCustomSourceEditValue) => void;\n /** When set, opens the link popover in custom source mode with pre-populated text for editing an existing custom-source link. Set to null to dismiss. */\n edit?: LinkCustomSourceEditValue | null | undefined;\n /**\n * Called when the link popover opened via linkCustomSource.edit is dismissed.\n * reason is 'apply' when user applies changes, otherwise 'cancel'.\n * Consumer should set linkCustomSource.edit to null.\n */\n onDismissEdit?: (reason?: 'cancel' | 'apply') => void;\n}\n\nexport interface ImageCustomSourceConfig {\n /** Called when editing an existing custom-source image action URL and the source field can be resolved from action URL markup. */\n onEditSelectionChange?: (value: LinkCustomSourceEditValue) => void;\n /**\n * Called when the image edit popover that updated custom-source selection is dismissed.\n * reason is 'apply' when user applies changes, otherwise 'cancel'.\n */\n onDismissEdit?: (reason?: 'cancel' | 'apply') => void;\n /** A custom picker ReactNode rendered inline in image dialogs when the custom source option is selected. */\n picker?: ReactNode;\n /** Called when Apply is clicked in image dialogs with custom source mode selected. Returns resolved href for image action link.\n * If returning a <pega-reference ...> value, return raw (unescaped) markup; the editor will escape it as needed when inserting into HTML attributes.\n */\n onSubmit?: (imageAltText: string) => string | undefined;\n /** Indicates whether custom-source submit is currently allowed. Defaults to true when omitted. */\n canSubmit?: boolean;\n}\n\nexport interface EditorProps extends FormControlProps, BaseProps, TestIdProp {\n /** An array of strings that activate features on the toolbar */\n toolbar?: Features[];\n /** Children content */\n children?: ReactNode;\n /** A callback that supplies an object with functions that can manipulate the editor and retrieve it's content/state */\n onChange?: (editor?: TiptapEditor) => void;\n /** KeyDown event custom handlers for the editor */\n onKeyDown?: (event?: KeyboardEvent) => void;\n /** A callback that runs if the editor is focused */\n onFocus?: () => void;\n /** A callback that runs if the editor loses focus */\n onBlur?: () => void;\n /** A callback when an image is added through the toolbar image feature */\n onImageAdded?: (image: File, id: string, altText?: string) => void;\n /** A callback for when the editor is finished initializing */\n onInit?: (editor: TiptapEditor) => void;\n /** A callback that runs when the iframe is about to unload, useful for saving editor state */\n onUnload?: (value: string) => void;\n /** Standard placeholder for an input */\n placeholder?: string;\n /** Default value for the RTE - HTML String */\n defaultValue?: string;\n /** Will automatically focus the RTE on render if true */\n autoFocus?: boolean;\n /** Sets the height for the RTE. If no max height is set the RTE will continue to expand, otherwise an overflow will be applied */\n height?: {\n min?: number;\n max?: number;\n };\n /**\n * Determines if the editor resizes its height based on content and user interactions.\n * @default true;\n */\n autoResize?: boolean;\n /** An array of custom components, custom components must use web component API */\n customComponents?: CustomComponent[];\n /** An array of custom buttons to be inserted into the toolbar */\n customActions?: CustomAction[];\n /**\n * Enables browser spellcheck.\n * @default true\n */\n spellcheck?: boolean;\n /** Options used during init of the editor */\n initOptions?: {\n /** Disables pasting of images in editor when false */\n pasteDataImages?: boolean;\n /** Converts formatted text to plain text upon pasting */\n pasteAsText?: boolean;\n /** Disables inline, block, and replacement text patterns when false and can be array of allowed formats */\n textPatterns?: boolean;\n /** Function called during init_instance_callback as part of editor init */\n initInstanceCallback?: (editor: TiptapEditor) => void;\n /** Styles to set within the iframe's document */\n contentStyle?: string;\n };\n /** Handle to the state. */\n ref?: Ref<EditorState>;\n /**\n * Determines the image insertion mode for the editor.\n * - 'file': Only allows uploading image files from local system\n * - 'url': Only allows adding images via URL/link\n * - 'all': Allows all image files upload options\n * @default 'all'\n */\n imageInsertionMode?: 'file' | 'url' | 'all';\n /** A callback when the AI rewrite toolbar button is used. The onSuccess callback should be called with the rewritten text. */\n onRewriteClick?: (\n originalText: string,\n rewriteAction: AIAction,\n additionalInstructions: string,\n onSuccess: (rewrittenText: string) => void\n ) => void;\n /** Link custom-source configuration for inserting and editing links using consumer-provided source selection. */\n linkCustomSource?: LinkCustomSourceConfig;\n /** Image custom-source configuration for inserting image action links using consumer-provided source selection. */\n imageCustomSource?: ImageCustomSourceConfig;\n /** If there is a progress state (e.g. AI rewrite in progress), you must indicate as such. Shows a Progress overlay on the editor. */\n progress?: boolean | string;\n /**\n * Enables secure mode which sanitizes content to prevent XSS attacks.\n * Strips scripts, iframes, event handlers, and dangerous URLs.\n * @default false\n */\n secure?: boolean;\n /**\n * Preserves inline styles on table elements (table, tr, td, th).\n * Use for correspondence editing where email template styling must be preserved.\n * @default false\n */\n preserveTableStyles?: boolean;\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { ImageCustomSourceConfig } from './Editor.types';
|
|
1
2
|
interface ImageEditDialogProps {
|
|
2
3
|
isOpen: boolean;
|
|
3
4
|
onClose: () => void;
|
|
4
5
|
onSave: (attrs: ImageAttributes) => void;
|
|
5
6
|
initialAttributes: ImageAttributes;
|
|
6
7
|
target?: HTMLElement | null;
|
|
8
|
+
imageCustomSource?: ImageCustomSourceConfig;
|
|
7
9
|
}
|
|
8
10
|
export interface ImageAttributes {
|
|
9
11
|
src: string;
|
|
@@ -12,6 +14,6 @@ export interface ImageAttributes {
|
|
|
12
14
|
height?: number;
|
|
13
15
|
actionUrl?: string;
|
|
14
16
|
}
|
|
15
|
-
export declare function ImageEditDialog({ isOpen, onClose, onSave, initialAttributes, target }: ImageEditDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export declare function ImageEditDialog({ isOpen, onClose, onSave, initialAttributes, target, imageCustomSource }: ImageEditDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
18
|
export {};
|
|
17
19
|
//# sourceMappingURL=ImageEditDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageEditDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/ImageEditDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageEditDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/ImageEditDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D,UAAU,oBAAoB;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACzC,iBAAiB,EAAE,eAAe,CAAC;IACnC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuCD,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,MAAM,EACN,iBAAiB,EAClB,EAAE,oBAAoB,kDA4NtB"}
|