@pega/cosmos-react-rte 4.0.0-dev.2.0 → 4.0.0-dev.20.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.
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +9 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +239 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +23 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js +2 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +322 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.js +27 -0
- package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -0
- package/lib/components/DynamicContentEditor/index.d.ts +3 -0
- package/lib/components/DynamicContentEditor/index.d.ts.map +1 -0
- package/lib/components/DynamicContentEditor/index.js +2 -0
- package/lib/components/DynamicContentEditor/index.js.map +1 -0
- package/lib/components/Editor/Editor.d.ts.map +1 -1
- package/lib/components/Editor/Editor.js +10 -8
- package/lib/components/Editor/Editor.js.map +1 -1
- package/lib/components/Editor/Editor.styles.d.ts +1 -0
- package/lib/components/Editor/Editor.styles.d.ts.map +1 -1
- package/lib/components/Editor/Editor.styles.js +9 -1
- package/lib/components/Editor/Editor.styles.js.map +1 -1
- package/lib/components/Editor/Editor.types.d.ts +3 -3
- package/lib/components/Editor/Editor.types.d.ts.map +1 -1
- package/lib/components/Editor/ImageEditor.d.ts.map +1 -1
- package/lib/components/Editor/ImageEditor.js +22 -17
- package/lib/components/Editor/ImageEditor.js.map +1 -1
- package/lib/components/Editor/Toolbar/TextSelect.d.ts +1 -1
- package/lib/components/Editor/Toolbar/TextSelect.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/TextSelect.js +1 -1
- package/lib/components/Editor/Toolbar/TextSelect.js.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/Editor/Toolbar/Toolbar.js +15 -9
- package/lib/components/Editor/Toolbar/Toolbar.js.map +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/Link.d.ts.map +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/Link.js +1 -1
- package/lib/components/RichTextEditor/DecoratorComponents/Link.js.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.js +8 -7
- package/lib/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.styles.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.styles.js +8 -10
- package/lib/components/RichTextEditor/RichTextEditor.styles.js.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.types.d.ts +2 -2
- package/lib/components/RichTextEditor/RichTextEditor.types.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextEditor.types.js.map +1 -1
- package/lib/components/RichTextEditor/RichTextTreeRenderer.d.ts +1 -1
- package/lib/components/RichTextEditor/RichTextTreeRenderer.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.js +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.js.map +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.types.d.ts +5 -5
- package/lib/components/RichTextEditor/RichTextViewer.types.d.ts.map +1 -1
- package/lib/components/RichTextEditor/RichTextViewer.types.js.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/TextSelect.d.ts.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/TextSelect.js +1 -1
- package/lib/components/RichTextEditor/Toolbar/TextSelect.js.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/Toolbar.js +14 -8
- package/lib/components/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/lib/components/RichTextEditor/Toolbar/Toolbar.types.d.ts +4 -4
- package/lib/components/RichTextEditor/Toolbar/Toolbar.types.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/EditorCommands.d.ts +3 -2
- package/lib/components/RichTextEditor/utils/EditorCommands.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/EditorCommands.js +6 -1
- package/lib/components/RichTextEditor/utils/EditorCommands.js.map +1 -1
- package/lib/components/RichTextEditor/utils/ListCommands.js +10 -10
- package/lib/components/RichTextEditor/utils/ListCommands.js.map +1 -1
- package/lib/components/RichTextEditor/utils/htmlConverter.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/htmlConverter.js +2 -4
- package/lib/components/RichTextEditor/utils/htmlConverter.js.map +1 -1
- package/lib/components/RichTextEditor/utils/interactionRenderer.js +6 -6
- package/lib/components/RichTextEditor/utils/interactionRenderer.js.map +1 -1
- package/lib/components/RichTextEditor/utils/markdownConverter.js +3 -3
- package/lib/components/RichTextEditor/utils/markdownConverter.js.map +1 -1
- package/lib/components/RichTextEditor/utils/renderers.d.ts +1 -1
- package/lib/components/RichTextEditor/utils/renderers.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/renderers.js +4 -4
- package/lib/components/RichTextEditor/utils/renderers.js.map +1 -1
- package/lib/components/RichTextEditor/utils/slateConverter.d.ts.map +1 -1
- package/lib/components/RichTextEditor/utils/slateConverter.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
export declare const pegaReferenceElementStyle = "pega-reference {\n color: #076bc9;\n cursor: pointer;\n}\n\npega-reference:hover{\n text-decoration: underline;\n}\n\npega-reference::before{\n content: '['\n}\n\npega-reference::after{\n content: ']'\n}";
|
|
2
|
+
export declare const createPegaReferenceElement: (win: typeof globalThis) => {
|
|
3
|
+
new (): {
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
accessKey: string;
|
|
6
|
+
readonly accessKeyLabel: string;
|
|
7
|
+
autocapitalize: string;
|
|
8
|
+
dir: string;
|
|
9
|
+
draggable: boolean;
|
|
10
|
+
hidden: boolean;
|
|
11
|
+
inert: boolean;
|
|
12
|
+
innerText: string;
|
|
13
|
+
lang: string;
|
|
14
|
+
readonly offsetHeight: number;
|
|
15
|
+
readonly offsetLeft: number;
|
|
16
|
+
readonly offsetParent: Element | null;
|
|
17
|
+
readonly offsetTop: number;
|
|
18
|
+
readonly offsetWidth: number;
|
|
19
|
+
outerText: string;
|
|
20
|
+
spellcheck: boolean;
|
|
21
|
+
title: string;
|
|
22
|
+
translate: boolean;
|
|
23
|
+
attachInternals(): ElementInternals;
|
|
24
|
+
click(): void;
|
|
25
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
26
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
27
|
+
removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
28
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
29
|
+
readonly attributes: NamedNodeMap;
|
|
30
|
+
readonly classList: DOMTokenList;
|
|
31
|
+
className: string;
|
|
32
|
+
readonly clientHeight: number;
|
|
33
|
+
readonly clientLeft: number;
|
|
34
|
+
readonly clientTop: number;
|
|
35
|
+
readonly clientWidth: number;
|
|
36
|
+
id: string;
|
|
37
|
+
readonly localName: string;
|
|
38
|
+
readonly namespaceURI: string | null;
|
|
39
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
40
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
41
|
+
outerHTML: string;
|
|
42
|
+
readonly ownerDocument: Document;
|
|
43
|
+
readonly part: DOMTokenList;
|
|
44
|
+
readonly prefix: string | null;
|
|
45
|
+
readonly scrollHeight: number;
|
|
46
|
+
scrollLeft: number;
|
|
47
|
+
scrollTop: number;
|
|
48
|
+
readonly scrollWidth: number;
|
|
49
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
50
|
+
slot: string;
|
|
51
|
+
readonly tagName: string;
|
|
52
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
53
|
+
checkVisibility(options?: CheckVisibilityOptions | undefined): boolean;
|
|
54
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
55
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
56
|
+
closest<K_4 extends keyof MathMLElementTagNameMap>(selector: K_4): MathMLElementTagNameMap[K_4] | null;
|
|
57
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
58
|
+
getAttribute(qualifiedName: string): string | null;
|
|
59
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
60
|
+
getAttributeNames(): string[];
|
|
61
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
62
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
63
|
+
getBoundingClientRect(): DOMRect;
|
|
64
|
+
getClientRects(): DOMRectList;
|
|
65
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
66
|
+
getElementsByTagName<K_5 extends keyof HTMLElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<HTMLElementTagNameMap[K_5]>;
|
|
67
|
+
getElementsByTagName<K_6 extends keyof SVGElementTagNameMap>(qualifiedName: K_6): HTMLCollectionOf<SVGElementTagNameMap[K_6]>;
|
|
68
|
+
getElementsByTagName<K_7 extends keyof MathMLElementTagNameMap>(qualifiedName: K_7): HTMLCollectionOf<MathMLElementTagNameMap[K_7]>;
|
|
69
|
+
getElementsByTagName<K_8 extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K_8): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K_8]>;
|
|
70
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
71
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
72
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
73
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
|
|
74
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
75
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
76
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
77
|
+
hasAttributes(): boolean;
|
|
78
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
79
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
80
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
81
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
82
|
+
matches(selectors: string): boolean;
|
|
83
|
+
releasePointerCapture(pointerId: number): void;
|
|
84
|
+
removeAttribute(qualifiedName: string): void;
|
|
85
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
86
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
87
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
88
|
+
requestPointerLock(): void;
|
|
89
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
90
|
+
scroll(x: number, y: number): void;
|
|
91
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
92
|
+
scrollBy(x: number, y: number): void;
|
|
93
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
94
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
95
|
+
scrollTo(x: number, y: number): void;
|
|
96
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
97
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
98
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
99
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
100
|
+
setPointerCapture(pointerId: number): void;
|
|
101
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
102
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
103
|
+
readonly baseURI: string;
|
|
104
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
105
|
+
readonly firstChild: ChildNode | null;
|
|
106
|
+
readonly isConnected: boolean;
|
|
107
|
+
readonly lastChild: ChildNode | null;
|
|
108
|
+
readonly nextSibling: ChildNode | null;
|
|
109
|
+
readonly nodeName: string;
|
|
110
|
+
readonly nodeType: number;
|
|
111
|
+
nodeValue: string | null;
|
|
112
|
+
readonly parentElement: HTMLElement | null;
|
|
113
|
+
readonly parentNode: ParentNode | null;
|
|
114
|
+
readonly previousSibling: ChildNode | null;
|
|
115
|
+
textContent: string | null;
|
|
116
|
+
appendChild<T extends Node>(node: T): T;
|
|
117
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
118
|
+
compareDocumentPosition(other: Node): number;
|
|
119
|
+
contains(other: Node | null): boolean;
|
|
120
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
121
|
+
hasChildNodes(): boolean;
|
|
122
|
+
insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
|
|
123
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
124
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
125
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
126
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
127
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
128
|
+
normalize(): void;
|
|
129
|
+
removeChild<T_2 extends Node>(child: T_2): T_2;
|
|
130
|
+
replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
|
|
131
|
+
readonly ELEMENT_NODE: 1;
|
|
132
|
+
readonly ATTRIBUTE_NODE: 2;
|
|
133
|
+
readonly TEXT_NODE: 3;
|
|
134
|
+
readonly CDATA_SECTION_NODE: 4;
|
|
135
|
+
readonly ENTITY_REFERENCE_NODE: 5;
|
|
136
|
+
readonly ENTITY_NODE: 6;
|
|
137
|
+
readonly PROCESSING_INSTRUCTION_NODE: 7;
|
|
138
|
+
readonly COMMENT_NODE: 8;
|
|
139
|
+
readonly DOCUMENT_NODE: 9;
|
|
140
|
+
readonly DOCUMENT_TYPE_NODE: 10;
|
|
141
|
+
readonly DOCUMENT_FRAGMENT_NODE: 11;
|
|
142
|
+
readonly NOTATION_NODE: 12;
|
|
143
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: 1;
|
|
144
|
+
readonly DOCUMENT_POSITION_PRECEDING: 2;
|
|
145
|
+
readonly DOCUMENT_POSITION_FOLLOWING: 4;
|
|
146
|
+
readonly DOCUMENT_POSITION_CONTAINS: 8;
|
|
147
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
|
|
148
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
|
|
149
|
+
dispatchEvent(event: Event): boolean;
|
|
150
|
+
ariaAtomic: string | null;
|
|
151
|
+
ariaAutoComplete: string | null;
|
|
152
|
+
ariaBusy: string | null;
|
|
153
|
+
ariaChecked: string | null;
|
|
154
|
+
ariaColCount: string | null;
|
|
155
|
+
ariaColIndex: string | null;
|
|
156
|
+
ariaColSpan: string | null;
|
|
157
|
+
ariaCurrent: string | null;
|
|
158
|
+
ariaDisabled: string | null;
|
|
159
|
+
ariaExpanded: string | null;
|
|
160
|
+
ariaHasPopup: string | null;
|
|
161
|
+
ariaHidden: string | null;
|
|
162
|
+
ariaInvalid: string | null;
|
|
163
|
+
ariaKeyShortcuts: string | null;
|
|
164
|
+
ariaLabel: string | null;
|
|
165
|
+
ariaLevel: string | null;
|
|
166
|
+
ariaLive: string | null;
|
|
167
|
+
ariaModal: string | null;
|
|
168
|
+
ariaMultiLine: string | null;
|
|
169
|
+
ariaMultiSelectable: string | null;
|
|
170
|
+
ariaOrientation: string | null;
|
|
171
|
+
ariaPlaceholder: string | null;
|
|
172
|
+
ariaPosInSet: string | null;
|
|
173
|
+
ariaPressed: string | null;
|
|
174
|
+
ariaReadOnly: string | null;
|
|
175
|
+
ariaRequired: string | null;
|
|
176
|
+
ariaRoleDescription: string | null;
|
|
177
|
+
ariaRowCount: string | null;
|
|
178
|
+
ariaRowIndex: string | null;
|
|
179
|
+
ariaRowSpan: string | null;
|
|
180
|
+
ariaSelected: string | null;
|
|
181
|
+
ariaSetSize: string | null;
|
|
182
|
+
ariaSort: string | null;
|
|
183
|
+
ariaValueMax: string | null;
|
|
184
|
+
ariaValueMin: string | null;
|
|
185
|
+
ariaValueNow: string | null;
|
|
186
|
+
ariaValueText: string | null;
|
|
187
|
+
role: string | null;
|
|
188
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
189
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
190
|
+
after(...nodes: (string | Node)[]): void;
|
|
191
|
+
before(...nodes: (string | Node)[]): void;
|
|
192
|
+
remove(): void;
|
|
193
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
194
|
+
innerHTML: string;
|
|
195
|
+
readonly nextElementSibling: Element | null;
|
|
196
|
+
readonly previousElementSibling: Element | null;
|
|
197
|
+
readonly childElementCount: number;
|
|
198
|
+
readonly children: HTMLCollection;
|
|
199
|
+
readonly firstElementChild: Element | null;
|
|
200
|
+
readonly lastElementChild: Element | null;
|
|
201
|
+
append(...nodes: (string | Node)[]): void;
|
|
202
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
203
|
+
querySelector<K_9 extends keyof HTMLElementTagNameMap>(selectors: K_9): HTMLElementTagNameMap[K_9] | null;
|
|
204
|
+
querySelector<K_10 extends keyof SVGElementTagNameMap>(selectors: K_10): SVGElementTagNameMap[K_10] | null;
|
|
205
|
+
querySelector<K_11 extends keyof MathMLElementTagNameMap>(selectors: K_11): MathMLElementTagNameMap[K_11] | null;
|
|
206
|
+
querySelector<K_12 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_12): HTMLElementDeprecatedTagNameMap[K_12] | null;
|
|
207
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
208
|
+
querySelectorAll<K_13 extends keyof HTMLElementTagNameMap>(selectors: K_13): NodeListOf<HTMLElementTagNameMap[K_13]>;
|
|
209
|
+
querySelectorAll<K_14 extends keyof SVGElementTagNameMap>(selectors: K_14): NodeListOf<SVGElementTagNameMap[K_14]>;
|
|
210
|
+
querySelectorAll<K_15 extends keyof MathMLElementTagNameMap>(selectors: K_15): NodeListOf<MathMLElementTagNameMap[K_15]>;
|
|
211
|
+
querySelectorAll<K_16 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_16): NodeListOf<HTMLElementDeprecatedTagNameMap[K_16]>;
|
|
212
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
213
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
214
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
215
|
+
readonly style: CSSStyleDeclaration;
|
|
216
|
+
contentEditable: string;
|
|
217
|
+
enterKeyHint: string;
|
|
218
|
+
inputMode: string;
|
|
219
|
+
readonly isContentEditable: boolean;
|
|
220
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
221
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
222
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
223
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
224
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
225
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
226
|
+
onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
|
|
227
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
228
|
+
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
229
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
230
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
231
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
232
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
233
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
234
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
235
|
+
oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
236
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
237
|
+
oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
238
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
239
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
240
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
241
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
242
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
243
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
244
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
245
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
246
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
247
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
248
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
249
|
+
onerror: OnErrorEventHandler;
|
|
250
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
251
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
252
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
253
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
254
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
255
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
256
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
257
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
258
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
259
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
260
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
261
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
262
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
263
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
264
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
265
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
266
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
267
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
268
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
269
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
270
|
+
onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
271
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
273
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
274
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
275
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
276
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
277
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
278
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
279
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
280
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
281
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
282
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
283
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
284
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
285
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
286
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
287
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
288
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
289
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
290
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
291
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
292
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
293
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
294
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
295
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
296
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
299
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
300
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
301
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
302
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
303
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
304
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
305
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
306
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
307
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
308
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
309
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
310
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
311
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
312
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
313
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
314
|
+
autofocus: boolean;
|
|
315
|
+
readonly dataset: DOMStringMap;
|
|
316
|
+
nonce?: string | undefined;
|
|
317
|
+
tabIndex: number;
|
|
318
|
+
blur(): void;
|
|
319
|
+
focus(options?: FocusOptions | undefined): void;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
//# sourceMappingURL=PegaCustomElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PegaCustomElement.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/PegaCustomElement.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,qNAgBpC,CAAC;AAEH,eAAO,MAAM,0BAA0B,QAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQhE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const pegaReferenceElementStyle = `\
|
|
2
|
+
pega-reference {
|
|
3
|
+
color: #076bc9;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
pega-reference:hover{
|
|
8
|
+
text-decoration: underline;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
pega-reference::before{
|
|
12
|
+
content: '['
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
pega-reference::after{
|
|
16
|
+
content: ']'
|
|
17
|
+
}`;
|
|
18
|
+
export const createPegaReferenceElement = (win) => {
|
|
19
|
+
return class PegaReferenceElement extends win.HTMLElement {
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
const template = document.createElement('template');
|
|
22
|
+
const temp = document.importNode(template.content, true);
|
|
23
|
+
this.append(temp);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=PegaCustomElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PegaCustomElement.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/PegaCustomElement.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;EAgBvC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,GAAsB,EAAE,EAAE;IACnE,OAAO,MAAM,oBAAqB,SAAQ,GAAG,CAAC,WAAW;QACvD,iBAAiB;YACf,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["export const pegaReferenceElementStyle = `\\\npega-reference {\n color: #076bc9;\n cursor: pointer;\n}\n\npega-reference:hover{\n text-decoration: underline;\n}\n\npega-reference::before{\n content: '['\n}\n\npega-reference::after{\n content: ']'\n}`;\n\nexport const createPegaReferenceElement = (win: typeof globalThis) => {\n return class PegaReferenceElement extends win.HTMLElement {\n connectedCallback() {\n const template = document.createElement('template');\n const temp = document.importNode(template.content, true);\n this.append(temp);\n }\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DynamicContentEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { default } from './DynamicContentEditor';\nexport { DynamicContentEditorProps, ItemType } from './DynamicContentEditor.types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AACA,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,EAAE,
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":"AACA,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,EAAE,EAWH,MAAM,OAAO,CAAC;AACf,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI9D,OAAO,EAIL,YAAY,EASb,MAAM,yBAAyB,CAAC;AAejC,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAmB1D,eAAO,MAAM,cAAc,UAAW,YAAY,WAQjD,CAAC;AAEF,eAAO,MAAM,iBAAiB;qBAAiC,OAAO;SAarE,CAAC;AAIF,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,GAAG,YAAY,CA+b1C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -6,7 +6,7 @@ import 'tinymce/plugins/advlist';
|
|
|
6
6
|
import 'tinymce/plugins/lists';
|
|
7
7
|
import 'tinymce/plugins/autolink';
|
|
8
8
|
import 'tinymce/models/dom';
|
|
9
|
-
import { forwardRef, useEffect, useRef, useState, useLayoutEffect, useImperativeHandle } from 'react';
|
|
9
|
+
import { forwardRef, useEffect, useRef, useState, useLayoutEffect, useImperativeHandle, useCallback, useMemo } from 'react';
|
|
10
10
|
import styled, { css } from 'styled-components';
|
|
11
11
|
import { compile, serialize, stringify } from 'stylis';
|
|
12
12
|
import { stripUnit } from 'polished';
|
|
@@ -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, StyledEditorContainer } from './Editor.styles';
|
|
21
|
+
import { offscreenSelectionStyles, placeholderStyles, mceContentBodyStyles, StyledEditorContainer } from './Editor.styles';
|
|
22
22
|
const getFileFromUrl = async (url, name) => {
|
|
23
23
|
const response = await fetch(url);
|
|
24
24
|
const data = await response.blob();
|
|
@@ -165,6 +165,7 @@ const Editor = forwardRef((props, ref) => {
|
|
|
165
165
|
toolbar: false,
|
|
166
166
|
menubar: false,
|
|
167
167
|
plugins: 'lists advlist autolink',
|
|
168
|
+
paste_block_drop: true,
|
|
168
169
|
paste_data_images: true,
|
|
169
170
|
lists_indent_on_tab: true,
|
|
170
171
|
icons: '',
|
|
@@ -174,9 +175,9 @@ const Editor = forwardRef((props, ref) => {
|
|
|
174
175
|
content_css: false,
|
|
175
176
|
browser_spellcheck: spellcheck,
|
|
176
177
|
paste_preprocess: pastePreprocess,
|
|
177
|
-
content_style: `${createGlobalRootStyles(theme)} ${globalSpacingStyles} ${createGlobalBodyStyles(theme)} body { min-height: 3rem; padding: ${
|
|
178
|
+
content_style: `${createGlobalRootStyles(theme)} ${globalSpacingStyles} ${createGlobalBodyStyles(theme)} body { min-height: 3rem; padding: ${theme.base.spacing}; } html { overflow: hidden; } ${offscreenSelectionStyles} ${mceContentBodyStyles} ${placeholderStyles} ${imageStyles} ${styles}`,
|
|
178
179
|
init_instance_callback: initializedEditor => {
|
|
179
|
-
const iframeWindow = tinyMceContainerRef.current?.querySelector('iframe').contentWindow;
|
|
180
|
+
const iframeWindow = (tinyMceContainerRef.current?.querySelector('iframe')).contentWindow;
|
|
180
181
|
const editorCustomElements = iframeWindow?.customElements;
|
|
181
182
|
if (editorCustomElements) {
|
|
182
183
|
customComponents.forEach(({ name, createCustomElement: customElementCreator, style }) => {
|
|
@@ -194,7 +195,7 @@ const Editor = forwardRef((props, ref) => {
|
|
|
194
195
|
extended_valid_elements: `${customComponents
|
|
195
196
|
.map(comp => `${comp.name}${comp.extensionAttributes ? `[${comp.extensionAttributes.join('|')}]` : ''}`)
|
|
196
197
|
.join(',')}`,
|
|
197
|
-
custom_elements:
|
|
198
|
+
custom_elements: customComponents.map(comp => `~${comp.name}`).join('~,'),
|
|
198
199
|
setup: editorSettings => {
|
|
199
200
|
editorSettings.on('keydown', e => {
|
|
200
201
|
onKeyDown?.(e);
|
|
@@ -302,13 +303,14 @@ const Editor = forwardRef((props, ref) => {
|
|
|
302
303
|
useAfterInitialEffect(() => {
|
|
303
304
|
editor?.mode.set(readOnly || disabled ? 'readonly' : 'design');
|
|
304
305
|
}, [readOnly, disabled]);
|
|
305
|
-
const addImage = (image) => {
|
|
306
|
+
const addImage = useCallback((image) => {
|
|
306
307
|
if (editor) {
|
|
307
308
|
const imageId = createUID();
|
|
308
309
|
editor.insertContent(`<br/><img src='' id='${imageId}' style="max-width: 100%;"/><br/>`);
|
|
309
310
|
onImageAdded?.(image, imageId);
|
|
310
311
|
}
|
|
311
|
-
};
|
|
312
|
+
}, [editor]);
|
|
313
|
+
const ctx = useMemo(() => ({ addImage, editor: editor || {} }), [editor, addImage]);
|
|
312
314
|
useEffect(() => {
|
|
313
315
|
const onEditorDrop = (e) => {
|
|
314
316
|
e.preventDefault();
|
|
@@ -333,7 +335,7 @@ const Editor = forwardRef((props, ref) => {
|
|
|
333
335
|
resizeObserver.disconnect();
|
|
334
336
|
};
|
|
335
337
|
}, [editor, resizeEditor]);
|
|
336
|
-
return (_jsxs(EditorContext.Provider, { value:
|
|
338
|
+
return (_jsxs(EditorContext.Provider, { value: ctx, children: [_jsx(FormField, { as: StyledRichTextFormField, toolbar: renderToolbar, label:
|
|
337
339
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
338
340
|
_jsx("span", { onClick: () => {
|
|
339
341
|
editor?.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAiD,MAAM,iBAAiB,CAAC;AAChF,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,EAEL,UAAU,EAEV,SAAS,EACT,MA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EAAE,CAAC,MAAM,CAAC,GAClC,CACH,IACqB,EACvB,aAAa,IAAI,CAChB,KAAC,OAAO,IAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAI,CAC7E,IACW,GACJ,EACX,QAAQ,IACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import tinymce, { 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 FC,\n forwardRef,\n PropsWithoutRef,\n useEffect,\n useRef,\n useState,\n useLayoutEffect,\n useImperativeHandle,\n FocusEvent\n} from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { compile, serialize, stringify } from 'stylis';\nimport { stripUnit } from 'polished';\n\nimport {\n createUID,\n FormControl,\n FormField,\n ForwardProps,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useI18n,\n useConsolidatedRef,\n defaultThemeProp,\n useAutoResize,\n useConfiguration\n} 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, {\n StyledRichTextFormField\n} from '../RichTextEditor/RichTextEditor.styles';\n\nimport Toolbar from './Toolbar/Toolbar';\nimport EditorContext from './Editor.context';\nimport { getTextFormats } from './Toolbar/TextSelect';\nimport { EditorProps, EditorState } from './Editor.types';\nimport ImageEditor, { imgHoverClass } from './ImageEditor';\nimport {\n offscreenSelectionStyles,\n placeholderStyles,\n StyledEditorContainer\n} from './Editor.styles';\n\ntype ImageInfoArray = { id: string; url: 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(\n (props: PropsWithoutRef<EditorProps>, ref: EditorProps['ref']) => {\n const {\n components: {\n 'text-area': { 'min-height': textAreaMinHeight }\n }\n } = useTheme();\n const theme = useTheme();\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 {\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 ...restProps\n } = props;\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 renderToolbar = editor && toolbar.length > 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 imgInfo.push({ id: imgId, url });\n imgEl.setAttribute('id', imgId);\n imgEl.setAttribute('src', '');\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 appendImage: ({ src, alt }, imageId) => {\n if (editor) {\n const editorEl = editor.getDoc();\n const imageEl = editorEl.querySelector(`#${imageId}`);\n if (imageEl) {\n imageEl.setAttribute('src', src);\n imageEl.setAttribute('alt', alt);\n resizeEditor();\n }\n }\n },\n insertText: (text: string) => {\n editor?.insertContent(text);\n },\n setCursorLocationToStart: () => {\n editor?.selection.setCursorLocation();\n editor?.selection.getNode().scrollIntoView();\n },\n insertHtml: (html: string, overwrite: boolean = false) => {\n if (overwrite) {\n editor?.setContent('');\n }\n editor?.insertContent(html);\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 tinymce\n .init({\n readonly: readOnly || disabled,\n skin: false,\n target: tinyMceRef.current,\n toolbar: false,\n menubar: false,\n plugins: 'lists advlist autolink',\n paste_data_images: true,\n lists_indent_on_tab: true,\n icons: '',\n branding: false,\n elementpath: false,\n placeholder,\n content_css: false,\n browser_spellcheck: spellcheck,\n paste_preprocess: pastePreprocess,\n content_style: `${createGlobalRootStyles(\n theme\n )} ${globalSpacingStyles} ${createGlobalBodyStyles(\n theme\n )} body { min-height: 3rem; padding: ${\n toolbar.length > 0 && !readOnly ? theme.base.spacing : 0\n }; } html { overflow: hidden; } ${offscreenSelectionStyles} ${placeholderStyles} ${imageStyles} ${styles}`,\n init_instance_callback: initializedEditor => {\n const iframeWindow = (\n tinyMceContainerRef.current?.querySelector('iframe') as HTMLIFrameElement\n ).contentWindow;\n const editorCustomElements = iframeWindow?.customElements;\n if (editorCustomElements) {\n customComponents.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 styleEl = document.createElement('style');\n styleEl.innerText = style;\n initializedEditor.getDoc().head.appendChild(styleEl);\n }\n }\n );\n }\n },\n extended_valid_elements: `${customComponents\n .map(\n comp =>\n `${comp.name}${\n comp.extensionAttributes ? `[${comp.extensionAttributes.join('|')}]` : ''\n }`\n )\n .join(',')}`,\n custom_elements: `~${customComponents.map(comp => comp.name).join('~,')}`,\n setup: editorSettings => {\n editorSettings.on('keydown', e => {\n 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 || initialized.current) return;\n initialized.current = true;\n onInit?.(editor);\n }, [editor, onInit]);\n\n useEffect(() => {\n if (!editor) return;\n const onChangeEvents = ['input', 'paste', 'FormatApply', 'FormatRemove', 'ExecCommand'];\n const onEditorKeyDown = (event: EditorEvent<KeyboardEvent>) => {\n resizeEditor();\n if (event.key === 'Enter') {\n editor.selection.getNode().scrollIntoView(false);\n }\n };\n const onEditorChange = (event: EditorEvent<Event & { command?: string }>) => {\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 useAfterInitialEffect(() => {\n editor?.mode.set(readOnly || disabled ? 'readonly' : 'design');\n }, [readOnly, disabled]);\n\n const addImage = (image: File) => {\n if (editor) {\n const imageId = createUID();\n editor.insertContent(`<br/><img src='' id='${imageId}' style=\"max-width: 100%;\"/><br/>`);\n onImageAdded?.(image, imageId);\n }\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={{ addImage, editor: editor || ({} as TinymceEditor) }}>\n <FormField\n as={StyledRichTextFormField}\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 >\n <FormControl\n {...restProps}\n ref={editorRef}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n as={StyledRichTextEditor}\n toolbar={renderToolbar}\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 features={toolbar} editor={editor} customActions={customActions} />\n )}\n </FormControl>\n </FormField>\n {children}\n </EditorContext.Provider>\n );\n }\n);\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/components/Editor/Editor.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAiD,MAAM,iBAAiB,CAAC;AAChF,OAAO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,CAAC,gBACN,GAAG,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,qBAClE,OAAO,EACxB,GAAG,EAAE,UAAU,GACf,EACD,mBAAmB,CAAC,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,IAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAI,CAC7E,IACW,GACJ,EACX,QAAQ,IACc,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import tinymce, { 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 FC,\n forwardRef,\n PropsWithoutRef,\n useEffect,\n useRef,\n useState,\n useLayoutEffect,\n useImperativeHandle,\n FocusEvent,\n useCallback,\n useMemo\n} from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { compile, serialize, stringify } from 'stylis';\nimport { stripUnit } from 'polished';\n\nimport {\n createUID,\n FormControl,\n FormField,\n ForwardProps,\n useAfterInitialEffect,\n useTheme,\n useUID,\n useI18n,\n useConsolidatedRef,\n defaultThemeProp,\n useAutoResize,\n useConfiguration\n} 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, {\n StyledRichTextFormField\n} from '../RichTextEditor/RichTextEditor.styles';\n\nimport Toolbar from './Toolbar/Toolbar';\nimport EditorContext from './Editor.context';\nimport { getTextFormats } from './Toolbar/TextSelect';\nimport { EditorProps, EditorState } from './Editor.types';\nimport ImageEditor, { imgHoverClass } from './ImageEditor';\nimport {\n offscreenSelectionStyles,\n placeholderStyles,\n mceContentBodyStyles,\n StyledEditorContainer\n} from './Editor.styles';\n\ntype ImageInfoArray = { id: string; url: 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(\n (props: PropsWithoutRef<EditorProps>, ref: EditorProps['ref']) => {\n const {\n components: {\n 'text-area': { 'min-height': textAreaMinHeight }\n }\n } = useTheme();\n const theme = useTheme();\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 {\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 ...restProps\n } = props;\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 renderToolbar = editor && toolbar.length > 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 imgInfo.push({ id: imgId, url });\n imgEl.setAttribute('id', imgId);\n imgEl.setAttribute('src', '');\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 appendImage: ({ src, alt }, imageId) => {\n if (editor) {\n const editorEl = editor.getDoc();\n const imageEl = editorEl.querySelector(`#${imageId}`);\n if (imageEl) {\n imageEl.setAttribute('src', src);\n imageEl.setAttribute('alt', alt);\n resizeEditor();\n }\n }\n },\n insertText: (text: string) => {\n editor?.insertContent(text);\n },\n setCursorLocationToStart: () => {\n editor?.selection.setCursorLocation();\n editor?.selection.getNode().scrollIntoView();\n },\n insertHtml: (html: string, overwrite: boolean = false) => {\n if (overwrite) {\n editor?.setContent('');\n }\n editor?.insertContent(html);\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 tinymce\n .init({\n readonly: readOnly || disabled,\n skin: false,\n target: tinyMceRef.current,\n toolbar: false,\n menubar: false,\n plugins: 'lists advlist autolink',\n paste_block_drop: true,\n paste_data_images: true,\n lists_indent_on_tab: true,\n icons: '',\n branding: false,\n elementpath: false,\n placeholder,\n content_css: false,\n browser_spellcheck: spellcheck,\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 const iframeWindow = (\n tinyMceContainerRef.current?.querySelector('iframe') as HTMLIFrameElement\n ).contentWindow;\n const editorCustomElements = iframeWindow?.customElements;\n if (editorCustomElements) {\n customComponents.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 styleEl = document.createElement('style');\n styleEl.innerText = style;\n initializedEditor.getDoc().head.appendChild(styleEl);\n }\n }\n );\n }\n },\n extended_valid_elements: `${customComponents\n .map(\n comp =>\n `${comp.name}${\n comp.extensionAttributes ? `[${comp.extensionAttributes.join('|')}]` : ''\n }`\n )\n .join(',')}`,\n custom_elements: customComponents.map(comp => `~${comp.name}`).join('~,'),\n setup: editorSettings => {\n editorSettings.on('keydown', e => {\n 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 || initialized.current) return;\n initialized.current = true;\n onInit?.(editor);\n }, [editor, onInit]);\n\n useEffect(() => {\n if (!editor) return;\n const onChangeEvents = ['input', 'paste', 'FormatApply', 'FormatRemove', 'ExecCommand'];\n const onEditorKeyDown = (event: EditorEvent<KeyboardEvent>) => {\n resizeEditor();\n if (event.key === 'Enter') {\n editor.selection.getNode().scrollIntoView(false);\n }\n };\n const onEditorChange = (event: EditorEvent<Event & { command?: string }>) => {\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 useAfterInitialEffect(() => {\n editor?.mode.set(readOnly || disabled ? 'readonly' : 'design');\n }, [readOnly, disabled]);\n\n const addImage = useCallback(\n (image: File) => {\n if (editor) {\n const imageId = createUID();\n editor.insertContent(`<br/><img src='' id='${imageId}' style=\"max-width: 100%;\"/><br/>`);\n onImageAdded?.(image, imageId);\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 as={StyledRichTextFormField}\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 >\n <FormControl\n {...restProps}\n ref={editorRef}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n as={StyledRichTextEditor}\n toolbar={renderToolbar}\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 features={toolbar} editor={editor} customActions={customActions} />\n )}\n </FormControl>\n </FormField>\n {children}\n </EditorContext.Provider>\n );\n }\n);\n\nexport default Editor;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
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";
|
|
2
3
|
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";
|
|
3
4
|
export declare const StyledEditorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
4
5
|
//# sourceMappingURL=Editor.styles.d.ts.map
|