@pega/cosmos-react-rte 9.0.0-build.9.9 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +4 -2
  2. package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
  3. package/lib/components/DynamicContentEditor/DynamicContentEditor.js +64 -59
  4. package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
  5. package/lib/components/Editor/Editor.context.d.ts +6 -6
  6. package/lib/components/Editor/Editor.context.d.ts.map +1 -1
  7. package/lib/components/Editor/Editor.context.js +1 -1
  8. package/lib/components/Editor/Editor.context.js.map +1 -1
  9. package/lib/components/Editor/Editor.d.ts +1 -10
  10. package/lib/components/Editor/Editor.d.ts.map +1 -1
  11. package/lib/components/Editor/Editor.js +301 -490
  12. package/lib/components/Editor/Editor.js.map +1 -1
  13. package/lib/components/Editor/Editor.styles.d.ts +37 -7
  14. package/lib/components/Editor/Editor.styles.d.ts.map +1 -1
  15. package/lib/components/Editor/Editor.styles.js +60 -30
  16. package/lib/components/Editor/Editor.styles.js.map +1 -1
  17. package/lib/components/Editor/Editor.test-ids.d.ts +2 -1
  18. package/lib/components/Editor/Editor.test-ids.d.ts.map +1 -1
  19. package/lib/components/Editor/Editor.test-ids.js +2 -0
  20. package/lib/components/Editor/Editor.test-ids.js.map +1 -1
  21. package/lib/components/Editor/Editor.types.d.ts +34 -14
  22. package/lib/components/Editor/Editor.types.d.ts.map +1 -1
  23. package/lib/components/Editor/Editor.types.js.map +1 -1
  24. package/lib/components/Editor/IframeTiptapEditor.d.ts +30 -0
  25. package/lib/components/Editor/IframeTiptapEditor.d.ts.map +1 -0
  26. package/lib/components/Editor/IframeTiptapEditor.js +695 -0
  27. package/lib/components/Editor/IframeTiptapEditor.js.map +1 -0
  28. package/lib/components/Editor/ImageActionButtons.d.ts +20 -0
  29. package/lib/components/Editor/ImageActionButtons.d.ts.map +1 -0
  30. package/lib/components/Editor/ImageActionButtons.js +84 -0
  31. package/lib/components/Editor/ImageActionButtons.js.map +1 -0
  32. package/lib/components/Editor/ImageEditDialog.d.ts +17 -0
  33. package/lib/components/Editor/ImageEditDialog.d.ts.map +1 -0
  34. package/lib/components/Editor/ImageEditDialog.js +90 -0
  35. package/lib/components/Editor/ImageEditDialog.js.map +1 -0
  36. package/lib/components/Editor/TableCellMenu.d.ts +35 -0
  37. package/lib/components/Editor/TableCellMenu.d.ts.map +1 -0
  38. package/lib/components/Editor/TableCellMenu.js +120 -0
  39. package/lib/components/Editor/TableCellMenu.js.map +1 -0
  40. package/lib/components/Editor/Toolbar/AIRewriteButton.d.ts +17 -0
  41. package/lib/components/Editor/Toolbar/AIRewriteButton.d.ts.map +1 -0
  42. package/lib/components/Editor/Toolbar/AIRewriteButton.js +79 -0
  43. package/lib/components/Editor/Toolbar/AIRewriteButton.js.map +1 -0
  44. package/lib/components/Editor/Toolbar/AlignmentSelect.d.ts +8 -0
  45. package/lib/components/Editor/Toolbar/AlignmentSelect.d.ts.map +1 -0
  46. package/lib/components/Editor/Toolbar/AlignmentSelect.js +137 -0
  47. package/lib/components/Editor/Toolbar/AlignmentSelect.js.map +1 -0
  48. package/lib/components/Editor/Toolbar/AnchorButton.d.ts +3 -4
  49. package/lib/components/Editor/Toolbar/AnchorButton.d.ts.map +1 -1
  50. package/lib/components/Editor/Toolbar/AnchorButton.js +156 -82
  51. package/lib/components/Editor/Toolbar/AnchorButton.js.map +1 -1
  52. package/lib/components/Editor/Toolbar/ColorPickerButton.d.ts +9 -0
  53. package/lib/components/Editor/Toolbar/ColorPickerButton.d.ts.map +1 -0
  54. package/lib/components/Editor/Toolbar/ColorPickerButton.js +190 -0
  55. package/lib/components/Editor/Toolbar/ColorPickerButton.js.map +1 -0
  56. package/lib/components/Editor/Toolbar/FontFamilySelect.d.ts +8 -0
  57. package/lib/components/Editor/Toolbar/FontFamilySelect.d.ts.map +1 -0
  58. package/lib/components/Editor/Toolbar/FontFamilySelect.js +150 -0
  59. package/lib/components/Editor/Toolbar/FontFamilySelect.js.map +1 -0
  60. package/lib/components/Editor/Toolbar/FontSizeSelect.d.ts +8 -0
  61. package/lib/components/Editor/Toolbar/FontSizeSelect.d.ts.map +1 -0
  62. package/lib/components/Editor/Toolbar/FontSizeSelect.js +145 -0
  63. package/lib/components/Editor/Toolbar/FontSizeSelect.js.map +1 -0
  64. package/lib/components/Editor/Toolbar/ImageButton.d.ts +5 -5
  65. package/lib/components/Editor/Toolbar/ImageButton.d.ts.map +1 -1
  66. package/lib/components/Editor/Toolbar/ImageButton.js +131 -18
  67. package/lib/components/Editor/Toolbar/ImageButton.js.map +1 -1
  68. package/lib/components/Editor/Toolbar/SourceCodeButton.d.ts +8 -0
  69. package/lib/components/Editor/Toolbar/SourceCodeButton.d.ts.map +1 -0
  70. package/lib/components/Editor/Toolbar/SourceCodeButton.js +49 -0
  71. package/lib/components/Editor/Toolbar/SourceCodeButton.js.map +1 -0
  72. package/lib/components/Editor/Toolbar/TableButton.d.ts +8 -0
  73. package/lib/components/Editor/Toolbar/TableButton.d.ts.map +1 -0
  74. package/lib/components/Editor/Toolbar/TableButton.js +291 -0
  75. package/lib/components/Editor/Toolbar/TableButton.js.map +1 -0
  76. package/lib/components/Editor/Toolbar/TextSelect.d.ts +4 -5
  77. package/lib/components/Editor/Toolbar/TextSelect.d.ts.map +1 -1
  78. package/lib/components/Editor/Toolbar/TextSelect.js +61 -30
  79. package/lib/components/Editor/Toolbar/TextSelect.js.map +1 -1
  80. package/lib/components/Editor/Toolbar/Toolbar.d.ts +17 -6
  81. package/lib/components/Editor/Toolbar/Toolbar.d.ts.map +1 -1
  82. package/lib/components/Editor/Toolbar/Toolbar.js +169 -47
  83. package/lib/components/Editor/Toolbar/Toolbar.js.map +1 -1
  84. package/lib/components/Editor/Toolbar/Toolbar.test-ids.d.ts +2 -2
  85. package/lib/components/Editor/Toolbar/Toolbar.test-ids.d.ts.map +1 -1
  86. package/lib/components/Editor/Toolbar/Toolbar.test-ids.js +17 -1
  87. package/lib/components/Editor/Toolbar/Toolbar.test-ids.js.map +1 -1
  88. package/lib/components/Editor/Toolbar/WordCount.d.ts +8 -0
  89. package/lib/components/Editor/Toolbar/WordCount.d.ts.map +1 -0
  90. package/lib/components/Editor/Toolbar/WordCount.js +31 -0
  91. package/lib/components/Editor/Toolbar/WordCount.js.map +1 -0
  92. package/lib/components/Editor/extensions/FontSize.d.ts +21 -0
  93. package/lib/components/Editor/extensions/FontSize.d.ts.map +1 -0
  94. package/lib/components/Editor/extensions/FontSize.js +42 -0
  95. package/lib/components/Editor/extensions/FontSize.js.map +1 -0
  96. package/lib/components/Editor/extensions/PreserveDiv.d.ts +13 -0
  97. package/lib/components/Editor/extensions/PreserveDiv.d.ts.map +1 -0
  98. package/lib/components/Editor/extensions/PreserveDiv.js +73 -0
  99. package/lib/components/Editor/extensions/PreserveDiv.js.map +1 -0
  100. package/lib/components/Editor/extensions/TableCellSelection.d.ts +4 -0
  101. package/lib/components/Editor/extensions/TableCellSelection.d.ts.map +1 -0
  102. package/lib/components/Editor/extensions/TableCellSelection.js +53 -0
  103. package/lib/components/Editor/extensions/TableCellSelection.js.map +1 -0
  104. package/lib/components/Editor/extensions/TextIndent.d.ts +22 -0
  105. package/lib/components/Editor/extensions/TextIndent.d.ts.map +1 -0
  106. package/lib/components/Editor/extensions/TextIndent.js +137 -0
  107. package/lib/components/Editor/extensions/TextIndent.js.map +1 -0
  108. package/lib/components/Editor/hooks/useCloseOnEditorClick.d.ts +5 -0
  109. package/lib/components/Editor/hooks/useCloseOnEditorClick.d.ts.map +1 -0
  110. package/lib/components/Editor/hooks/useCloseOnEditorClick.js +18 -0
  111. package/lib/components/Editor/hooks/useCloseOnEditorClick.js.map +1 -0
  112. package/lib/components/Editor/hooks/useEscapeKey.d.ts +4 -0
  113. package/lib/components/Editor/hooks/useEscapeKey.d.ts.map +1 -0
  114. package/lib/components/Editor/hooks/useEscapeKey.js +24 -0
  115. package/lib/components/Editor/hooks/useEscapeKey.js.map +1 -0
  116. package/lib/components/Editor/hooks/useIframeSetup.d.ts +54 -0
  117. package/lib/components/Editor/hooks/useIframeSetup.d.ts.map +1 -0
  118. package/lib/components/Editor/hooks/useIframeSetup.js +284 -0
  119. package/lib/components/Editor/hooks/useIframeSetup.js.map +1 -0
  120. package/lib/components/Editor/hooks/useImageActions.d.ts +19 -0
  121. package/lib/components/Editor/hooks/useImageActions.d.ts.map +1 -0
  122. package/lib/components/Editor/hooks/useImageActions.js +198 -0
  123. package/lib/components/Editor/hooks/useImageActions.js.map +1 -0
  124. package/lib/components/Editor/hooks/useTableCellMenu.d.ts +22 -0
  125. package/lib/components/Editor/hooks/useTableCellMenu.d.ts.map +1 -0
  126. package/lib/components/Editor/hooks/useTableCellMenu.js +120 -0
  127. package/lib/components/Editor/hooks/useTableCellMenu.js.map +1 -0
  128. package/lib/components/Editor/iframeContentStyles.d.ts +10 -0
  129. package/lib/components/Editor/iframeContentStyles.d.ts.map +1 -0
  130. package/lib/components/Editor/iframeContentStyles.js +162 -0
  131. package/lib/components/Editor/iframeContentStyles.js.map +1 -0
  132. package/lib/components/Editor/index.d.ts +2 -0
  133. package/lib/components/Editor/index.d.ts.map +1 -1
  134. package/lib/components/Editor/index.js +1 -0
  135. package/lib/components/Editor/index.js.map +1 -1
  136. package/lib/components/Editor/sanitize.d.ts +3 -0
  137. package/lib/components/Editor/sanitize.d.ts.map +1 -0
  138. package/lib/components/Editor/sanitize.js +11 -0
  139. package/lib/components/Editor/sanitize.js.map +1 -0
  140. package/lib/components/Editor/utils/htmlPlaceholder.d.ts +69 -0
  141. package/lib/components/Editor/utils/htmlPlaceholder.d.ts.map +1 -0
  142. package/lib/components/Editor/utils/htmlPlaceholder.js +154 -0
  143. package/lib/components/Editor/utils/htmlPlaceholder.js.map +1 -0
  144. package/lib/components/RichTextEditor/DecoratorComponents/Table.d.ts +6 -4
  145. package/lib/components/RichTextEditor/DecoratorComponents/Table.d.ts.map +1 -1
  146. package/lib/components/RichTextEditor/DecoratorComponents/Table.js +10 -8
  147. package/lib/components/RichTextEditor/DecoratorComponents/Table.js.map +1 -1
  148. package/lib/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  149. package/lib/components/RichTextEditor/RichTextEditor.js +15 -2
  150. package/lib/components/RichTextEditor/RichTextEditor.js.map +1 -1
  151. package/lib/components/RichTextEditor/RichTextEditor.styles.d.ts +5 -5
  152. package/lib/components/RichTextEditor/RichTextEditor.styles.d.ts.map +1 -1
  153. package/lib/components/RichTextEditor/RichTextEditor.styles.js +3 -5
  154. package/lib/components/RichTextEditor/RichTextEditor.styles.js.map +1 -1
  155. package/lib/components/RichTextEditor/RichTextEditor.types.d.ts +5 -0
  156. package/lib/components/RichTextEditor/RichTextEditor.types.d.ts.map +1 -1
  157. package/lib/components/RichTextEditor/RichTextEditor.types.js.map +1 -1
  158. package/lib/components/RichTextEditor/RichTextViewer.d.ts.map +1 -1
  159. package/lib/components/RichTextEditor/RichTextViewer.js +9 -2
  160. package/lib/components/RichTextEditor/RichTextViewer.js.map +1 -1
  161. package/lib/components/RichTextEditor/Toolbar/Toolbar.js +1 -1
  162. package/lib/components/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  163. package/lib/components/RichTextEditor/Toolbar/Toolbar.types.d.ts +4 -4
  164. package/lib/components/RichTextEditor/Toolbar/Toolbar.types.d.ts.map +1 -1
  165. package/lib/components/RichTextEditor/Toolbar/Toolbar.types.js.map +1 -1
  166. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.d.ts.map +1 -1
  167. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.js +41 -26
  168. package/lib/components/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
  169. package/lib/components/RichTextEditor/utils/htmlConverter.d.ts +2 -0
  170. package/lib/components/RichTextEditor/utils/htmlConverter.d.ts.map +1 -1
  171. package/lib/components/RichTextEditor/utils/htmlConverter.js +12 -0
  172. package/lib/components/RichTextEditor/utils/htmlConverter.js.map +1 -1
  173. package/lib/components/RichTextEditor/utils/interactionRenderer.d.ts.map +1 -1
  174. package/lib/components/RichTextEditor/utils/interactionRenderer.js +20 -19
  175. package/lib/components/RichTextEditor/utils/interactionRenderer.js.map +1 -1
  176. package/lib/components/RichTextEditor/utils/markdownConverter.d.ts.map +1 -1
  177. package/lib/components/RichTextEditor/utils/markdownConverter.js +131 -30
  178. package/lib/components/RichTextEditor/utils/markdownConverter.js.map +1 -1
  179. package/lib/components/RichTextEditor/utils/renderers.d.ts +5 -3
  180. package/lib/components/RichTextEditor/utils/renderers.d.ts.map +1 -1
  181. package/lib/components/RichTextEditor/utils/renderers.js +62 -34
  182. package/lib/components/RichTextEditor/utils/renderers.js.map +1 -1
  183. package/lib/components/RichTextEditor/utils/slateConverter.d.ts +4 -3
  184. package/lib/components/RichTextEditor/utils/slateConverter.d.ts.map +1 -1
  185. package/lib/components/RichTextEditor/utils/slateConverter.js +86 -38
  186. package/lib/components/RichTextEditor/utils/slateConverter.js.map +1 -1
  187. package/package.json +30 -8
  188. package/lib/components/Editor/ImageEditor.d.ts +0 -10
  189. package/lib/components/Editor/ImageEditor.d.ts.map +0 -1
  190. package/lib/components/Editor/ImageEditor.js +0 -292
  191. package/lib/components/Editor/ImageEditor.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":";;AAAA,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAEtC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,yBAAyB,CAAC;AACjC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0BAA0B,CAAC;AAClC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,OAAO,EACR,MAAM,OA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,EAC1B,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChB,eAAe,CAAC,KAAK,CAAC,CAAC;YACvB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACtB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import tinymce from 'tinymce/tinymce';\nimport type { Editor as TinymceEditor, EditorEvent } from 'tinymce/tinymce';\nimport 'tinymce/icons/default';\nimport 'tinymce/themes/silver';\nimport 'tinymce/plugins/advlist';\nimport 'tinymce/plugins/lists';\nimport 'tinymce/plugins/autolink';\nimport 'tinymce/models/dom';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useLayoutEffect,\n useImperativeHandle,\n useCallback,\n useMemo\n} from 'react';\nimport type { PropsWithoutRef, FocusEvent } from 'react';\nimport { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { compile, serialize, stringify } from 'stylis';\nimport { mix, stripUnit } from 'polished';\n\nimport {\n createUID,\n FormControl,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useI18n,\n useConsolidatedRef,\n useAutoResize,\n useConfiguration,\n useTestIds,\n withTestIds,\n documentIsAvailable,\n getActiveElement\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { getHtmlStyles } from '@pega/cosmos-react-core/lib/components/HTML/HTML';\nimport {\n createGlobalBodyStyles,\n createGlobalRootStyles,\n globalSpacingStyles\n} from '@pega/cosmos-react-core/lib/styles/GlobalStyle';\n\nimport StyledRichTextEditor from '../RichTextEditor/RichTextEditor.styles';\n\nimport Toolbar from './Toolbar/Toolbar';\nimport EditorContext from './Editor.context';\nimport { getTextFormats } from './Toolbar/TextSelect';\nimport type { CustomComponent, EditorProps } from './Editor.types';\nimport ImageEditor, { imgHoverClass } from './ImageEditor';\nimport {\n offscreenSelectionStyles,\n mceContentBodyStyles,\n StyledEditorContainer,\n StyledEditorRoot\n} from './Editor.styles';\nimport { getEditorTestIds } from './Editor.test-ids';\nimport createFileItemElement from './FileItemElement';\n\ntype ImageInfoArray = { id: string; url: string; name: string }[];\n\nconst getFileFromUrl = async (url: string, name: string) => {\n const response = await fetch(url);\n const data = await response.blob();\n return new File([data], name, {\n type: data.type\n });\n};\n\nexport const getImageStyles = (theme: DefaultTheme) => {\n return `\n img:hover,\n img.${imgHoverClass} {\n box-shadow: 0 0 0 0.06125rem ${theme.base.palette['primary-background']},\n 0 0 0 0.125rem ${theme.base.palette.interactive}, 0 0 0 0.25rem rgba(0, 118, 209, 0.3);\n }\n `;\n};\n\nexport const getPlaceholderStyles = (theme: DefaultTheme) => {\n return `\n .mce-content-body[data-mce-placeholder] {\n position: relative;\n }\n\n .mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {\n cursor: text;\n color: ${mix(\n theme.base.transparency['transparent-3'],\n theme.base.palette['foreground-color'],\n theme.components['form-control']['background-color']\n )};\n content: attr(data-mce-placeholder);\n position: absolute;\n }\n `;\n};\n\nconst Editor: ForwardRefForwardPropsComponent<EditorProps & { onUnload: (value: string) => void }> =\n forwardRef(function Editor(\n props: PropsWithoutRef<EditorProps & { onUnload: (value: string) => void }>,\n ref: EditorProps['ref']\n ) {\n const theme = useTheme();\n const {\n components: {\n 'text-area': { 'min-height': textAreaMinHeight }\n }\n } = theme;\n const { styleSheetTarget } = useConfiguration();\n const [editor, setEditor] = useState<TinymceEditor>();\n const [focused, setFocused] = useState(false);\n const t = useI18n();\n const uid = useUID();\n const labelId = useUID();\n const editorRef = useConsolidatedRef(ref);\n const tinyMceRef = useRef<HTMLTextAreaElement>(null);\n const tinyMceContainerRef = useRef<HTMLDivElement>(null);\n const initialized = useRef(false);\n\n const pastedImages = useRef<File[]>([]);\n\n const {\n testId,\n id = uid,\n toolbar = [],\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 customComponents = [],\n height,\n autoResize = true,\n customActions,\n placeholder,\n children,\n spellcheck = true,\n additionalInfo,\n initOptions,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getEditorTestIds);\n\n const baseHeight: EditorProps['height'] = {\n min: height?.min ?? (stripUnit(textAreaMinHeight) as number) * 16,\n max: height?.max ?? undefined\n };\n const getHeight = (type: 'max' | 'min') => {\n if (typeof baseHeight === 'number') {\n return stripUnit(baseHeight) as number;\n }\n if (baseHeight[type]) {\n return stripUnit(baseHeight[type] as number) as number;\n }\n return undefined;\n };\n\n const imagesEnabled = toolbar.includes('images');\n const maxHeight = autoResize ? getHeight('max') : undefined;\n const minHeight = autoResize ? getHeight('min') : undefined;\n const [autoResizeRef, resizeEditor] = useAutoResize<HTMLIFrameElement>(maxHeight, minHeight);\n const formFieldRef = useRef<HTMLElement>(null);\n const value = useRef(defaultValue);\n const customActionsLength = customActions?.length ?? 0;\n const renderToolbar =\n editor && (toolbar.length > 0 || customActionsLength > 0) && !readOnly && !disabled;\n\n const processPastedImgUrls = async (infoArr: ImageInfoArray) => {\n const files = await Promise.all(\n infoArr.map(({ id: imgId, url }) => getFileFromUrl(url, imgId))\n );\n files.forEach((file, i) => {\n onImageAdded?.(file, infoArr[i].id);\n });\n };\n\n const pastePreprocess = (plugin: unknown, args: { content: string }) => {\n const isImg = args.content.includes('<img');\n if (!imagesEnabled && isImg) {\n args.content = args.content.replace(/<img(.*)\\/>/g, '');\n }\n if (imagesEnabled && isImg) {\n const pastedHtml: HTMLElement = new DOMParser().parseFromString(\n args.content,\n 'text/html'\n ).body;\n const imgInfo: ImageInfoArray = [];\n pastedHtml.querySelectorAll('img').forEach(imgEl => {\n const imgId = createUID();\n const url = imgEl.src;\n const name = pastedImages.current.shift()?.name || id;\n imgInfo.push({ id: imgId, url, name });\n const uploadEl = document.createElement('pega-file');\n uploadEl.setAttribute('data-id', imgId);\n uploadEl.setAttribute('data-name', name);\n uploadEl.setAttribute('data-url', url);\n uploadEl.setAttribute('data-progress', '0');\n uploadEl.setAttribute('contenteditable', 'false');\n const uploadElString = `<br/>${uploadEl.outerHTML}<br/>`;\n const uploadElHtml = new DOMParser().parseFromString(uploadElString, 'text/html').body;\n\n imgEl.replaceWith(uploadElHtml);\n });\n args.content = pastedHtml.innerHTML;\n processPastedImgUrls(imgInfo);\n }\n };\n\n useImperativeHandle(\n editorRef,\n () => ({\n focus: () => {\n editor?.focus();\n },\n getPlainText: () => {\n return editor ? editor.getContent({ format: 'text' }) : '';\n },\n getRichText: () => {\n return editor ? JSON.stringify(editor.getContent({ format: 'raw' })) : '';\n },\n getHtml: () => {\n return editor ? editor.getContent({ format: 'html' }) : '';\n },\n clear: () => {\n editor?.setContent('');\n },\n updateAttachmentAttributes: (imageId, progress, error) => {\n if (editor) {\n const editorEl = editor.getDoc();\n const imageCustomEl = editorEl.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n if (imageCustomEl) {\n if (error) imageCustomEl.setAttribute('data-error', error);\n else if (progress) imageCustomEl.setAttribute('data-progress', `${progress}`);\n }\n }\n },\n appendImage: ({ src, alt, attachmentId }, imageId) => {\n if (editor) {\n const editorEl = editor.getDoc();\n const imageUploadEl = editorEl.querySelector(`pega-file[data-id=\"${imageId}\"]`);\n\n if (imageUploadEl) {\n const imgEl = editorEl.createElement('img');\n imgEl.setAttribute('src', src);\n imgEl.setAttribute('alt', alt);\n if (attachmentId) {\n imgEl.setAttribute('data-attachment-id', attachmentId);\n }\n imageUploadEl.replaceWith(imgEl);\n imageUploadEl?.remove();\n if (autoResize) resizeEditor();\n }\n }\n },\n insertText: (text: string) => {\n let activeElement: Element | null = null;\n if (documentIsAvailable) {\n activeElement = getActiveElement();\n }\n editor?.insertContent(text);\n\n if (activeElement) (activeElement as HTMLElement).focus();\n },\n setCursorLocationToStart: () => {\n editor?.selection.setCursorLocation();\n editor?.selection.getNode().scrollIntoView();\n },\n insertHtml: (html: string, overwrite: boolean = false) => {\n if (overwrite && html === editor?.getContent({ format: 'html' })) return;\n\n let activeElement: Element | null = null;\n if (documentIsAvailable) {\n activeElement = getActiveElement();\n }\n if (overwrite) {\n editor?.setContent('');\n }\n if (readOnly || disabled) {\n editor?.setContent(html);\n } else {\n editor?.insertContent(html);\n }\n\n if (activeElement) (activeElement as HTMLElement).focus();\n },\n getEditor: () => {\n return editor;\n },\n element: formFieldRef.current || undefined\n }),\n [editor]\n );\n\n useLayoutEffect(() => {\n if (!tinyMceRef.current || !tinyMceContainerRef.current) return;\n const styles = serialize(compile(getHtmlStyles(theme)), stringify);\n const imageStyles = serialize(compile(getImageStyles(theme)), stringify);\n const placeholderStyles = serialize(compile(getPlaceholderStyles(theme)), stringify);\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 const contentStyle = `\n ${createGlobalRootStyles(theme)}\n ${globalSpacingStyles}\n ${createGlobalBodyStyles(theme)}\n\n html {\n overflow: hidden;\n }\n\n body {\n min-height: 3rem;\n padding: ${theme.base.spacing};\n background: unset;\n }\n\n ${offscreenSelectionStyles}\n ${mceContentBodyStyles}\n ${placeholderStyles}\n ${imageStyles}\n ${styles}\n ${initOptions?.contentStyle}\n `;\n\n const customElements: CustomComponent[] = [\n {\n createCustomElement: createFileItemElement,\n name: 'pega-file',\n style: FileItemStyle.toString(),\n extensionAttributes: ['contenteditable']\n },\n ...customComponents\n ];\n\n tinymce\n .init({\n readonly: readOnly || disabled,\n skin: false,\n target: tinyMceRef.current,\n toolbar: false,\n min_height: 60,\n height: 60,\n menubar: false,\n plugins: 'lists advlist autolink',\n paste_block_drop: true,\n paste_data_images: initOptions?.pasteDataImages ?? true,\n lists_indent_on_tab: true,\n text_patterns: initOptions?.textPatterns,\n icons: '',\n branding: false,\n elementpath: false,\n placeholder,\n content_css: false,\n browser_spellcheck: spellcheck,\n relative_urls: false,\n remove_script_host: false,\n paste_preprocess: pastePreprocess,\n convert_unsafe_embeds: true,\n sandbox_iframes: true,\n paste_as_text: initOptions?.pasteAsText,\n init_instance_callback: initializedEditor => {\n if (initOptions?.initInstanceCallback) {\n initOptions.initInstanceCallback(initializedEditor);\n }\n if (typeof label === 'string') {\n initializedEditor.getBody().setAttribute('aria-label', label);\n }\n const iframeWindow = (\n tinyMceContainerRef.current?.querySelector('iframe') as HTMLIFrameElement\n ).contentWindow;\n const editorCustomElements = iframeWindow?.customElements;\n\n // Manually add content style to allow setting nonce attribute\n const contentStyleEl = document.createElement('style');\n contentStyleEl.innerText = contentStyle;\n contentStyleEl.nonce = window.__webpack_nonce__;\n initializedEditor.getDoc().head.appendChild(contentStyleEl);\n\n if (editorCustomElements) {\n customElements.forEach(\n ({ name, createCustomElement: customElementCreator, style }) => {\n if (!editorCustomElements.get(name)) {\n editorCustomElements.define(\n name,\n customElementCreator(iframeWindow as unknown as typeof globalThis)\n );\n }\n if (style) {\n const customElementStyleEl = document.createElement('style');\n customElementStyleEl.innerText = style;\n customElementStyleEl.nonce = window.__webpack_nonce__;\n initializedEditor.getDoc().head.appendChild(customElementStyleEl);\n }\n }\n );\n }\n },\n extended_valid_elements: `${customElements\n .map(\n comp =>\n `${comp.name}${\n comp.extensionAttributes ? `[${comp.extensionAttributes.join('|')}]` : ''\n }`\n )\n .join(',')}`,\n custom_elements: customElements.map(comp => `~${comp.name}`).join('~,'),\n invalid_elements: 'iframe',\n setup: editorSettings => {\n editorSettings.on('keydown', e => {\n const activeElement = editorSettings?.getDoc().activeElement;\n if (e.key === 'Enter' && activeElement?.nodeName === 'PEGA-FILE') {\n e.preventDefault();\n const bookmark = editorSettings.selection.getBookmark();\n activeElement.shadowRoot?.querySelector('button')?.click();\n editorSettings?.selection.moveToBookmark(bookmark);\n } else onKeyDown?.(e);\n });\n getTextFormats(t).forEach((format, i) => {\n editorSettings.addShortcut(\n `meta+alt+${i}`,\n `${t('rte_change_text_format')} ${format.text}`,\n () => {\n editorSettings.execCommand('FormatBlock', false, format.type);\n }\n );\n });\n editorSettings.addShortcut('meta+shift+b', t('rte_bold'), () => {\n editorSettings.execCommand('Bold');\n });\n editorSettings.addShortcut('meta+shift+i', t('rte_italic'), () => {\n editorSettings.execCommand('Italic');\n });\n editorSettings.addShortcut('meta+shift+x', t('rte_strike_through'), () => {\n editorSettings.execCommand('Strikethrough');\n });\n editorSettings.addShortcut('meta+shift+l', t('rte_toggle_unordered_list'), () => {\n editorSettings.execCommand('InsertUnorderedList');\n });\n editorSettings.addShortcut('alt+m', t('rte_indent_selection'), () => {\n editorSettings.execCommand('Indent');\n });\n editorSettings.addShortcut('alt+shift+m', t('rte_unindent_selection'), () => {\n editorSettings.execCommand('Outdent');\n });\n customActions?.forEach(action => {\n if (action.shortcut) {\n editorSettings.addShortcut(\n action.shortcut.pattern,\n action.shortcut.description,\n () => {\n action.shortcut?.command(editorSettings);\n }\n );\n }\n });\n }\n })\n .then(tinymceEditors => {\n setEditor(tinymceEditors[0]);\n tinymceEditors[0]?.editorContainer?.removeAttribute('style');\n const iframe = tinyMceContainerRef.current?.querySelector('iframe');\n if (iframe) {\n const globalStyles =\n styleSheetTarget?.querySelectorAll('[data-cosmos-global-style]') ??\n ([] as HTMLElement[]);\n const extraStyles =\n document.querySelectorAll('[data-cosmos-global-style]') ?? ([] as HTMLElement[]);\n const iframeContentHead = iframe?.contentDocument?.querySelector('head');\n [...globalStyles, ...extraStyles].forEach(sheet => {\n iframeContentHead?.appendChild(sheet.cloneNode(true));\n });\n autoResizeRef.current = iframe;\n\n if (autoResize) resizeEditor();\n }\n });\n }, []);\n\n useEffect(() => {\n if (editor) {\n editor.options.set('paste_preprocess', pastePreprocess);\n }\n }, [imagesEnabled]);\n\n useEffect(() => {\n if (!editor) return;\n const onChangeEvents = ['input', 'paste', 'FormatApply', 'FormatRemove', 'ExecCommand'];\n const onEditorKeyDown = () => {\n const activeElement = editor.selection.getNode();\n if (activeElement.nodeName === 'PEGA-FILE') {\n (\n activeElement.shadowRoot?.querySelector('button[aria-label*=\"Cancel\"]') as HTMLElement\n )?.focus();\n }\n\n if (autoResize) resizeEditor();\n };\n const onEditorChange = (\n event: EditorEvent<Event & { command?: string; clipboardData?: { files: File[] } }>\n ) => {\n if (event.type === 'paste' && event.clipboardData?.files) {\n pastedImages.current = Array.from(event.clipboardData?.files);\n }\n if (event.type !== 'execcommand' || event.command !== 'mceFocus') {\n onChange?.(editor);\n }\n };\n const onEditorFocus = () => {\n setFocused(true);\n onFocus?.();\n };\n const onEditorBlur = () => {\n setFocused(false);\n onBlur?.();\n };\n onChangeEvents.forEach(event => {\n editor.on(event, onEditorChange);\n });\n editor.on('keydown', onEditorKeyDown);\n if (autoResize) editor.on('paste', resizeEditor);\n\n editor.on('focus', onEditorFocus);\n editor.on('blur', onEditorBlur);\n return () => {\n onChangeEvents.forEach(event => {\n editor.off(event, onEditorChange);\n });\n editor.off('keydown', onEditorKeyDown);\n if (autoResize) editor.off('paste', resizeEditor);\n editor.off('focus', onEditorFocus);\n editor.off('blur', onEditorBlur);\n };\n }, [editor, onFocus, onBlur]);\n\n useEffect(() => {\n if (!editor || initialized.current) return;\n initialized.current = true;\n onInit?.(editor);\n }, [editor, onInit]);\n\n useAfterInitialEffect(() => {\n editor?.mode.set(readOnly || disabled ? 'readonly' : 'design');\n }, [readOnly, disabled]);\n\n const addImage = useCallback(\n (image: File, imageId?: string) => {\n if (editor) {\n const imageUid = imageId ?? createUID();\n editor.insertContent(\n `<br/><pega-file data-id='${imageUid}' data-progress='0' data-name='${image.name}' > </pega-file><br/>`\n );\n onImageAdded?.(image, imageUid);\n }\n },\n [editor]\n );\n\n const ctx = useMemo(\n () => ({ addImage, editor: editor || ({} as TinymceEditor) }),\n [editor, addImage]\n );\n\n useEffect(() => {\n const onEditorDrop = (e: DragEvent) => {\n e.preventDefault();\n if (e.dataTransfer) {\n Array.from(e.dataTransfer.files).forEach(file => {\n if (file.type.includes('image') && imagesEnabled) {\n addImage(file);\n }\n });\n }\n };\n editor?.on('drop', onEditorDrop);\n const body = editor?.getDoc().body;\n let resizeObserver: ResizeObserver | undefined;\n\n if (autoResize) {\n resizeObserver = new ResizeObserver(() => {\n resizeEditor();\n });\n if (body) {\n resizeObserver.observe(body);\n }\n }\n\n return () => {\n editor?.off('drop', onEditorDrop);\n\n resizeObserver?.disconnect();\n };\n }, [editor, resizeEditor]);\n\n useEffect(() => {\n if (!editor || !autoResize) return;\n\n const imgEls = editor.getDoc().querySelectorAll('img');\n\n imgEls.forEach(imgEl => {\n imgEl.addEventListener('load', resizeEditor);\n imgEl.addEventListener('error', resizeEditor);\n });\n\n return () => {\n imgEls.forEach(imgEl => {\n imgEl.removeEventListener('load', resizeEditor);\n imgEl.removeEventListener('error', resizeEditor);\n });\n };\n });\n\n useEffect(() => {\n if (!editor) return;\n\n const body = editor.getBody();\n\n const mutationObserver = new MutationObserver(() => {\n if (body.hasAttribute('aria-placeholder')) {\n body.removeAttribute('aria-placeholder');\n }\n });\n\n mutationObserver.observe(body, { attributes: true, attributeFilter: ['aria-placeholder'] });\n\n return () => {\n mutationObserver.disconnect();\n };\n }, [editor]);\n\n useEffect(() => {\n if (!editor) return;\n\n const win = editor.getWin();\n const ac = new AbortController();\n\n win.addEventListener(\n 'unload',\n () => {\n onUnload(editor.getContent({ format: 'html' }));\n },\n { signal: ac.signal }\n );\n\n return () => {\n ac.abort();\n };\n }, [editor]);\n\n return (\n <EditorContext.Provider value={ctx}>\n <StyledEditorRoot\n testId={testIds}\n toolbar={renderToolbar}\n label={\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events\n <span\n onClick={() => {\n editor?.focus();\n }}\n >\n {label}\n </span>\n }\n labelFor=''\n labelId={labelId}\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n onResolveSuggestion={onResolveSuggestion}\n onFocus={(e: FocusEvent) => {\n if (e.target === formFieldRef.current && !disabled) {\n editor?.focus();\n }\n }}\n ref={formFieldRef}\n tabIndex={disabled ? -1 : undefined}\n additionalInfo={additionalInfo}\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 tabIndex={readOnly ? 0 : undefined}\n >\n <StyledEditorContainer\n onClick={() => {\n if (!disabled) {\n editor?.focus();\n }\n }}\n ref={tinyMceContainerRef}\n >\n <textarea\n id={id}\n value={value.current || ''}\n onChange={() => {}}\n aria-label={`${label}${renderToolbar ? `. ${t('rte_toolbar_instructions')}.` : ''}`}\n aria-labelledby={labelId}\n ref={tinyMceRef}\n />\n {tinyMceContainerRef.current && editor && imagesEnabled && !readOnly && !disabled && (\n <ImageEditor\n editor={editor}\n editorEl={tinyMceContainerRef.current}\n onChange={() => onChange?.(editor)}\n />\n )}\n </StyledEditorContainer>\n {renderToolbar && (\n <Toolbar\n testId={testIds}\n features={toolbar}\n editor={editor}\n customActions={customActions}\n />\n )}\n </FormControl>\n </StyledEditorRoot>\n {children}\n </EditorContext.Provider>\n );\n });\n\nconst EditorWrapper: ForwardRefForwardPropsComponent<EditorProps> = forwardRef(\n function EditorWrapper(props: PropsWithoutRef<EditorProps>, ref: EditorProps['ref']) {\n const [defaultValue, setDefaultValue] = useState(props.defaultValue ?? '');\n const [key, setKey] = useState(createUID);\n\n return (\n <Editor\n {...props}\n defaultValue={defaultValue}\n onUnload={value => {\n setDefaultValue(value);\n setKey(createUID());\n }}\n ref={ref}\n key={key}\n />\n );\n }\n);\n\nexport default withTestIds(EditorWrapper, getEditorTestIds);\n"]}
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,OAA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AC;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 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 => 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 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,9 +1,39 @@
1
- export declare const offscreenSelectionStyles = "\n .mce-offscreen-selection {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n whiteSpace: nowrap;\n width: 1px;\n }\n";
2
- export declare const mceContentBodyStyles = "\n .mce-content-body {\n overflow-wrap: break-word;\n }\n";
3
- export declare const StyledEditorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
- export declare const StyledEditorRoot: import("styled-components").StyledComponent<import("react").FC<import("@pega/cosmos-react-core").FormFieldProps & import("@pega/cosmos-react-core").ForwardProps> & {
1
+ export declare const StyledEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
+ interface StyledEditorIframeProps {
3
+ $minHeight?: number;
4
+ $maxHeight?: number;
5
+ $hidden?: boolean;
6
+ }
7
+ export declare const StyledEditorIframe: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>, StyledEditorIframeProps>> & string;
8
+ export declare const StyledEditorRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@pega/cosmos-react-core").FormFieldProps & import("@pega/cosmos-react-core").ForwardProps, never>> & string & Omit<import("react").FC<import("@pega/cosmos-react-core").FormFieldProps & import("@pega/cosmos-react-core").ForwardProps> & {
5
9
  getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
6
- }, import("styled-components").DefaultTheme, {}, never>;
7
- export declare const StyledEditPopover: import("styled-components").StyledComponent<(<Modifiers extends string = string>(props: import("@pega/cosmos-react-core").PopoverProps<Modifiers> & import("@pega/cosmos-react-core").ForwardProps) => import("react").ReactElement | null), import("styled-components").DefaultTheme, {}, never>;
8
- export declare const StyledFormDialog: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("@pega/cosmos-react-core").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
10
+ }, keyof import("react").Component<any, {}, any>>;
11
+ export declare const StyledEditPopover: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@pega/cosmos-react-core").PopoverProps<string> & import("@pega/cosmos-react-core").ForwardProps, never>> & string & Omit<(<Modifiers extends string = string>(props: import("@pega/cosmos-react-core").PopoverProps<Modifiers> & import("@pega/cosmos-react-core").ForwardProps) => import("react").ReactElement | null), keyof import("react").Component<any, {}, any>>;
12
+ export declare const StyledFormDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
13
+ onDismiss?: () => void;
14
+ onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
15
+ onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
16
+ } & {
17
+ heading: string;
18
+ additionalInfo?: import("@pega/cosmos-react-core").AdditionalInfoProps;
19
+ 'aria-label'?: never;
20
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
21
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
22
+ }) | (Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
23
+ onDismiss?: () => void;
24
+ onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
25
+ onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
26
+ } & {
27
+ heading?: never;
28
+ 'aria-label': string;
29
+ additionalInfo?: never;
30
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
31
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
32
+ }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<import("@pega/cosmos-react-core").FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
33
+ interface StyledSourceTextareaProps {
34
+ $minHeight?: number;
35
+ $maxHeight?: number;
36
+ }
37
+ export declare const StyledSourceTextarea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, StyledSourceTextareaProps>> & string;
38
+ export {};
9
39
  //# sourceMappingURL=Editor.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB,oOAYpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,mEAIhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAgBhC,CAAC;AAIH,eAAO,MAAM,gBAAgB;2BAS+xE,CAAC;uDAT1wE,CAAC;AAEpD,eAAO,MAAM,iBAAiB,mSAE7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,iRAE5B,CAAC"}
1
+ {"version":3,"file":"Editor.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,6NAOjC,CAAC;AAIF,UAAU,uBAAuB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,wQAyB9B,CAAC;AAIF,eAAO,MAAM,gBAAgB;2BAuDk1C,CAAC;iDAvD7zC,CAAC;AAIpD,eAAO,MAAM,iBAAiB,0dAE7B,CAAC;AAIF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;qSAE5B,CAAC;AAIF,UAAU,yBAAyB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,gRA+BhC,CAAC"}
@@ -1,46 +1,76 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { FormDialog, FormField, Popover, defaultThemeProp } from '@pega/cosmos-react-core';
3
- export const offscreenSelectionStyles = `
4
- .mce-offscreen-selection {
5
- border: 0;
6
- clip: rect(0 0 0 0);
7
- height: 1px;
8
- margin: -1px;
9
- overflow: hidden;
10
- padding: 0;
11
- position: absolute;
12
- whiteSpace: nowrap;
13
- width: 1px;
14
- }
15
- `;
16
- export const mceContentBodyStyles = `
17
- .mce-content-body {
18
- overflow-wrap: break-word;
3
+ export const StyledEditorContainer = styled.div `
4
+ position: relative;
5
+ cursor: text;
6
+
7
+ .ProseMirror:focus {
8
+ outline: none;
19
9
  }
20
10
  `;
21
- export const StyledEditorContainer = styled.div(({ theme }) => {
11
+ StyledEditorContainer.defaultProps = defaultThemeProp;
12
+ export const StyledEditorIframe = styled.iframe(({ theme, $minHeight, $maxHeight, $hidden }) => {
13
+ const minHeightValue = $minHeight
14
+ ? `${$minHeight}px`
15
+ : theme.components['text-area']['min-height'];
16
+ const maxHeightValue = $maxHeight ? `${$maxHeight}px` : undefined;
22
17
  return css `
23
- &:hover {
24
- cursor: text;
25
- }
26
-
27
- iframe {
28
18
  display: block;
29
19
  width: 100%;
30
- height: ${theme.components['text-area']['min-height']};
31
- }
32
-
33
- .tox-statusbar {
34
- display: none !important;
35
- }
36
- `;
20
+ border: none;
21
+ min-height: ${minHeightValue};
22
+ ${maxHeightValue &&
23
+ css `
24
+ max-height: ${maxHeightValue};
25
+ overflow: auto;
26
+ `}
27
+ ${$hidden &&
28
+ css `
29
+ position: absolute;
30
+ visibility: hidden;
31
+ pointer-events: none;
32
+ `}
33
+ `;
37
34
  });
38
- StyledEditorContainer.defaultProps = defaultThemeProp;
35
+ StyledEditorIframe.defaultProps = defaultThemeProp;
39
36
  export const StyledEditorRoot = styled(FormField) ``;
37
+ StyledEditorRoot.defaultProps = defaultThemeProp;
40
38
  export const StyledEditPopover = styled(Popover) `
41
39
  overflow: auto;
42
40
  `;
41
+ StyledEditPopover.defaultProps = defaultThemeProp;
43
42
  export const StyledFormDialog = styled(FormDialog) `
44
43
  overflow: auto;
45
44
  `;
45
+ StyledFormDialog.defaultProps = defaultThemeProp;
46
+ export const StyledSourceTextarea = styled.textarea(({ theme, $minHeight, $maxHeight }) => {
47
+ const minHeightValue = $minHeight
48
+ ? `${$minHeight}px`
49
+ : theme.components['text-area']['min-height'];
50
+ const maxHeightValue = $maxHeight ? `${$maxHeight}px` : undefined;
51
+ return css `
52
+ display: block;
53
+ width: 100%;
54
+ border: none;
55
+ min-height: ${minHeightValue};
56
+ font-family: monospace;
57
+ font-size: ${theme.base['font-size']};
58
+ padding: ${theme.base.spacing};
59
+ resize: none;
60
+ background-color: ${theme.components['form-control']['background-color']};
61
+ color: ${theme.base.palette['foreground-color']};
62
+
63
+ ${maxHeightValue &&
64
+ css `
65
+ max-height: ${maxHeightValue};
66
+ overflow: auto;
67
+ `}
68
+
69
+ &:focus {
70
+ outline: none;
71
+ box-shadow: ${theme.base.shadow.focus};
72
+ }
73
+ `;
74
+ });
75
+ StyledSourceTextarea.defaultProps = defaultThemeProp;
46
76
  //# sourceMappingURL=Editor.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.styles.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;CAYvC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;CAInC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5D,OAAO,GAAG,CAAA;;;;;;;;gBAQI,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC;;;;;;GAMxD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;;CAE/C,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;;CAEjD,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { FormDialog, FormField, Popover, defaultThemeProp } from '@pega/cosmos-react-core';\n\nexport const offscreenSelectionStyles = `\n .mce-offscreen-selection {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n whiteSpace: nowrap;\n width: 1px;\n }\n`;\n\nexport const mceContentBodyStyles = `\n .mce-content-body {\n overflow-wrap: break-word;\n }\n`;\n\nexport const StyledEditorContainer = styled.div(({ theme }) => {\n return css`\n &:hover {\n cursor: text;\n }\n\n iframe {\n display: block;\n width: 100%;\n height: ${theme.components['text-area']['min-height']};\n }\n\n .tox-statusbar {\n display: none !important;\n }\n `;\n});\n\nStyledEditorContainer.defaultProps = defaultThemeProp;\n\nexport const StyledEditorRoot = styled(FormField)``;\n\nexport const StyledEditPopover = styled(Popover)`\n overflow: auto;\n`;\n\nexport const StyledFormDialog = styled(FormDialog)`\n overflow: auto;\n`;\n"]}
1
+ {"version":3,"file":"Editor.styles.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO9C,CAAC;AAEF,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAQtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAC7C,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7C,MAAM,cAAc,GAAG,UAAU;QAC/B,CAAC,CAAC,GAAG,UAAU,IAAI;QACnB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC,C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AE7C,cAAc;QAChB,GAAG,CAAA;sBACa,cAAc;;OAE7B;;;;sBAIe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;KAExC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { FormDialog, FormField, Popover, defaultThemeProp } from '@pega/cosmos-react-core';\n\nexport const StyledEditorContainer = styled.div`\n position: relative;\n cursor: text;\n\n .ProseMirror:focus {\n outline: none;\n }\n`;\n\nStyledEditorContainer.defaultProps = defaultThemeProp;\n\ninterface StyledEditorIframeProps {\n $minHeight?: number;\n $maxHeight?: number;\n $hidden?: boolean;\n}\n\nexport const StyledEditorIframe = styled.iframe<StyledEditorIframeProps>(\n ({ theme, $minHeight, $maxHeight, $hidden }) => {\n const minHeightValue = $minHeight\n ? `${$minHeight}px`\n : theme.components['text-area']['min-height'];\n const maxHeightValue = $maxHeight ? `${$maxHeight}px` : undefined;\n\n return css`\n display: block;\n width: 100%;\n border: none;\n min-height: ${minHeightValue};\n ${maxHeightValue &&\n css`\n max-height: ${maxHeightValue};\n overflow: auto;\n `}\n ${$hidden &&\n css`\n position: absolute;\n visibility: hidden;\n pointer-events: none;\n `}\n `;\n }\n);\n\nStyledEditorIframe.defaultProps = defaultThemeProp;\n\nexport const StyledEditorRoot = styled(FormField)``;\n\nStyledEditorRoot.defaultProps = defaultThemeProp;\n\nexport const StyledEditPopover = styled(Popover)`\n overflow: auto;\n`;\n\nStyledEditPopover.defaultProps = defaultThemeProp;\n\nexport const StyledFormDialog = styled(FormDialog)`\n overflow: auto;\n`;\n\nStyledFormDialog.defaultProps = defaultThemeProp;\n\ninterface StyledSourceTextareaProps {\n $minHeight?: number;\n $maxHeight?: number;\n}\n\nexport const StyledSourceTextarea = styled.textarea<StyledSourceTextareaProps>(\n ({ theme, $minHeight, $maxHeight }) => {\n const minHeightValue = $minHeight\n ? `${$minHeight}px`\n : theme.components['text-area']['min-height'];\n const maxHeightValue = $maxHeight ? `${$maxHeight}px` : undefined;\n\n return css`\n display: block;\n width: 100%;\n border: none;\n min-height: ${minHeightValue};\n font-family: monospace;\n font-size: ${theme.base['font-size']};\n padding: ${theme.base.spacing};\n resize: none;\n background-color: ${theme.components['form-control']['background-color']};\n color: ${theme.base.palette['foreground-color']};\n\n ${maxHeightValue &&\n css`\n max-height: ${maxHeightValue};\n overflow: auto;\n `}\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n }\n);\n\nStyledSourceTextarea.defaultProps = defaultThemeProp;\n"]}
@@ -1,2 +1,3 @@
1
- export declare const getEditorTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["toolbar", "text-styles", "bold", "italic", "strike-through", "bulleted-list", "numbered-list", "indent", "unindent", "link", "image", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
1
+ export declare const elements: readonly ["iframe"];
2
+ export declare const getEditorTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["iframe", "toolbar", "text-styles", "bold", "italic", "strike-through", "underline", "subscript", "superscript", "font-family", "font-size", "text-color", "background-color", "alignment", "align-left", "align-center", "align-right", "bulleted-list", "numbered-list", "indent", "unindent", "table", "link", "image", "source-code", "ai-rewrite", "overflow", "word-count", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
2
3
  //# sourceMappingURL=Editor.test-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.test-ids.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,0VAGlB,CAAC"}
1
+ {"version":3,"file":"Editor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.test-ids.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,qkBAIlB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { createTestIds } from '@pega/cosmos-react-core';
2
2
  import { elements as formFieldTestIdElements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';
3
3
  import { elements as toolbarTestIdElements } from './Toolbar/Toolbar.test-ids';
4
+ export const elements = ['iframe'];
4
5
  export const getEditorTestIds = createTestIds('editor', [
6
+ ...elements,
5
7
  ...toolbarTestIdElements,
6
8
  ...formFieldTestIdElements
7
9
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.test-ids.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,IAAI,uBAAuB,EAAE,MAAM,qEAAqE,CAAC;AAE1H,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,EAAE;IACtD,GAAG,qBAAqB;IACxB,GAAG,uBAAuB;CAClB,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\nimport { elements as formFieldTestIdElements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';\n\nimport { elements as toolbarTestIdElements } from './Toolbar/Toolbar.test-ids';\n\nexport const getEditorTestIds = createTestIds('editor', [\n ...toolbarTestIdElements,\n ...formFieldTestIdElements\n] as const);\n"]}
1
+ {"version":3,"file":"Editor.test-ids.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,IAAI,uBAAuB,EAAE,MAAM,qEAAqE,CAAC;AAE1H,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAQ,CAAU,CAAC;AAE5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,EAAE;IACtD,GAAG,QAAQ;IACX,GAAG,qBAAqB;IACxB,GAAG,uBAAuB;CAClB,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\nimport { elements as formFieldTestIdElements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';\n\nimport { elements as toolbarTestIdElements } from './Toolbar/Toolbar.test-ids';\n\nexport const elements = ['iframe'] as const;\n\nexport const getEditorTestIds = createTestIds('editor', [\n ...elements,\n ...toolbarTestIdElements,\n ...formFieldTestIdElements\n] as const);\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { ReactNode, Ref, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
2
- import type { RawEditorOptions, Editor as TinymceEditor } from 'tinymce/tinymce';
3
- import type { Action, BaseProps, FormControlProps, TestIdProp } from '@pega/cosmos-react-core';
2
+ import type { Editor as TiptapEditor } from '@tiptap/core';
3
+ import type { Action, BaseProps, FormControlProps, TestIdProp, AIAction } from '@pega/cosmos-react-core';
4
4
  import type { Features } from '../RichTextEditor/Toolbar/Toolbar.types';
5
5
  import type { RichTextEditorState } from '../RichTextEditor';
6
6
  export type EditorState = RichTextEditorState & {
7
- getEditor: () => TinymceEditor | undefined;
7
+ getEditor: () => TiptapEditor | null;
8
8
  element?: HTMLElement;
9
9
  setCursorLocationToStart?: () => void;
10
10
  updateAttachmentAttributes: (id: string, progress?: number, error?: string) => void;
@@ -13,11 +13,11 @@ export type CustomAction = {
13
13
  text: Action['text'];
14
14
  icon: NonNullable<Action['icon']>;
15
15
  onMouseDown: (e: ReactMouseEvent | ReactKeyboardEvent) => void;
16
- active?: (editor: TinymceEditor) => void;
16
+ active?: (editor: TiptapEditor) => boolean;
17
17
  shortcut?: {
18
18
  pattern: string;
19
19
  description: string;
20
- command: (editor: TinymceEditor) => void;
20
+ command: (editor: TiptapEditor) => void;
21
21
  };
22
22
  'data-testid'?: string;
23
23
  };
@@ -33,7 +33,7 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
33
33
  /** Children content */
34
34
  children?: ReactNode;
35
35
  /** A callback that supplies an object with functions that can manipulate the editor and retrieve it's content/state */
36
- onChange?: (editor?: TinymceEditor) => void;
36
+ onChange?: (editor?: TiptapEditor) => void;
37
37
  /** KeyDown event custom handlers for the editor */
38
38
  onKeyDown?: (event?: KeyboardEvent) => void;
39
39
  /** A callback that runs if the editor is focused */
@@ -41,9 +41,11 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
41
41
  /** A callback that runs if the editor loses focus */
42
42
  onBlur?: () => void;
43
43
  /** A callback when an image is added through the toolbar image feature */
44
- onImageAdded?: (image: File, id: string) => void;
45
- /** A callback for when tinymce is finished initializing */
46
- onInit?: (editor: TinymceEditor) => void;
44
+ onImageAdded?: (image: File, id: string, altText?: string) => void;
45
+ /** A callback for when the editor is finished initializing */
46
+ onInit?: (editor: TiptapEditor) => void;
47
+ /** A callback that runs when the iframe is about to unload, useful for saving editor state */
48
+ onUnload?: (value: string) => void;
47
49
  /** Standard placeholder for an input */
48
50
  placeholder?: string;
49
51
  /** Default value for the RTE - HTML String */
@@ -72,17 +74,35 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
72
74
  /** Options used during init of the editor */
73
75
  initOptions?: {
74
76
  /** Disables pasting of images in editor when false */
75
- pasteDataImages?: RawEditorOptions['paste_data_images'];
77
+ pasteDataImages?: boolean;
76
78
  /** Converts formatted text to plain text upon pasting */
77
- pasteAsText?: RawEditorOptions['paste_as_text'];
79
+ pasteAsText?: boolean;
78
80
  /** Disables inline, block, and replacement text patterns when false and can be array of allowed formats */
79
- textPatterns?: RawEditorOptions['text_patterns'];
81
+ textPatterns?: boolean;
80
82
  /** Function called during init_instance_callback as part of editor init */
81
- initInstanceCallback?: RawEditorOptions['init_instance_callback'];
83
+ initInstanceCallback?: (editor: TiptapEditor) => void;
82
84
  /** Styles to set within the iframe's document */
83
- contentStyle?: RawEditorOptions['content_style'];
85
+ contentStyle?: string;
84
86
  };
85
87
  /** Handle to the state. */
86
88
  ref?: Ref<EditorState>;
89
+ /**
90
+ * Determines the image insertion mode for the editor.
91
+ * - 'file': Only allows uploading image files from local system
92
+ * - 'url': Only allows adding images via URL/link
93
+ * - 'all': Allows all image files upload options
94
+ * @default 'all'
95
+ */
96
+ imageInsertionMode?: 'file' | 'url' | 'all';
97
+ /** A callback when the AI rewrite toolbar button is used. The onSuccess callback should be called with the rewritten text. */
98
+ onRewriteClick?: (originalText: string, rewriteAction: AIAction, additionalInstructions: string, onSuccess: (rewrittenText: string) => void) => void;
99
+ /** If there is a progress state (e.g. AI rewrite in progress), you must indicate as such. Shows a Progress overlay on the editor. */
100
+ progress?: boolean | string;
101
+ /**
102
+ * Enables secure mode which sanitizes content to prevent XSS attacks.
103
+ * Strips scripts, iframes, event handlers, and dangerous URLs.
104
+ * @default false
105
+ */
106
+ secure?: boolean;
87
107
  }
88
108
  //# sourceMappingURL=Editor.types.d.ts.map
@@ -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,gBAAgB,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO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IAAqI;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 { RawEditorOptions, Editor as TinymceEditor } from 'tinymce/tinymce';\n\nimport type { Action, BaseProps, FormControlProps, TestIdProp } 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: () => TinymceEditor | undefined;\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: TinymceEditor) => void;\n shortcut?: { pattern: string; description: string; command: (editor: TinymceEditor) => void };\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?: TinymceEditor) => 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) => void;\n /** A callback for when tinymce is finished initializing */\n onInit?: (editor: TinymceEditor) => 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?: RawEditorOptions['paste_data_images'];\n /** Converts formatted text to plain text upon pasting */\n pasteAsText?: RawEditorOptions['paste_as_text'];\n /** Disables inline, block, and replacement text patterns when false and can be array of allowed formats */\n textPatterns?: RawEditorOptions['text_patterns'];\n /** Function called during init_instance_callback as part of editor init */\n initInstanceCallback?: RawEditorOptions['init_instance_callback'];\n /** Styles to set within the iframe's document */\n contentStyle?: RawEditorOptions['content_style'];\n };\n /** Handle to the state. */\n ref?: Ref<EditorState>;\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 /** 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"]}