@pega/cosmos-react-rte 7.0.0-build.9.2 → 7.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.test-ids.d.ts.map +1 -1
- package/lib/components/Editor/Editor.d.ts +1 -1
- package/lib/components/Editor/Editor.d.ts.map +1 -1
- package/lib/components/Editor/Editor.js +48 -17
- package/lib/components/Editor/Editor.js.map +1 -1
- package/lib/components/Editor/Editor.styles.d.ts +4 -0
- package/lib/components/Editor/Editor.styles.d.ts.map +1 -1
- package/lib/components/Editor/Editor.styles.js +2 -1
- package/lib/components/Editor/Editor.styles.js.map +1 -1
- package/lib/components/Editor/Editor.test-ids.d.ts +1 -1
- package/lib/components/Editor/Editor.test-ids.d.ts.map +1 -1
- package/lib/components/Editor/Editor.types.d.ts +7 -0
- package/lib/components/Editor/Editor.types.d.ts.map +1 -1
- package/lib/components/Editor/Editor.types.js.map +1 -1
- package/lib/components/Editor/ImageEditor.d.ts.map +1 -1
- package/lib/components/Editor/ImageEditor.js.map +1 -1
- package/lib/components/Editor/Toolbar/AnchorButton.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/AnchorButton.js +1 -0
- package/lib/components/Editor/Toolbar/AnchorButton.js.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.d.ts +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.js.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.test-ids.d.ts +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.test-ids.d.ts.map +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/BlockQuote.d.ts +8 -0
- package/lib/components/RichTextEditor/DecoratorComponents/BlockQuote.d.ts.map +1 -0
- package/lib/components/RichTextEditor/DecoratorComponents/BlockQuote.js +18 -0
- package/lib/components/RichTextEditor/DecoratorComponents/BlockQuote.js.map +1 -0
- package/lib/components/RichTextEditor/DecoratorComponents/Code.d.ts +8 -0
- package/lib/components/RichTextEditor/DecoratorComponents/Code.d.ts.map +1 -0
- package/lib/components/RichTextEditor/DecoratorComponents/Code.js +23 -0
- package/lib/components/RichTextEditor/DecoratorComponents/Code.js.map +1 -0
- package/lib/components/RichTextEditor/DecoratorComponents/CodeBlock.d.ts +7 -2
- package/lib/components/RichTextEditor/DecoratorComponents/CodeBlock.d.ts.map +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/CodeBlock.js +20 -10
- package/lib/components/RichTextEditor/DecoratorComponents/CodeBlock.js.map +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/HorizontalRule.d.ts +8 -0
- package/lib/components/RichTextEditor/DecoratorComponents/HorizontalRule.d.ts.map +1 -0
- package/lib/components/RichTextEditor/DecoratorComponents/HorizontalRule.js +16 -0
- package/lib/components/RichTextEditor/DecoratorComponents/HorizontalRule.js.map +1 -0
- package/lib/components/RichTextEditor/RichTextViewer.d.ts +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.test-ids.d.ts +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.test-ids.d.ts.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/lib/components/RichTextEditor/utils/markdownConverter.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/markdownConverter.js +26 -0
- package/lib/components/RichTextEditor/utils/markdownConverter.js.map +1 -1
- package/lib/components/RichTextEditor/utils/renderers.d.ts +1 -0
- package/lib/components/RichTextEditor/utils/renderers.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/renderers.js +28 -0
- package/lib/components/RichTextEditor/utils/renderers.js.map +1 -1
- package/lib/components/RichTextEditor/utils/slateConverter.d.ts +4 -0
- package/lib/components/RichTextEditor/utils/slateConverter.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/slateConverter.js +5 -0
- package/lib/components/RichTextEditor/utils/slateConverter.js.map +1 -1
- package/package.json +6 -6
|
@@ -6,7 +6,7 @@ export declare const StyledSearchPopover: import("styled-components").StyledComp
|
|
|
6
6
|
portal?: boolean | undefined;
|
|
7
7
|
}, never>;
|
|
8
8
|
declare const _default: FunctionComponent<DynamicContentEditorProps & ForwardProps> & {
|
|
9
|
-
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
|
|
9
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
12
12
|
//# sourceMappingURL=DynamicContentEditor.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getDynamicContentEditorTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
|
|
1
|
+
export declare const getDynamicContentEditorTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["insert-field", "insert-field-modal", "insert-field-modal-cancel", "insert-field-modal-submit"]>;
|
|
2
2
|
//# sourceMappingURL=DynamicContentEditor.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicContentEditor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"DynamicContentEditor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/DynamicContentEditor.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,wMAKhC,CAAC"}
|
|
@@ -13,7 +13,7 @@ export declare const StyledInnerEditor: import("styled-components").StyledCompon
|
|
|
13
13
|
showPlaceholder: boolean;
|
|
14
14
|
}, never>;
|
|
15
15
|
declare const _default: FC<EditorProps & ForwardProps> & {
|
|
16
|
-
getTestIds: (testIdProp?: string | undefined) => 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"]>;
|
|
16
|
+
getTestIds: (testIdProp?: string | null | undefined) => 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"]>;
|
|
17
17
|
};
|
|
18
18
|
export default _default;
|
|
19
19
|
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAEA,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;AAW5B,OAAO,KAAK,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AAEA,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;AAW5B,OAAO,KAAK,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAoBtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAa5D,OAAO,KAAK,EAAmB,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAsBhF,eAAO,MAAM,cAAc,UAAW,YAAY,WAQjD,CAAC;AAEF,eAAO,MAAM,iBAAiB;qBAAiC,OAAO;SAarE,CAAC;;;;AAkkBF,wBAAqD"}
|
|
@@ -10,7 +10,7 @@ import { forwardRef, useEffect, useRef, useState, useLayoutEffect, useImperative
|
|
|
10
10
|
import styled, { css } from 'styled-components';
|
|
11
11
|
import { compile, serialize, stringify } from 'stylis';
|
|
12
12
|
import { stripUnit } from 'polished';
|
|
13
|
-
import { createUID, FormControl,
|
|
13
|
+
import { createUID, FormControl, useAfterInitialEffect, useTheme, useUID, useI18n, useConsolidatedRef, defaultThemeProp, useAutoResize, useConfiguration, useTestIds, withTestIds, documentIsAvailable, getActiveElement } from '@pega/cosmos-react-core';
|
|
14
14
|
import { getHtmlStyles } from '@pega/cosmos-react-core/lib/components/HTML/HTML';
|
|
15
15
|
import { createGlobalBodyStyles, createGlobalRootStyles, globalSpacingStyles } from '@pega/cosmos-react-core/lib/styles/GlobalStyle';
|
|
16
16
|
import StyledRichTextEditor from '../RichTextEditor/RichTextEditor.styles';
|
|
@@ -18,7 +18,7 @@ import Toolbar from './Toolbar/Toolbar';
|
|
|
18
18
|
import EditorContext from './Editor.context';
|
|
19
19
|
import { getTextFormats } from './Toolbar/TextSelect';
|
|
20
20
|
import ImageEditor, { imgHoverClass } from './ImageEditor';
|
|
21
|
-
import { offscreenSelectionStyles, placeholderStyles, mceContentBodyStyles, StyledEditorContainer } from './Editor.styles';
|
|
21
|
+
import { offscreenSelectionStyles, placeholderStyles, mceContentBodyStyles, StyledEditorContainer, StyledEditorRoot } from './Editor.styles';
|
|
22
22
|
import { getEditorTestIds } from './Editor.test-ids';
|
|
23
23
|
import createFileItemElement from './FileItemElement';
|
|
24
24
|
const getFileFromUrl = async (url, name) => {
|
|
@@ -64,7 +64,7 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
64
64
|
const tinyMceContainerRef = useRef(null);
|
|
65
65
|
const initialized = useRef(false);
|
|
66
66
|
const pastedImages = useRef([]);
|
|
67
|
-
const { testId, id = uid, toolbar = [], label, labelHidden, info, status, required, disabled, readOnly, onChange, onKeyDown, onFocus, onBlur, onImageAdded, onInit, defaultValue, customComponents = [], height, customActions, placeholder, children, spellcheck = true, additionalInfo, initOptions, ...restProps } = props;
|
|
67
|
+
const { testId, id = uid, toolbar = [], label, labelHidden, info, status, required, disabled, readOnly, onChange, onKeyDown, onFocus, onBlur, onImageAdded, onInit, defaultValue, customComponents = [], height, autoResize = true, customActions, placeholder, children, spellcheck = true, additionalInfo, initOptions, ...restProps } = props;
|
|
68
68
|
const testIds = useTestIds(testId, getEditorTestIds);
|
|
69
69
|
const baseHeight = {
|
|
70
70
|
min: height?.min ?? stripUnit(textAreaMinHeight) * 16,
|
|
@@ -80,8 +80,8 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
80
80
|
return undefined;
|
|
81
81
|
};
|
|
82
82
|
const imagesEnabled = toolbar.includes('images');
|
|
83
|
-
const maxHeight = getHeight('max');
|
|
84
|
-
const minHeight = getHeight('min');
|
|
83
|
+
const maxHeight = autoResize ? getHeight('max') : undefined;
|
|
84
|
+
const minHeight = autoResize ? getHeight('min') : undefined;
|
|
85
85
|
const [autoResizeRef, resizeEditor] = useAutoResize(maxHeight, minHeight);
|
|
86
86
|
const formFieldRef = useRef(null);
|
|
87
87
|
const value = useRef(defaultValue);
|
|
@@ -203,6 +203,7 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
203
203
|
const styles = serialize(compile(getHtmlStyles(theme)), stringify);
|
|
204
204
|
const imageStyles = serialize(compile(getImageStyles(theme)), stringify);
|
|
205
205
|
const FileItemStyle = css `
|
|
206
|
+
/* stylelint-disable-next-line selector-type-no-unknown */
|
|
206
207
|
pega-file {
|
|
207
208
|
display: inline-block;
|
|
208
209
|
width: ${theme.base['content-width'].md};
|
|
@@ -240,7 +241,28 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
240
241
|
relative_urls: false,
|
|
241
242
|
remove_script_host: false,
|
|
242
243
|
paste_preprocess: pastePreprocess,
|
|
243
|
-
|
|
244
|
+
convert_unsafe_embeds: true,
|
|
245
|
+
content_style: `
|
|
246
|
+
${createGlobalRootStyles(theme)}
|
|
247
|
+
${globalSpacingStyles}
|
|
248
|
+
${createGlobalBodyStyles(theme)}
|
|
249
|
+
|
|
250
|
+
html {
|
|
251
|
+
overflow: hidden;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
body {
|
|
255
|
+
min-height: 3rem;
|
|
256
|
+
padding: ${theme.base.spacing};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
${offscreenSelectionStyles}
|
|
260
|
+
${mceContentBodyStyles}
|
|
261
|
+
${placeholderStyles}
|
|
262
|
+
${imageStyles}
|
|
263
|
+
${styles}
|
|
264
|
+
${initOptions?.contentStyle}
|
|
265
|
+
`,
|
|
244
266
|
init_instance_callback: initializedEditor => {
|
|
245
267
|
if (initOptions?.initInstanceCallback) {
|
|
246
268
|
initOptions.initInstanceCallback(initializedEditor);
|
|
@@ -256,6 +278,7 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
256
278
|
if (style) {
|
|
257
279
|
const styleEl = document.createElement('style');
|
|
258
280
|
styleEl.innerText = style;
|
|
281
|
+
styleEl.nonce = window.__webpack_nonce__;
|
|
259
282
|
initializedEditor.getDoc().head.appendChild(styleEl);
|
|
260
283
|
}
|
|
261
284
|
});
|
|
@@ -265,6 +288,7 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
265
288
|
.map(comp => `${comp.name}${comp.extensionAttributes ? `[${comp.extensionAttributes.join('|')}]` : ''}`)
|
|
266
289
|
.join(',')}`,
|
|
267
290
|
custom_elements: customElements.map(comp => `~${comp.name}`).join('~,'),
|
|
291
|
+
invalid_elements: 'iframe',
|
|
268
292
|
setup: editorSettings => {
|
|
269
293
|
editorSettings.on('keydown', e => {
|
|
270
294
|
const activeElement = editorSettings?.getDoc().activeElement;
|
|
@@ -322,7 +346,8 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
322
346
|
iframeContentHead?.appendChild(sheet.cloneNode(true));
|
|
323
347
|
});
|
|
324
348
|
autoResizeRef.current = iframe;
|
|
325
|
-
|
|
349
|
+
if (autoResize)
|
|
350
|
+
resizeEditor();
|
|
326
351
|
}
|
|
327
352
|
});
|
|
328
353
|
}, []);
|
|
@@ -340,7 +365,8 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
340
365
|
if (activeElement.nodeName === 'PEGA-FILE') {
|
|
341
366
|
activeElement.shadowRoot?.querySelector('button[aria-label*="Cancel"]')?.focus();
|
|
342
367
|
}
|
|
343
|
-
|
|
368
|
+
if (autoResize)
|
|
369
|
+
resizeEditor();
|
|
344
370
|
};
|
|
345
371
|
const onEditorChange = (event) => {
|
|
346
372
|
if (event.type === 'paste' && event.clipboardData?.files) {
|
|
@@ -362,7 +388,8 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
362
388
|
editor.on(event, onEditorChange);
|
|
363
389
|
});
|
|
364
390
|
editor.on('keydown', onEditorKeyDown);
|
|
365
|
-
|
|
391
|
+
if (autoResize)
|
|
392
|
+
editor.on('paste', resizeEditor);
|
|
366
393
|
editor.on('focus', onEditorFocus);
|
|
367
394
|
editor.on('blur', onEditorBlur);
|
|
368
395
|
return () => {
|
|
@@ -370,7 +397,8 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
370
397
|
editor.off(event, onEditorChange);
|
|
371
398
|
});
|
|
372
399
|
editor.off('keydown', onEditorKeyDown);
|
|
373
|
-
|
|
400
|
+
if (autoResize)
|
|
401
|
+
editor.off('paste', resizeEditor);
|
|
374
402
|
editor.off('focus', onEditorFocus);
|
|
375
403
|
editor.off('blur', onEditorBlur);
|
|
376
404
|
};
|
|
@@ -405,18 +433,21 @@ const Editor = forwardRef(function Editor(props, ref) {
|
|
|
405
433
|
};
|
|
406
434
|
editor?.on('drop', onEditorDrop);
|
|
407
435
|
const body = editor?.getDoc().body;
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
436
|
+
let resizeObserver;
|
|
437
|
+
if (autoResize) {
|
|
438
|
+
resizeObserver = new ResizeObserver(() => {
|
|
439
|
+
resizeEditor();
|
|
440
|
+
});
|
|
441
|
+
if (body) {
|
|
442
|
+
resizeObserver.observe(body);
|
|
443
|
+
}
|
|
413
444
|
}
|
|
414
445
|
return () => {
|
|
415
446
|
editor?.off('drop', onEditorDrop);
|
|
416
|
-
resizeObserver
|
|
447
|
+
resizeObserver?.disconnect();
|
|
417
448
|
};
|
|
418
449
|
}, [editor, resizeEditor]);
|
|
419
|
-
return (_jsxs(EditorContext.Provider, { value: ctx, children: [_jsx(
|
|
450
|
+
return (_jsxs(EditorContext.Provider, { value: ctx, children: [_jsx(StyledEditorRoot, { testId: testIds, toolbar: renderToolbar, label:
|
|
420
451
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
421
452
|
_jsx("span", { onClick: () => {
|
|
422
453
|
editor?.focus();
|
|
@@ -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,u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AAC,OAAO,EACrC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAClC,CACH,IACqB,EACvB,aAAa,IAAI,CAChB,KAAC,OAAO,IACN,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,GAC5B,CACH,IACW,GACJ,EACX,QAAQ,IACc,CAC1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,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 { FC, PropsWithoutRef, FocusEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { compile, serialize, stringify } from 'stylis';\nimport { stripUnit } from 'polished';\n\nimport {\n createUID,\n FormControl,\n FormField,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useI18n,\n useConsolidatedRef,\n defaultThemeProp,\n useAutoResize,\n useConfiguration,\n useTestIds,\n withTestIds,\n documentIsAvailable,\n getActiveElement\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } 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, EditorState } from './Editor.types';\nimport ImageEditor, { imgHoverClass } from './ImageEditor';\nimport {\n offscreenSelectionStyles,\n placeholderStyles,\n mceContentBodyStyles,\n StyledEditorContainer\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 StyledInnerEditor = styled.div<{ showPlaceholder: boolean }>(\n ({ theme, showPlaceholder }) => {\n return css`\n ${showPlaceholder &&\n css`\n ::before {\n color: ${theme.base.colors.slate.medium};\n position: absolute;\n content: attr(data-mce-placeholder);\n }\n `}\n `;\n }\n);\n\nStyledInnerEditor.defaultProps = defaultThemeProp;\n\nconst Editor: FC<EditorProps & ForwardProps> = forwardRef(function Editor(\n props: PropsWithoutRef<EditorProps> & ForwardProps,\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 onInit,\n defaultValue,\n customComponents = [],\n height,\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 = getHeight('max');\n const minHeight = getHeight('min');\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<any, EditorState>(\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 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 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 editor?.insertContent(html);\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 FileItemStyle = css`\n pega-file {\n display: inline-block;\n width: ${theme.base['content-width'].md};\n }\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 content_style: `${createGlobalRootStyles(\n theme\n )} ${globalSpacingStyles} ${createGlobalBodyStyles(\n theme\n )} body { min-height: 3rem; padding: ${\n theme.base.spacing\n }; } html { overflow: hidden; } ${offscreenSelectionStyles} ${mceContentBodyStyles} ${placeholderStyles} ${imageStyles} ${styles}`,\n init_instance_callback: initializedEditor => {\n if (initOptions?.initInstanceCallback) {\n initOptions.initInstanceCallback(initializedEditor);\n }\n initializedEditor.dom.setAttrib('tinymce', 'aria-label', null);\n const iframeWindow = (\n tinyMceContainerRef.current?.querySelector('iframe') as HTMLIFrameElement\n ).contentWindow;\n const editorCustomElements = iframeWindow?.customElements;\n\n if (editorCustomElements) {\n customElements.forEach(({ 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 styleEl = document.createElement('style');\n styleEl.innerText = style;\n initializedEditor.getDoc().head.appendChild(styleEl);\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 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().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?.setAttribute('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 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 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 editor.on('paste', resizeEditor);\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 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 const resizeObserver = new ResizeObserver(() => {\n resizeEditor();\n });\n if (body) {\n resizeObserver.observe(body);\n }\n return () => {\n editor?.off('drop', onEditorDrop);\n resizeObserver.disconnect();\n };\n }, [editor, resizeEditor]);\n\n return (\n <EditorContext.Provider value={ctx}>\n <FormField\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 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 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 && !readOnly && (\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 </FormField>\n {children}\n </EditorContext.Provider>\n );\n});\n\nexport default withTestIds(Editor, getEditorTestIds);\n"]}
|
|
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,OAAO,CAAC;AAEf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,SAAS,EA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OAAO,IAAI,MAAM,IAAI,CAAC,QAAQ,IAAI,CACrD,KAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,mBAAmB,CAAC,OAAO,EACrC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAClC,CACH,IACqB,EACvB,aAAa,IAAI,CAChB,KAAC,OAAO,IACN,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,GAC5B,CACH,IACW,GACG,EAClB,QAAQ,IACc,CAC1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,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 { FC, PropsWithoutRef, FocusEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { compile, serialize, stringify } from 'stylis';\nimport { stripUnit } from 'polished';\n\nimport {\n createUID,\n FormControl,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useI18n,\n useConsolidatedRef,\n defaultThemeProp,\n useAutoResize,\n useConfiguration,\n useTestIds,\n withTestIds,\n documentIsAvailable,\n getActiveElement\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } 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, EditorState } from './Editor.types';\nimport ImageEditor, { imgHoverClass } from './ImageEditor';\nimport {\n offscreenSelectionStyles,\n placeholderStyles,\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 StyledInnerEditor = styled.div<{ showPlaceholder: boolean }>(\n ({ theme, showPlaceholder }) => {\n return css`\n ${showPlaceholder &&\n css`\n ::before {\n color: ${theme.base.colors.slate.medium};\n position: absolute;\n content: attr(data-mce-placeholder);\n }\n `}\n `;\n }\n);\n\nStyledInnerEditor.defaultProps = defaultThemeProp;\n\nconst Editor: FC<EditorProps & ForwardProps> = forwardRef(function Editor(\n props: PropsWithoutRef<EditorProps> & ForwardProps,\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 onInit,\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<any, EditorState>(\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 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 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 editor?.insertContent(html);\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 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 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 content_style: `\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 }\n\n ${offscreenSelectionStyles}\n ${mceContentBodyStyles}\n ${placeholderStyles}\n ${imageStyles}\n ${styles}\n ${initOptions?.contentStyle}\n `,\n init_instance_callback: initializedEditor => {\n if (initOptions?.initInstanceCallback) {\n initOptions.initInstanceCallback(initializedEditor);\n }\n initializedEditor.dom.setAttrib('tinymce', 'aria-label', null);\n const iframeWindow = (\n tinyMceContainerRef.current?.querySelector('iframe') as HTMLIFrameElement\n ).contentWindow;\n const editorCustomElements = iframeWindow?.customElements;\n\n if (editorCustomElements) {\n customElements.forEach(({ 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 styleEl = document.createElement('style');\n styleEl.innerText = style;\n styleEl.nonce = window.__webpack_nonce__;\n initializedEditor.getDoc().head.appendChild(styleEl);\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().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?.setAttribute('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\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 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 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 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 && !readOnly && (\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\nexport default withTestIds(Editor, getEditorTestIds);\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
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
3
|
export declare const mceContentBodyStyles = "\n .mce-content-body {\n overflow-wrap: break-word;\n }\n";
|
|
3
4
|
export declare const placeholderStyles = "\n .mce-content-body[data-mce-placeholder] {\n position: relative;\n }\n .mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {\n cursor: text;\n color: rgb(117, 117, 117);\n content: attr(data-mce-placeholder);\n position: absolute;\n }\n";
|
|
4
5
|
export declare const StyledEditorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const StyledEditorRoot: import("styled-components").StyledComponent<import("react").FC<import("@pega/cosmos-react-core").FormFieldProps & import("@pega/cosmos-react-core").ForwardProps> & {
|
|
7
|
+
getTestIds: (testIdProp?: string | null | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
8
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
|
5
9
|
//# 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,iBAAiB,yRAU7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAgBhC,CAAC"}
|
|
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,iBAAiB,yRAU7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAgBhC,CAAC;AAIH,eAAO,MAAM,gBAAgB;;uDAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { defaultThemeProp } from '@pega/cosmos-react-core';
|
|
2
|
+
import { FormField, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
3
3
|
export const offscreenSelectionStyles = `
|
|
4
4
|
.mce-offscreen-selection {
|
|
5
5
|
border: 0;
|
|
@@ -47,4 +47,5 @@ export const StyledEditorContainer = styled.div(({ theme }) => {
|
|
|
47
47
|
`;
|
|
48
48
|
});
|
|
49
49
|
StyledEditorContainer.defaultProps = defaultThemeProp;
|
|
50
|
+
export const StyledEditorRoot = styled(FormField) ``;
|
|
50
51
|
//# 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,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
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,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;CAYvC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;CAInC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;CAUhC,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","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { FormField, 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 placeholderStyles = `\n .mce-content-body[data-mce-placeholder] {\n position: relative;\n }\n .mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {\n cursor: text;\n color: rgb(117, 117, 117);\n content: attr(data-mce-placeholder);\n position: absolute;\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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getEditorTestIds: (testIdProp?: string | undefined) => 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 getEditorTestIds: (testIdProp?: string | null | undefined) => 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"]>;
|
|
2
2
|
//# 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,
|
|
1
|
+
{"version":3,"file":"Editor.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.test-ids.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,6TAGlB,CAAC"}
|
|
@@ -55,6 +55,11 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
|
|
|
55
55
|
min?: number;
|
|
56
56
|
max?: number;
|
|
57
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Determines if the editor resizes its height based on content and user interactions.
|
|
60
|
+
* @default true;
|
|
61
|
+
*/
|
|
62
|
+
autoResize?: boolean;
|
|
58
63
|
/** An array of custom components, custom components must use web component API */
|
|
59
64
|
customComponents?: CustomComponent[];
|
|
60
65
|
/** An array of custom buttons to be inserted into the toolbar */
|
|
@@ -72,6 +77,8 @@ export interface EditorProps extends FormControlProps, BaseProps, TestIdProp {
|
|
|
72
77
|
textPatterns?: RawEditorOptions['text_patterns'];
|
|
73
78
|
/** Function called during init_instance_callback as part of editor init */
|
|
74
79
|
initInstanceCallback?: RawEditorOptions['init_instance_callback'];
|
|
80
|
+
/** Styles to set within the iframe's document */
|
|
81
|
+
contentStyle?: RawEditorOptions['content_style'];
|
|
75
82
|
};
|
|
76
83
|
/** Handle to the state. */
|
|
77
84
|
ref?: Ref<EditorState>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.types.d.ts","sourceRoot":"","sources":["../../../src/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AC;IACjD,2DAA2D;IAC3D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kIAAkI;IAClI,MAAM,CAAC,EAAE;QACP,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,iEAAiE;IACjE,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE;QACZ,sDAAsD;QACtD,eAAe,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QACxD,2GAA2G;QAC3G,YAAY,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACjD,2EAA2E;QAC3E,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;QAClE,iDAAiD;QACjD,YAAY,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;KAClD,CAAC;IACF,2BAA2B;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB"}
|
|
@@ -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 /** 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 /** 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 };\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 { 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 /** 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageEditor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/ImageEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ImageEditor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/ImageEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,EAAE,EAKH,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AA6BtC,eAAO,MAAM,aAAa,QAAc,CAAC;AAEzC,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;CAAE,CA2YpF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|