@pega/cosmos-react-rte 9.27.2 → 9.27.4

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.
@@ -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;;;;AAoqBhF,wBAAqD"}
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+oBhF,wBAAqD"}
@@ -150,20 +150,6 @@ const Editor = forwardRef(function ForwardedEditor(props, ref) {
150
150
  }
151
151
  }
152
152
  });
153
- // Set up unload event listener to save content before iframe is destroyed
154
- useEffect(() => {
155
- if (!iframeRef.current?.contentWindow || !onUnload)
156
- return;
157
- const iframeWindow = iframeRef.current.contentWindow;
158
- const abortController = new AbortController();
159
- iframeWindow.addEventListener('unload', () => {
160
- const html = iframeEditorRef.current?.getHtml() ?? '';
161
- onUnload(html);
162
- }, { signal: abortController.signal });
163
- return () => {
164
- abortController.abort();
165
- };
166
- }, [onUnload]);
167
153
  // Dispatch event on iframe mousedown to close all open popovers/menus
168
154
  useEffect(() => {
169
155
  const iframeDoc = iframeRef.current?.contentDocument;
@@ -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,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C,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\n// Uses Tiptap's isEmpty so leaf/atom nodes (images, hr, tables) count as content —\n// getText() alone returns '' for an image-only doc and would misreport it as blank.\nconst editorHasContent = (editor: TiptapEditor | undefined | null): boolean =>\n editor ? !editor.isEmpty : false;\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(editorHasContent(tiptapEditor));\n },\n onChange: editor => {\n onContentChange(editorHasContent(editor));\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 progress,\n autoFocus,\n height,\n autoResize = true,\n secure = 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 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 => {\n const next = e.target.value;\n setSourceCode(next);\n // Keep Tiptap in sync while editing source so parent components\n // reading getHtml()/isEmpty (e.g. required-field validation on\n // blur) see the latest content instead of the pre-toggle doc.\n tiptapEditor?.commands.setContent(next, { emitUpdate: true });\n }}\n onBlur={e => {\n // Tiptap is hidden in source mode and never held focus, so we bridge blur; ignore intra-editor focus moves.\n const nextFocus = e.relatedTarget as Node | null;\n if (nextFocus && editorContainerRef.current?.contains(nextFocus)) return;\n onBlur?.();\n }}\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 renderSuggestionEditor={renderSuggestionEditor}\n sourceMode={sourceMode}\n onSourceModeToggle={(isSourceMode: boolean) => {\n if (isSourceMode) {\n setSourceCode(tiptapEditor.getHTML());\n } else {\n // emitUpdate so onChange fires and required-field state\n // refreshes immediately (fixes image-only bodies added via\n // source mode being flagged \"Cannot be blank\" until keystroke).\n tiptapEditor.commands.setContent(sourceCode, { emitUpdate: true });\n // Commit point: fires blur handlers (e.g. changeNblur/PATCH) without requiring the user to click outside.\n onBlur?.();\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 editAriaLabel={t('rte_edit_image', [currentImageAttrs?.alt || ''])}\n deleteAriaLabel={t('rte_delete_image', [currentImageAttrs?.alt || ''])}\n editTooltip={t('edit')}\n deleteTooltip={t('delete')}\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":["../../../src/components/Editor/Editor.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AC,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\n// Uses Tiptap's isEmpty so leaf/atom nodes (images, hr, tables) count as content —\n// getText() alone returns '' for an image-only doc and would misreport it as blank.\nconst editorHasContent = (editor: TiptapEditor | undefined | null): boolean =>\n editor ? !editor.isEmpty : false;\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(editorHasContent(tiptapEditor));\n },\n onChange: editor => {\n onContentChange(editorHasContent(editor));\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 progress,\n autoFocus,\n height,\n autoResize = true,\n secure = 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 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 // 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 => {\n const next = e.target.value;\n setSourceCode(next);\n // Keep Tiptap in sync while editing source so parent components\n // reading getHtml()/isEmpty (e.g. required-field validation on\n // blur) see the latest content instead of the pre-toggle doc.\n tiptapEditor?.commands.setContent(next, { emitUpdate: true });\n }}\n onBlur={e => {\n // Tiptap is hidden in source mode and never held focus, so we bridge blur; ignore intra-editor focus moves.\n const nextFocus = e.relatedTarget as Node | null;\n if (nextFocus && editorContainerRef.current?.contains(nextFocus)) return;\n onBlur?.();\n }}\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 renderSuggestionEditor={renderSuggestionEditor}\n sourceMode={sourceMode}\n onSourceModeToggle={(isSourceMode: boolean) => {\n if (isSourceMode) {\n setSourceCode(tiptapEditor.getHTML());\n } else {\n // emitUpdate so onChange fires and required-field state\n // refreshes immediately (fixes image-only bodies added via\n // source mode being flagged \"Cannot be blank\" until keystroke).\n tiptapEditor.commands.setContent(sourceCode, { emitUpdate: true });\n // Commit point: fires blur handlers (e.g. changeNblur/PATCH) without requiring the user to click outside.\n onBlur?.();\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 editAriaLabel={t('rte_edit_image', [currentImageAttrs?.alt || ''])}\n deleteAriaLabel={t('rte_delete_image', [currentImageAttrs?.alt || ''])}\n editTooltip={t('edit')}\n deleteTooltip={t('delete')}\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"]}
@@ -44,7 +44,10 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
44
44
  onImageAdded?: (image: File, id: string, altText?: string) => void;
45
45
  /** A callback for when the editor is finished initializing */
46
46
  onInit?: (editor: TiptapEditor) => void;
47
- /** A callback that runs when the iframe is about to unload, useful for saving editor state */
47
+ /**
48
+ * @deprecated
49
+ * A callback that runs when the iframe is about to unload, useful for saving editor state
50
+ */
48
51
  onUnload?: (value: string) => void;
49
52
  /** Standard placeholder for an input */
50
53
  placeholder?: string;
@@ -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,EAA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tD,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,qIAAqI;IACrI,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -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 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 /** 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"]}
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 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 /**\n * @deprecated\n * A callback that runs when the iframe is about to unload, useful for saving editor state\n */\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 /** 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-rte",
3
- "version": "9.27.2",
3
+ "version": "9.27.4",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "Pegasystems",
6
6
  "sideEffects": false,
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@intevation/tiptap-extension-office-paste": "^0.1.2",
18
- "@pega/cosmos-react-core": "9.27.2",
18
+ "@pega/cosmos-react-core": "9.27.4",
19
19
  "@popperjs/core": "^2.11.6",
20
20
  "@tiptap/core": "^3.12.1",
21
21
  "@tiptap/extension-blockquote": "^3.12.1",