@pega/cosmos-react-demos 2.1.5 → 2.2.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/jsx/rte/Editor/Editor.mocks.d.ts +307 -0
- package/jsx/rte/Editor/Editor.mocks.d.ts.map +1 -0
- package/jsx/rte/Editor/Editor.mocks.jsx +23 -0
- package/jsx/rte/Editor/Editor.mocks.jsx.map +1 -0
- package/jsx/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +9 -21
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/lib/rte/Editor/Editor.mocks.d.ts +307 -0
- package/lib/rte/Editor/Editor.mocks.d.ts.map +1 -0
- package/lib/rte/Editor/Editor.mocks.js +26 -0
- package/lib/rte/Editor/Editor.mocks.js.map +1 -0
- package/lib/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +9 -23
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export declare const label = "Form field label";
|
|
2
|
+
export declare const createPegaCustomElement: (win: typeof globalThis) => {
|
|
3
|
+
new (): {
|
|
4
|
+
removeElements(): void;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
accessKey: string;
|
|
7
|
+
readonly accessKeyLabel: string;
|
|
8
|
+
autocapitalize: string;
|
|
9
|
+
dir: string;
|
|
10
|
+
draggable: boolean;
|
|
11
|
+
hidden: 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
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
54
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
55
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
56
|
+
getAttribute(qualifiedName: string): string | null;
|
|
57
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
58
|
+
getAttributeNames(): string[];
|
|
59
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
60
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
61
|
+
getBoundingClientRect(): DOMRect;
|
|
62
|
+
getClientRects(): DOMRectList;
|
|
63
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
64
|
+
getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
|
|
65
|
+
getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
|
|
66
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
67
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
68
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
69
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
70
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
71
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
72
|
+
hasAttributes(): boolean;
|
|
73
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
74
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
75
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
76
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
77
|
+
matches(selectors: string): boolean;
|
|
78
|
+
releasePointerCapture(pointerId: number): void;
|
|
79
|
+
removeAttribute(qualifiedName: string): void;
|
|
80
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
81
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
82
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
83
|
+
requestPointerLock(): void;
|
|
84
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
85
|
+
scroll(x: number, y: number): void;
|
|
86
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
87
|
+
scrollBy(x: number, y: number): void;
|
|
88
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
89
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
90
|
+
scrollTo(x: number, y: number): void;
|
|
91
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
92
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
93
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
94
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
95
|
+
setPointerCapture(pointerId: number): void;
|
|
96
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
97
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
98
|
+
readonly baseURI: string;
|
|
99
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
100
|
+
readonly firstChild: ChildNode | null;
|
|
101
|
+
readonly isConnected: boolean;
|
|
102
|
+
readonly lastChild: ChildNode | null;
|
|
103
|
+
readonly nextSibling: ChildNode | null;
|
|
104
|
+
readonly nodeName: string;
|
|
105
|
+
readonly nodeType: number;
|
|
106
|
+
nodeValue: string | null;
|
|
107
|
+
readonly parentElement: HTMLElement | null;
|
|
108
|
+
readonly parentNode: ParentNode | null;
|
|
109
|
+
readonly previousSibling: ChildNode | null;
|
|
110
|
+
textContent: string | null;
|
|
111
|
+
appendChild<T extends Node>(node: T): T;
|
|
112
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
113
|
+
compareDocumentPosition(other: Node): number;
|
|
114
|
+
contains(other: Node | null): boolean;
|
|
115
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
116
|
+
hasChildNodes(): boolean;
|
|
117
|
+
insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
|
|
118
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
119
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
120
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
121
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
122
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
123
|
+
normalize(): void;
|
|
124
|
+
removeChild<T_2 extends Node>(child: T_2): T_2;
|
|
125
|
+
replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
|
|
126
|
+
readonly ATTRIBUTE_NODE: number;
|
|
127
|
+
readonly CDATA_SECTION_NODE: number;
|
|
128
|
+
readonly COMMENT_NODE: number;
|
|
129
|
+
readonly DOCUMENT_FRAGMENT_NODE: number;
|
|
130
|
+
readonly DOCUMENT_NODE: number;
|
|
131
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: number;
|
|
132
|
+
readonly DOCUMENT_POSITION_CONTAINS: number;
|
|
133
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: number;
|
|
134
|
+
readonly DOCUMENT_POSITION_FOLLOWING: number;
|
|
135
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
|
|
136
|
+
readonly DOCUMENT_POSITION_PRECEDING: number;
|
|
137
|
+
readonly DOCUMENT_TYPE_NODE: number;
|
|
138
|
+
readonly ELEMENT_NODE: number;
|
|
139
|
+
readonly ENTITY_NODE: number;
|
|
140
|
+
readonly ENTITY_REFERENCE_NODE: number;
|
|
141
|
+
readonly NOTATION_NODE: number;
|
|
142
|
+
readonly PROCESSING_INSTRUCTION_NODE: number;
|
|
143
|
+
readonly TEXT_NODE: number;
|
|
144
|
+
dispatchEvent(event: Event): boolean;
|
|
145
|
+
ariaAtomic: string;
|
|
146
|
+
ariaAutoComplete: string;
|
|
147
|
+
ariaBusy: string;
|
|
148
|
+
ariaChecked: string;
|
|
149
|
+
ariaColCount: string;
|
|
150
|
+
ariaColIndex: string;
|
|
151
|
+
ariaColSpan: string;
|
|
152
|
+
ariaCurrent: string;
|
|
153
|
+
ariaDisabled: string;
|
|
154
|
+
ariaExpanded: string;
|
|
155
|
+
ariaHasPopup: string;
|
|
156
|
+
ariaHidden: string;
|
|
157
|
+
ariaKeyShortcuts: string;
|
|
158
|
+
ariaLabel: string;
|
|
159
|
+
ariaLevel: string;
|
|
160
|
+
ariaLive: string;
|
|
161
|
+
ariaModal: string;
|
|
162
|
+
ariaMultiLine: string;
|
|
163
|
+
ariaMultiSelectable: string;
|
|
164
|
+
ariaOrientation: string;
|
|
165
|
+
ariaPlaceholder: string;
|
|
166
|
+
ariaPosInSet: string;
|
|
167
|
+
ariaPressed: string;
|
|
168
|
+
ariaReadOnly: string;
|
|
169
|
+
ariaRequired: string;
|
|
170
|
+
ariaRoleDescription: string;
|
|
171
|
+
ariaRowCount: string;
|
|
172
|
+
ariaRowIndex: string;
|
|
173
|
+
ariaRowSpan: string;
|
|
174
|
+
ariaSelected: string;
|
|
175
|
+
ariaSetSize: string;
|
|
176
|
+
ariaSort: string;
|
|
177
|
+
ariaValueMax: string;
|
|
178
|
+
ariaValueMin: string;
|
|
179
|
+
ariaValueNow: string;
|
|
180
|
+
ariaValueText: string;
|
|
181
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
182
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
183
|
+
after(...nodes: (string | Node)[]): void;
|
|
184
|
+
before(...nodes: (string | Node)[]): void;
|
|
185
|
+
remove(): void;
|
|
186
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
187
|
+
innerHTML: string;
|
|
188
|
+
readonly nextElementSibling: Element | null;
|
|
189
|
+
readonly previousElementSibling: Element | null;
|
|
190
|
+
readonly childElementCount: number;
|
|
191
|
+
readonly children: HTMLCollection;
|
|
192
|
+
readonly firstElementChild: Element | null;
|
|
193
|
+
readonly lastElementChild: Element | null;
|
|
194
|
+
append(...nodes: (string | Node)[]): void;
|
|
195
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
196
|
+
querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
|
|
197
|
+
querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
|
|
198
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
199
|
+
querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
|
|
200
|
+
querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
|
|
201
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
202
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
203
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
204
|
+
oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
205
|
+
oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
206
|
+
onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
207
|
+
readonly style: CSSStyleDeclaration;
|
|
208
|
+
contentEditable: string;
|
|
209
|
+
enterKeyHint: string;
|
|
210
|
+
inputMode: string;
|
|
211
|
+
readonly isContentEditable: boolean;
|
|
212
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
213
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
214
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
215
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
216
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
217
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
218
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
219
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
220
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
221
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
222
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
223
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
224
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
225
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
226
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
227
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
228
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
229
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
230
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
231
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
232
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
233
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
234
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
235
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
236
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
237
|
+
onerror: OnErrorEventHandler;
|
|
238
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
239
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
240
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
241
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
242
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
243
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
244
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
245
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
246
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
247
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
248
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
249
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
250
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
251
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
252
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
253
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
254
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
255
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
256
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
257
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
258
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
259
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
260
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
261
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
262
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
263
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
264
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
265
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
266
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
267
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
268
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
269
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
270
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
271
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
273
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
274
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
276
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
277
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
278
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
279
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
280
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
281
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
282
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
283
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
284
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
285
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
286
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
287
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
288
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
289
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
290
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
291
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
292
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
293
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
294
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
295
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
296
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
299
|
+
autofocus: boolean;
|
|
300
|
+
readonly dataset: DOMStringMap;
|
|
301
|
+
nonce?: string | undefined;
|
|
302
|
+
tabIndex: number;
|
|
303
|
+
blur(): void;
|
|
304
|
+
focus(options?: FocusOptions | undefined): void;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
//# sourceMappingURL=Editor.mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.mocks.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.mocks.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,qBAAqB,CAAC;AAYxC,eAAO,MAAM,uBAAuB,QAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB7D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ReactDOM from 'react-dom';
|
|
2
|
+
export const label = 'Form field label';
|
|
3
|
+
const PegaCustom = ({ children }) => {
|
|
4
|
+
return (<p style={{ color: 'blue', textTransform: 'uppercase' }} dangerouslySetInnerHTML={{ __html: children }}/>);
|
|
5
|
+
};
|
|
6
|
+
export const createPegaCustomElement = (win) => {
|
|
7
|
+
const HtmlElement = win.HTMLElement;
|
|
8
|
+
return class PegaCustomElement extends HtmlElement {
|
|
9
|
+
removeElements() {
|
|
10
|
+
while (this.firstChild) {
|
|
11
|
+
this.removeChild(this.firstChild);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
const inner = this.innerHTML;
|
|
16
|
+
this.removeElements();
|
|
17
|
+
const mountPoint = document.createElement('span');
|
|
18
|
+
this.appendChild(mountPoint);
|
|
19
|
+
ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=Editor.mocks.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.mocks.jsx","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.mocks.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAExC,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAwB,EAAE,EAAE;IACxD,OAAO,CACL,CAAC,CAAC,CACA,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,CAErD,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAC9C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAsB,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IACpC,OAAO,MAAM,iBAAkB,SAAQ,WAAW;QAChD,cAAc;YACZ,OAAO,IAAI,CAAC,UAAU,EAAE;gBACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACnC;QACH,CAAC;QAED,iBAAiB;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;YAC7B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC7B,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\n\nexport const label = 'Form field label';\n\nconst PegaCustom = ({ children }: { children: string }) => {\n return (\n <p\n style={{ color: 'blue', textTransform: 'uppercase' }}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: children }}\n />\n );\n};\n\nexport const createPegaCustomElement = (win: typeof globalThis) => {\n const HtmlElement = win.HTMLElement;\n return class PegaCustomElement extends HtmlElement {\n removeElements() {\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n }\n\n connectedCallback() {\n const inner = this.innerHTML;\n this.removeElements();\n const mountPoint = document.createElement('span');\n this.appendChild(mountPoint);\n ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);\n }\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;
|
|
1
|
+
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;AAkBxC,wBAGU;AAEV,eAAO,MAAM,UAAU,mBAmBtB,CAAC;AAEF,eAAO,MAAM,eAAe,mBAmB3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,mBAc7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,mBAmC/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,mBAkClC,CAAC;AAEF,eAAO,MAAM,6BAA6B,mBA8BzC,CAAC"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { useState, useRef } from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
2
|
import { action } from '@storybook/addon-actions';
|
|
4
3
|
import { Button, Card, CardContent, CardFooter, Flex, Text, TextArea } from '@pega/cosmos-react-core';
|
|
5
4
|
import { Editor } from '@pega/cosmos-react-rte';
|
|
5
|
+
import { createPegaCustomElement, label } from './Editor.mocks';
|
|
6
6
|
export default {
|
|
7
7
|
title: 'RTE/Editor',
|
|
8
8
|
component: Editor
|
|
9
9
|
};
|
|
10
|
-
const label = 'Form field label';
|
|
11
10
|
export const EditorDemo = () => {
|
|
12
11
|
const editorRef = useRef(null);
|
|
13
12
|
const onImageAdded = (image, id) => {
|
|
14
13
|
const src = URL.createObjectURL(image);
|
|
15
14
|
editorRef.current?.appendImage({ src, alt: image.name }, id);
|
|
16
15
|
};
|
|
17
|
-
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']} onFocus={action('Editor focused')} onBlur={action('Editor blurred')} onImageAdded={onImageAdded} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p
|
|
16
|
+
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']} onFocus={action('Editor focused')} onBlur={action('Editor blurred')} onImageAdded={onImageAdded} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>'/>);
|
|
18
17
|
};
|
|
19
18
|
export const EmptyEditorDemo = () => {
|
|
20
19
|
const editorRef = useRef(null);
|
|
@@ -33,30 +32,19 @@ export const ReadonlyFormField = () => {
|
|
|
33
32
|
<div id="on-github" class="on-github"><h3>Found a problem with this page?</h3><ul><li><a href="https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md" title="You're going to need to sign in to GitHub first (Opens in a new tab)" target="_blank" rel="noopener noreferrer">Edit on <b>GitHub</b></a></li><li><a href="https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md" title="Folder: en-us/web/html (Opens in a new tab)" target="_blank" rel="noopener noreferrer">Source on <b>GitHub</b></a></li><li><a href="https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML" title="This will take you to https://github.com/mdn/content to file a new issue" target="_blank" rel="noopener noreferrer">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href="https://github.com/mdn/content/blob/main/README.md" target="_blank" rel="noopener noreferrer">our Contribution guide</a>.</li></ul></div>
|
|
34
33
|
`}/>);
|
|
35
34
|
};
|
|
36
|
-
const PegaCustom = ({ children }) => {
|
|
37
|
-
return (<p style={{ color: 'blue', textTransform: 'uppercase' }} dangerouslySetInnerHTML={{ __html: children }}/>);
|
|
38
|
-
};
|
|
39
|
-
class PegaCustomElement extends HTMLElement {
|
|
40
|
-
removeElements() {
|
|
41
|
-
while (this.firstChild) {
|
|
42
|
-
this.removeChild(this.firstChild);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
connectedCallback() {
|
|
46
|
-
const inner = this.innerHTML;
|
|
47
|
-
this.removeElements();
|
|
48
|
-
const mountPoint = document.createElement('span');
|
|
49
|
-
this.appendChild(mountPoint);
|
|
50
|
-
ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
35
|
export const CustomComponentDemo = () => {
|
|
54
36
|
const editorRef = useRef(null);
|
|
55
37
|
const [editor, setEditor] = useState({});
|
|
56
38
|
const onCustomAction = () => {
|
|
57
39
|
editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');
|
|
58
40
|
};
|
|
59
|
-
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p><pega-custom>Hello from custom element.</pega-custom
|
|
41
|
+
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>' customComponents={[
|
|
42
|
+
{
|
|
43
|
+
customElement: createPegaCustomElement(window),
|
|
44
|
+
createCustomElement: createPegaCustomElement,
|
|
45
|
+
name: 'pega-custom'
|
|
46
|
+
}
|
|
47
|
+
]} customActions={[
|
|
60
48
|
{
|
|
61
49
|
icon: 'pega',
|
|
62
50
|
text: 'Insert a custom element',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.jsx","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,QAAQ,EAC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,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAChE;QAAA,EAAE,WAAW,CACb;QAAA,CAAC,UAAU,CACT;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACnE;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,MAAM,CACL,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,MAAM,CAAC,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,EAEhG;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport ReactDOM from 'react-dom';\nimport { action } from '@storybook/addon-actions';\nimport { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { EditorState, Editor } from '@pega/cosmos-react-rte';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\nconst label = 'Form field label';\n\nexport const EditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p></body>'\n />\n );\n};\n\nexport const EmptyEditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nconst PegaCustom = ({ children }: { children: string }) => {\n return (\n <p\n style={{ color: 'blue', textTransform: 'uppercase' }}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: children }}\n />\n );\n};\n\nclass PegaCustomElement extends HTMLElement {\n removeElements() {\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n }\n\n connectedCallback() {\n const inner = this.innerHTML;\n this.removeElements();\n const mountPoint = document.createElement('span');\n this.appendChild(mountPoint);\n ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);\n }\n}\n\nexport const CustomComponentDemo = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><pega-custom>Hello from custom element.</pega-custom><p>hi</p></body>'\n customComponents={[{ customElement: PegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.stories.jsx","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAe,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,MAAM;CACV,CAAC;AAEV,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,CAAC,KAAW,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E,CAAC,EAAE,CAAC,CAC/C;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,WAAW,CACV;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAChE;QAAA,EAAE,WAAW,CACb;QAAA,CAAC,UAAU,CACT;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACnE;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,MAAM,CACL,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,MAAM,CAAC,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,EAEhG;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { EditorState, Editor } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement, label } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\nexport const EditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n />\n );\n};\n\nexport const EmptyEditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[\n {\n customElement: createPegaCustomElement(window),\n createCustomElement: createPegaCustomElement,\n name: 'pega-custom'\n }\n ]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export declare const label = "Form field label";
|
|
2
|
+
export declare const createPegaCustomElement: (win: typeof globalThis) => {
|
|
3
|
+
new (): {
|
|
4
|
+
removeElements(): void;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
accessKey: string;
|
|
7
|
+
readonly accessKeyLabel: string;
|
|
8
|
+
autocapitalize: string;
|
|
9
|
+
dir: string;
|
|
10
|
+
draggable: boolean;
|
|
11
|
+
hidden: 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
|
+
closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2] | null;
|
|
54
|
+
closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3] | null;
|
|
55
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
56
|
+
getAttribute(qualifiedName: string): string | null;
|
|
57
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
58
|
+
getAttributeNames(): string[];
|
|
59
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
60
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
61
|
+
getBoundingClientRect(): DOMRect;
|
|
62
|
+
getClientRects(): DOMRectList;
|
|
63
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
64
|
+
getElementsByTagName<K_4 extends keyof HTMLElementTagNameMap>(qualifiedName: K_4): HTMLCollectionOf<HTMLElementTagNameMap[K_4]>;
|
|
65
|
+
getElementsByTagName<K_5 extends keyof SVGElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<SVGElementTagNameMap[K_5]>;
|
|
66
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
67
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
68
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
69
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
70
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
71
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
72
|
+
hasAttributes(): boolean;
|
|
73
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
74
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
75
|
+
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
76
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
77
|
+
matches(selectors: string): boolean;
|
|
78
|
+
releasePointerCapture(pointerId: number): void;
|
|
79
|
+
removeAttribute(qualifiedName: string): void;
|
|
80
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
81
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
82
|
+
requestFullscreen(options?: FullscreenOptions | undefined): Promise<void>;
|
|
83
|
+
requestPointerLock(): void;
|
|
84
|
+
scroll(options?: ScrollToOptions | undefined): void;
|
|
85
|
+
scroll(x: number, y: number): void;
|
|
86
|
+
scrollBy(options?: ScrollToOptions | undefined): void;
|
|
87
|
+
scrollBy(x: number, y: number): void;
|
|
88
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
|
|
89
|
+
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
90
|
+
scrollTo(x: number, y: number): void;
|
|
91
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
92
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
93
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
94
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
95
|
+
setPointerCapture(pointerId: number): void;
|
|
96
|
+
toggleAttribute(qualifiedName: string, force?: boolean | undefined): boolean;
|
|
97
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
98
|
+
readonly baseURI: string;
|
|
99
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
100
|
+
readonly firstChild: ChildNode | null;
|
|
101
|
+
readonly isConnected: boolean;
|
|
102
|
+
readonly lastChild: ChildNode | null;
|
|
103
|
+
readonly nextSibling: ChildNode | null;
|
|
104
|
+
readonly nodeName: string;
|
|
105
|
+
readonly nodeType: number;
|
|
106
|
+
nodeValue: string | null;
|
|
107
|
+
readonly parentElement: HTMLElement | null;
|
|
108
|
+
readonly parentNode: ParentNode | null;
|
|
109
|
+
readonly previousSibling: ChildNode | null;
|
|
110
|
+
textContent: string | null;
|
|
111
|
+
appendChild<T extends Node>(node: T): T;
|
|
112
|
+
cloneNode(deep?: boolean | undefined): Node;
|
|
113
|
+
compareDocumentPosition(other: Node): number;
|
|
114
|
+
contains(other: Node | null): boolean;
|
|
115
|
+
getRootNode(options?: GetRootNodeOptions | undefined): Node;
|
|
116
|
+
hasChildNodes(): boolean;
|
|
117
|
+
insertBefore<T_1 extends Node>(node: T_1, child: Node | null): T_1;
|
|
118
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
119
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
120
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
121
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
122
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
123
|
+
normalize(): void;
|
|
124
|
+
removeChild<T_2 extends Node>(child: T_2): T_2;
|
|
125
|
+
replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
|
|
126
|
+
readonly ATTRIBUTE_NODE: number;
|
|
127
|
+
readonly CDATA_SECTION_NODE: number;
|
|
128
|
+
readonly COMMENT_NODE: number;
|
|
129
|
+
readonly DOCUMENT_FRAGMENT_NODE: number;
|
|
130
|
+
readonly DOCUMENT_NODE: number;
|
|
131
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: number;
|
|
132
|
+
readonly DOCUMENT_POSITION_CONTAINS: number;
|
|
133
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: number;
|
|
134
|
+
readonly DOCUMENT_POSITION_FOLLOWING: number;
|
|
135
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
|
|
136
|
+
readonly DOCUMENT_POSITION_PRECEDING: number;
|
|
137
|
+
readonly DOCUMENT_TYPE_NODE: number;
|
|
138
|
+
readonly ELEMENT_NODE: number;
|
|
139
|
+
readonly ENTITY_NODE: number;
|
|
140
|
+
readonly ENTITY_REFERENCE_NODE: number;
|
|
141
|
+
readonly NOTATION_NODE: number;
|
|
142
|
+
readonly PROCESSING_INSTRUCTION_NODE: number;
|
|
143
|
+
readonly TEXT_NODE: number;
|
|
144
|
+
dispatchEvent(event: Event): boolean;
|
|
145
|
+
ariaAtomic: string;
|
|
146
|
+
ariaAutoComplete: string;
|
|
147
|
+
ariaBusy: string;
|
|
148
|
+
ariaChecked: string;
|
|
149
|
+
ariaColCount: string;
|
|
150
|
+
ariaColIndex: string;
|
|
151
|
+
ariaColSpan: string;
|
|
152
|
+
ariaCurrent: string;
|
|
153
|
+
ariaDisabled: string;
|
|
154
|
+
ariaExpanded: string;
|
|
155
|
+
ariaHasPopup: string;
|
|
156
|
+
ariaHidden: string;
|
|
157
|
+
ariaKeyShortcuts: string;
|
|
158
|
+
ariaLabel: string;
|
|
159
|
+
ariaLevel: string;
|
|
160
|
+
ariaLive: string;
|
|
161
|
+
ariaModal: string;
|
|
162
|
+
ariaMultiLine: string;
|
|
163
|
+
ariaMultiSelectable: string;
|
|
164
|
+
ariaOrientation: string;
|
|
165
|
+
ariaPlaceholder: string;
|
|
166
|
+
ariaPosInSet: string;
|
|
167
|
+
ariaPressed: string;
|
|
168
|
+
ariaReadOnly: string;
|
|
169
|
+
ariaRequired: string;
|
|
170
|
+
ariaRoleDescription: string;
|
|
171
|
+
ariaRowCount: string;
|
|
172
|
+
ariaRowIndex: string;
|
|
173
|
+
ariaRowSpan: string;
|
|
174
|
+
ariaSelected: string;
|
|
175
|
+
ariaSetSize: string;
|
|
176
|
+
ariaSort: string;
|
|
177
|
+
ariaValueMax: string;
|
|
178
|
+
ariaValueMin: string;
|
|
179
|
+
ariaValueNow: string;
|
|
180
|
+
ariaValueText: string;
|
|
181
|
+
animate(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined): Animation;
|
|
182
|
+
getAnimations(options?: GetAnimationsOptions | undefined): Animation[];
|
|
183
|
+
after(...nodes: (string | Node)[]): void;
|
|
184
|
+
before(...nodes: (string | Node)[]): void;
|
|
185
|
+
remove(): void;
|
|
186
|
+
replaceWith(...nodes: (string | Node)[]): void;
|
|
187
|
+
innerHTML: string;
|
|
188
|
+
readonly nextElementSibling: Element | null;
|
|
189
|
+
readonly previousElementSibling: Element | null;
|
|
190
|
+
readonly childElementCount: number;
|
|
191
|
+
readonly children: HTMLCollection;
|
|
192
|
+
readonly firstElementChild: Element | null;
|
|
193
|
+
readonly lastElementChild: Element | null;
|
|
194
|
+
append(...nodes: (string | Node)[]): void;
|
|
195
|
+
prepend(...nodes: (string | Node)[]): void;
|
|
196
|
+
querySelector<K_6 extends keyof HTMLElementTagNameMap>(selectors: K_6): HTMLElementTagNameMap[K_6] | null;
|
|
197
|
+
querySelector<K_7 extends keyof SVGElementTagNameMap>(selectors: K_7): SVGElementTagNameMap[K_7] | null;
|
|
198
|
+
querySelector<E_1 extends Element = Element>(selectors: string): E_1 | null;
|
|
199
|
+
querySelectorAll<K_8 extends keyof HTMLElementTagNameMap>(selectors: K_8): NodeListOf<HTMLElementTagNameMap[K_8]>;
|
|
200
|
+
querySelectorAll<K_9 extends keyof SVGElementTagNameMap>(selectors: K_9): NodeListOf<SVGElementTagNameMap[K_9]>;
|
|
201
|
+
querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
|
|
202
|
+
replaceChildren(...nodes: (string | Node)[]): void;
|
|
203
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
204
|
+
oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
205
|
+
oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
206
|
+
onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
207
|
+
readonly style: CSSStyleDeclaration;
|
|
208
|
+
contentEditable: string;
|
|
209
|
+
enterKeyHint: string;
|
|
210
|
+
inputMode: string;
|
|
211
|
+
readonly isContentEditable: boolean;
|
|
212
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
213
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
214
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
215
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
216
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
217
|
+
onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
218
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
219
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
220
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
221
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
222
|
+
onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
223
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
224
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
225
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
226
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
227
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
228
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
229
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
230
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
231
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
232
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
233
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
234
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
235
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
236
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
237
|
+
onerror: OnErrorEventHandler;
|
|
238
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
239
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
240
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
241
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
242
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
243
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
244
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
245
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
246
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
247
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
248
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
249
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
250
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
251
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
252
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
253
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
254
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
255
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
256
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
257
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
258
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
259
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
260
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
261
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
262
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
263
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
264
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
265
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
266
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
267
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
268
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
269
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any) | null;
|
|
270
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
271
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
273
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
274
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
276
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
277
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
278
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
279
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
280
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
281
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
282
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
283
|
+
ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
284
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
285
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
286
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
287
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
288
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
289
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
290
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
291
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
292
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
293
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
294
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
295
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
296
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
299
|
+
autofocus: boolean;
|
|
300
|
+
readonly dataset: DOMStringMap;
|
|
301
|
+
nonce?: string | undefined;
|
|
302
|
+
tabIndex: number;
|
|
303
|
+
blur(): void;
|
|
304
|
+
focus(options?: FocusOptions | undefined): void;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
//# sourceMappingURL=Editor.mocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.mocks.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.mocks.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,qBAAqB,CAAC;AAYxC,eAAO,MAAM,uBAAuB,QAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB7D,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
export const label = 'Form field label';
|
|
4
|
+
const PegaCustom = ({ children }) => {
|
|
5
|
+
return (_jsx("p", { style: { color: 'blue', textTransform: 'uppercase' },
|
|
6
|
+
// eslint-disable-next-line react/no-danger
|
|
7
|
+
dangerouslySetInnerHTML: { __html: children } }, void 0));
|
|
8
|
+
};
|
|
9
|
+
export const createPegaCustomElement = (win) => {
|
|
10
|
+
const HtmlElement = win.HTMLElement;
|
|
11
|
+
return class PegaCustomElement extends HtmlElement {
|
|
12
|
+
removeElements() {
|
|
13
|
+
while (this.firstChild) {
|
|
14
|
+
this.removeChild(this.firstChild);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
const inner = this.innerHTML;
|
|
19
|
+
this.removeElements();
|
|
20
|
+
const mountPoint = document.createElement('span');
|
|
21
|
+
this.appendChild(mountPoint);
|
|
22
|
+
ReactDOM.render(_jsx(PegaCustom, { children: inner }, void 0), mountPoint);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=Editor.mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.mocks.js","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.mocks.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAExC,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAwB,EAAE,EAAE;IACxD,OAAO,CACL,YACE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE;QACpD,2CAA2C;QAC3C,uBAAuB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAC7C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAsB,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IACpC,OAAO,MAAM,iBAAkB,SAAQ,WAAW;QAChD,cAAc;YACZ,OAAO,IAAI,CAAC,UAAU,EAAE;gBACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACnC;QACH,CAAC;QAED,iBAAiB;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;YAC7B,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC7B,QAAQ,CAAC,MAAM,CAAC,KAAC,UAAU,cAAE,KAAK,WAAc,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\n\nexport const label = 'Form field label';\n\nconst PegaCustom = ({ children }: { children: string }) => {\n return (\n <p\n style={{ color: 'blue', textTransform: 'uppercase' }}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: children }}\n />\n );\n};\n\nexport const createPegaCustomElement = (win: typeof globalThis) => {\n const HtmlElement = win.HTMLElement;\n return class PegaCustomElement extends HtmlElement {\n removeElements() {\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n }\n\n connectedCallback() {\n const inner = this.innerHTML;\n this.removeElements();\n const mountPoint = document.createElement('span');\n this.appendChild(mountPoint);\n ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);\n }\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;
|
|
1
|
+
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;AAkBxC,wBAGU;AAEV,eAAO,MAAM,UAAU,mBAmBtB,CAAC;AAEF,eAAO,MAAM,eAAe,mBAmB3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,mBAc7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,mBAmC/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,mBAkClC,CAAC;AAEF,eAAO,MAAM,6BAA6B,mBA8BzC,CAAC"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef } from 'react';
|
|
3
|
-
import ReactDOM from 'react-dom';
|
|
4
3
|
import { action } from '@storybook/addon-actions';
|
|
5
4
|
import { Button, Card, CardContent, CardFooter, Flex, Text, TextArea } from '@pega/cosmos-react-core';
|
|
6
5
|
import { Editor } from '@pega/cosmos-react-rte';
|
|
6
|
+
import { createPegaCustomElement, label } from './Editor.mocks';
|
|
7
7
|
export default {
|
|
8
8
|
title: 'RTE/Editor',
|
|
9
9
|
component: Editor
|
|
10
10
|
};
|
|
11
|
-
const label = 'Form field label';
|
|
12
11
|
export const EditorDemo = () => {
|
|
13
12
|
const editorRef = useRef(null);
|
|
14
13
|
const onImageAdded = (image, id) => {
|
|
15
14
|
const src = URL.createObjectURL(image);
|
|
16
15
|
editorRef.current?.appendImage({ src, alt: image.name }, id);
|
|
17
16
|
};
|
|
18
|
-
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onFocus: action('Editor focused'), onBlur: action('Editor blurred'), onImageAdded: onImageAdded, defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p
|
|
17
|
+
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onFocus: action('Editor focused'), onBlur: action('Editor blurred'), onImageAdded: onImageAdded, defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>' }, void 0));
|
|
19
18
|
};
|
|
20
19
|
export const EmptyEditorDemo = () => {
|
|
21
20
|
const editorRef = useRef(null);
|
|
@@ -34,32 +33,19 @@ export const ReadonlyFormField = () => {
|
|
|
34
33
|
<div id="on-github" class="on-github"><h3>Found a problem with this page?</h3><ul><li><a href="https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md" title="You're going to need to sign in to GitHub first (Opens in a new tab)" target="_blank" rel="noopener noreferrer">Edit on <b>GitHub</b></a></li><li><a href="https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md" title="Folder: en-us/web/html (Opens in a new tab)" target="_blank" rel="noopener noreferrer">Source on <b>GitHub</b></a></li><li><a href="https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML" title="This will take you to https://github.com/mdn/content to file a new issue" target="_blank" rel="noopener noreferrer">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href="https://github.com/mdn/content/blob/main/README.md" target="_blank" rel="noopener noreferrer">our Contribution guide</a>.</li></ul></div>
|
|
35
34
|
` }, void 0));
|
|
36
35
|
};
|
|
37
|
-
const PegaCustom = ({ children }) => {
|
|
38
|
-
return (_jsx("p", { style: { color: 'blue', textTransform: 'uppercase' },
|
|
39
|
-
// eslint-disable-next-line react/no-danger
|
|
40
|
-
dangerouslySetInnerHTML: { __html: children } }, void 0));
|
|
41
|
-
};
|
|
42
|
-
class PegaCustomElement extends HTMLElement {
|
|
43
|
-
removeElements() {
|
|
44
|
-
while (this.firstChild) {
|
|
45
|
-
this.removeChild(this.firstChild);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
connectedCallback() {
|
|
49
|
-
const inner = this.innerHTML;
|
|
50
|
-
this.removeElements();
|
|
51
|
-
const mountPoint = document.createElement('span');
|
|
52
|
-
this.appendChild(mountPoint);
|
|
53
|
-
ReactDOM.render(_jsx(PegaCustom, { children: inner }, void 0), mountPoint);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
36
|
export const CustomComponentDemo = () => {
|
|
57
37
|
const editorRef = useRef(null);
|
|
58
38
|
const [editor, setEditor] = useState({});
|
|
59
39
|
const onCustomAction = () => {
|
|
60
40
|
editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');
|
|
61
41
|
};
|
|
62
|
-
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'links', 'images'], defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><pega-custom>Hello from custom element.</pega-custom
|
|
42
|
+
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'links', 'images'], defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>', customComponents: [
|
|
43
|
+
{
|
|
44
|
+
customElement: createPegaCustomElement(window),
|
|
45
|
+
createCustomElement: createPegaCustomElement,
|
|
46
|
+
name: 'pega-custom'
|
|
47
|
+
}
|
|
48
|
+
], customActions: [
|
|
63
49
|
{
|
|
64
50
|
icon: 'pega',
|
|
65
51
|
text: 'Insert a custom element',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.js","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,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 'react';\nimport ReactDOM from 'react-dom';\nimport { action } from '@storybook/addon-actions';\nimport { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { EditorState, Editor } from '@pega/cosmos-react-rte';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\nconst label = 'Form field label';\n\nexport const EditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p></body>'\n />\n );\n};\n\nexport const EmptyEditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nconst PegaCustom = ({ children }: { children: string }) => {\n return (\n <p\n style={{ color: 'blue', textTransform: 'uppercase' }}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{ __html: children }}\n />\n );\n};\n\nclass PegaCustomElement extends HTMLElement {\n removeElements() {\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n }\n\n connectedCallback() {\n const inner = this.innerHTML;\n this.removeElements();\n const mountPoint = document.createElement('span');\n this.appendChild(mountPoint);\n ReactDOM.render(<PegaCustom>{inner}</PegaCustom>, mountPoint);\n }\n}\n\nexport const CustomComponentDemo = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><pega-custom>Hello from custom element.</pega-custom><p>hi</p></body>'\n customComponents={[{ customElement: PegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.stories.js","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EA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,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,MAAC,IAAI,eACH,KAAC,WAAW,cACV,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAI,WACrD,EACd,KAAC,UAAU,cACT,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,oDAE3D,WACE,YACR,EACP,KAAC,MAAM,IACL,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,WAC3F,YACG,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Meta } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { EditorState, Editor } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement, label } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\nexport const EditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n />\n );\n};\n\nexport const EmptyEditorDemo = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[\n {\n customElement: createPegaCustomElement(window),\n createCustomElement: createPegaCustomElement,\n name: 'pega-custom'\n }\n ]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-demos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-build": "2.
|
|
24
|
-
"@pega/cosmos-react-condition-builder": "2.
|
|
25
|
-
"@pega/cosmos-react-core": "2.
|
|
26
|
-
"@pega/cosmos-react-cs": "2.
|
|
27
|
-
"@pega/cosmos-react-dnd": "2.
|
|
28
|
-
"@pega/cosmos-react-rte": "2.
|
|
29
|
-
"@pega/cosmos-react-social": "2.
|
|
30
|
-
"@pega/cosmos-react-work": "2.
|
|
23
|
+
"@pega/cosmos-react-build": "2.2.2",
|
|
24
|
+
"@pega/cosmos-react-condition-builder": "2.2.2",
|
|
25
|
+
"@pega/cosmos-react-core": "2.2.2",
|
|
26
|
+
"@pega/cosmos-react-cs": "2.2.2",
|
|
27
|
+
"@pega/cosmos-react-dnd": "2.2.2",
|
|
28
|
+
"@pega/cosmos-react-rte": "2.2.2",
|
|
29
|
+
"@pega/cosmos-react-social": "2.2.2",
|
|
30
|
+
"@pega/cosmos-react-work": "2.2.2",
|
|
31
31
|
"emoji-mart": "^3.0.1",
|
|
32
32
|
"polished": "^4.1.0",
|
|
33
33
|
"react": "^16.14.0 || ^17.0.0",
|