@ni/nimble-components 20.1.18 → 20.1.20
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/dist/all-components-bundle.js +452 -76
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1033 -954
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/rich-text-editor/index.d.ts +98 -6
- package/dist/esm/rich-text-editor/index.js +214 -30
- package/dist/esm/rich-text-editor/index.js.map +1 -1
- package/dist/esm/rich-text-editor/styles.js +74 -16
- package/dist/esm/rich-text-editor/styles.js.map +1 -1
- package/dist/esm/rich-text-editor/template.js +13 -1
- package/dist/esm/rich-text-editor/template.js.map +1 -1
- package/dist/esm/rich-text-editor/testing/rich-text-editor.pageobject.d.ts +8 -20
- package/dist/esm/rich-text-editor/testing/rich-text-editor.pageobject.js +43 -22
- package/dist/esm/rich-text-editor/testing/rich-text-editor.pageobject.js.map +1 -1
- package/dist/esm/src/rich-text-editor/index.d.ts +98 -6
- package/dist/esm/src/rich-text-editor/testing/rich-text-editor.pageobject.d.ts +8 -20
- package/package.json +12 -11
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import { bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, smallDelay, standardPadding } from '../theme-provider/design-tokens';
|
|
3
|
+
import { bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, controlLabelFontColor, controlLabelDisabledFontColor, failColor, iconSize, smallDelay, standardPadding } from '../theme-provider/design-tokens';
|
|
4
|
+
import { styles as errorStyles } from '../patterns/error/styles';
|
|
4
5
|
export const styles = css `
|
|
5
6
|
${display('inline-flex')}
|
|
7
|
+
${errorStyles}
|
|
6
8
|
|
|
7
9
|
:host {
|
|
8
10
|
font: ${bodyFont};
|
|
@@ -12,6 +14,9 @@ export const styles = css `
|
|
|
12
14
|
--ni-private-rich-text-editor-hover-indicator-width: calc(
|
|
13
15
|
${borderWidth} + 1px
|
|
14
16
|
);
|
|
17
|
+
${
|
|
18
|
+
/** Initial height of rich text editor with one line space when the footer is visible. */ ''}
|
|
19
|
+
height: 82px;
|
|
15
20
|
--ni-private-rich-text-editor-footer-section-height: 40px;
|
|
16
21
|
${
|
|
17
22
|
/** Minimum width is added to accommodate all the possible buttons in the toolbar and to support the mobile width. */ ''}
|
|
@@ -19,6 +24,7 @@ export const styles = css `
|
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
.container {
|
|
27
|
+
box-sizing: border-box;
|
|
22
28
|
display: flex;
|
|
23
29
|
flex-direction: column;
|
|
24
30
|
position: relative;
|
|
@@ -50,37 +56,55 @@ export const styles = css `
|
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
|
|
59
|
+
:host([disabled]) .container {
|
|
60
|
+
color: ${bodyDisabledFontColor};
|
|
61
|
+
border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([error-visible]) .container {
|
|
65
|
+
border-bottom-color: ${failColor};
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
:host(:hover) .container::after {
|
|
54
|
-
width: 100
|
|
69
|
+
width: calc(100% + 2 * ${borderWidth});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([disabled]:hover) .container::after {
|
|
73
|
+
width: 0px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([error-visible]) .container::after {
|
|
77
|
+
border-bottom-color: ${failColor};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.editor-container {
|
|
81
|
+
display: contents;
|
|
55
82
|
}
|
|
56
83
|
|
|
57
84
|
.editor {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
58
87
|
border: ${borderWidth} solid transparent;
|
|
59
88
|
border-radius: 0px;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
overflow: auto;
|
|
89
|
+
flex: 1;
|
|
90
|
+
overflow: hidden;
|
|
64
91
|
}
|
|
65
92
|
|
|
66
|
-
.editor
|
|
67
|
-
|
|
93
|
+
:host([footer-hidden]) .editor {
|
|
94
|
+
height: 100%;
|
|
68
95
|
}
|
|
69
96
|
|
|
70
97
|
.ProseMirror {
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Min height represents the one line space for the initial view and max height is referred from the visual design.
|
|
74
|
-
* However, max height will be `fit-content` when the `fit-to-content` attribute for the editor component is implemented.
|
|
75
|
-
*/ ''}
|
|
76
|
-
min-height: 32px;
|
|
77
|
-
max-height: 132px;
|
|
98
|
+
overflow: auto;
|
|
78
99
|
height: 100%;
|
|
79
|
-
border:
|
|
100
|
+
border: 0px;
|
|
80
101
|
border-radius: 0px;
|
|
81
102
|
background-color: transparent;
|
|
82
103
|
font: inherit;
|
|
83
104
|
padding: 8px;
|
|
105
|
+
${
|
|
106
|
+
/* This padding ensures that showing/hiding the error icon doesn't affect text layout */ ''}
|
|
107
|
+
padding-right: calc(${iconSize});
|
|
84
108
|
box-sizing: border-box;
|
|
85
109
|
position: relative;
|
|
86
110
|
color: inherit;
|
|
@@ -127,15 +151,38 @@ export const styles = css `
|
|
|
127
151
|
margin-block: 0;
|
|
128
152
|
}
|
|
129
153
|
|
|
154
|
+
${
|
|
155
|
+
/**
|
|
156
|
+
* Styles provided by Tiptap are necessary to display the placeholder value when the editor is empty.
|
|
157
|
+
* Tiptap doc reference: https://tiptap.dev/api/extensions/placeholder#additional-setup
|
|
158
|
+
*/ ''}
|
|
159
|
+
.ProseMirror p.is-editor-empty:first-child::before {
|
|
160
|
+
color: ${controlLabelFontColor};
|
|
161
|
+
content: attr(data-placeholder);
|
|
162
|
+
float: left;
|
|
163
|
+
height: 0;
|
|
164
|
+
pointer-events: none;
|
|
165
|
+
word-break: break-word;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host([disabled]) .ProseMirror p.is-editor-empty:first-child::before {
|
|
169
|
+
color: ${controlLabelDisabledFontColor};
|
|
170
|
+
}
|
|
171
|
+
|
|
130
172
|
.footer-section {
|
|
131
173
|
display: flex;
|
|
132
174
|
justify-content: space-between;
|
|
175
|
+
flex-shrink: 0;
|
|
133
176
|
border: ${borderWidth} solid transparent;
|
|
134
177
|
border-top-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
135
178
|
height: var(--ni-private-rich-text-editor-footer-section-height);
|
|
136
179
|
overflow: hidden;
|
|
137
180
|
}
|
|
138
181
|
|
|
182
|
+
:host([footer-hidden]) .footer-section {
|
|
183
|
+
display: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
139
186
|
nimble-toolbar::part(positioning-region) {
|
|
140
187
|
background: transparent;
|
|
141
188
|
padding-right: 8px;
|
|
@@ -152,5 +199,16 @@ export const styles = css `
|
|
|
152
199
|
gap: ${standardPadding};
|
|
153
200
|
place-items: center;
|
|
154
201
|
}
|
|
202
|
+
|
|
203
|
+
:host([error-visible]) .error-icon {
|
|
204
|
+
display: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:host([error-visible]) .error-icon.scrollbar-width-calculated {
|
|
208
|
+
display: inline-flex;
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: calc(${standardPadding} / 2);
|
|
211
|
+
right: var(--ni-private-rich-text-editor-scrollbar-width);
|
|
212
|
+
}
|
|
155
213
|
`;
|
|
156
214
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/rich-text-editor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAA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qB;;;;;;;;;;;;;;;;;;;;;6BAqBzB,eAAe;eAC7B,eAAe;;;;;;;;;;;oBAWV,eAAe;;;CAGlC,CAAC"}
|
|
@@ -5,18 +5,26 @@ import { iconBoldBTag } from '../icons/bold-b';
|
|
|
5
5
|
import { iconItalicITag } from '../icons/italic-i';
|
|
6
6
|
import { iconListTag } from '../icons/list';
|
|
7
7
|
import { iconNumberListTag } from '../icons/number-list';
|
|
8
|
+
import { errorTextTemplate } from '../patterns/error/template';
|
|
9
|
+
import { iconExclamationMarkTag } from '../icons/exclamation-mark';
|
|
8
10
|
// prettier-ignore
|
|
9
11
|
export const template = html `
|
|
10
12
|
<template>
|
|
11
13
|
<div class="container">
|
|
12
14
|
<section ${ref('editorContainer')} class="editor-container">
|
|
13
15
|
</section>
|
|
14
|
-
|
|
16
|
+
<${iconExclamationMarkTag}
|
|
17
|
+
severity="error"
|
|
18
|
+
class="error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}"
|
|
19
|
+
style="--ni-private-rich-text-editor-scrollbar-width: ${x => x.scrollbarWidth}px;"
|
|
20
|
+
></${iconExclamationMarkTag}>
|
|
21
|
+
<section class="footer-section">
|
|
15
22
|
<${toolbarTag}>
|
|
16
23
|
<${toggleButtonTag}
|
|
17
24
|
${ref('boldButton')}
|
|
18
25
|
appearance="ghost"
|
|
19
26
|
content-hidden
|
|
27
|
+
?disabled="${x => x.disabled}"
|
|
20
28
|
slot="start"
|
|
21
29
|
title="Bold"
|
|
22
30
|
@click=${x => x.boldButtonClick()}
|
|
@@ -30,6 +38,7 @@ export const template = html `
|
|
|
30
38
|
${ref('italicsButton')}
|
|
31
39
|
appearance="ghost"
|
|
32
40
|
content-hidden
|
|
41
|
+
?disabled="${x => x.disabled}"
|
|
33
42
|
slot="start"
|
|
34
43
|
title="Italics"
|
|
35
44
|
@click=${x => x.italicsButtonClick()}
|
|
@@ -43,6 +52,7 @@ export const template = html `
|
|
|
43
52
|
${ref('bulletListButton')}
|
|
44
53
|
appearance="ghost"
|
|
45
54
|
content-hidden
|
|
55
|
+
?disabled="${x => x.disabled}"
|
|
46
56
|
slot="start"
|
|
47
57
|
title="Bullet List"
|
|
48
58
|
@click=${x => x.bulletListButtonClick()}
|
|
@@ -56,6 +66,7 @@ export const template = html `
|
|
|
56
66
|
${ref('numberedListButton')}
|
|
57
67
|
appearance="ghost"
|
|
58
68
|
content-hidden
|
|
69
|
+
?disabled="${x => x.disabled}"
|
|
59
70
|
slot="start"
|
|
60
71
|
title="Numbered List"
|
|
61
72
|
@click=${x => x.numberedListButtonClick()}
|
|
@@ -70,6 +81,7 @@ export const template = html `
|
|
|
70
81
|
<slot name="footer-actions"></slot>
|
|
71
82
|
</span>
|
|
72
83
|
</section>
|
|
84
|
+
${errorTextTemplate}
|
|
73
85
|
</div>
|
|
74
86
|
</template>
|
|
75
87
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/rich-text-editor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/rich-text-editor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE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
|
|
14
14
|
pressShiftTabKeysInEditor(): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* To click a formatting button in the footer section, pass its position value as an index (starting from '0')
|
|
17
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
18
|
-
*/
|
|
19
15
|
clickFooterButton(button: ToolbarButton): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* To retrieve the checked state of the button, provide its position value as an index (starting from '0')
|
|
22
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
23
|
-
*/
|
|
24
16
|
getButtonCheckedState(button: ToolbarButton): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* To retrieve the tab index of the button, provide its position value as an index (starting from '0')
|
|
27
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
28
|
-
*/
|
|
29
17
|
getButtonTabIndex(button: ToolbarButton): number;
|
|
30
|
-
/**
|
|
31
|
-
* To trigger a space key press for the button, provide its position value as an index (starting from '0')
|
|
32
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
33
|
-
*/
|
|
34
18
|
spaceKeyActivatesButton(button: ToolbarButton): void;
|
|
35
|
-
/**
|
|
36
|
-
* To trigger a enter key press for the button, provide its position value as an index (starting from '0')
|
|
37
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
38
|
-
*/
|
|
39
19
|
enterKeyActivatesButton(button: ToolbarButton): void;
|
|
40
20
|
setEditorTextContent(value: string): Promise<void>;
|
|
41
21
|
getEditorFirstChildTagName(): string;
|
|
42
22
|
getEditorFirstChildTextContent(): string;
|
|
43
23
|
getEditorTagNames(): string[];
|
|
44
24
|
getEditorLeafContents(): string[];
|
|
25
|
+
isRichTextEditorActiveElement(): boolean;
|
|
26
|
+
getEditorTabIndex(): string;
|
|
27
|
+
setFooterHidden(footerHidden: boolean): Promise<void>;
|
|
28
|
+
isFooterHidden(): boolean;
|
|
29
|
+
setDisabled(disabled: boolean): Promise<void>;
|
|
30
|
+
isButtonDisabled(button: ToolbarButton): boolean;
|
|
31
|
+
getPlaceholderValue(): string;
|
|
45
32
|
private getEditorSection;
|
|
33
|
+
private getFooter;
|
|
46
34
|
private getTiptapEditor;
|
|
47
35
|
private getFormattingButton;
|
|
48
36
|
}
|
|
@@ -58,35 +58,19 @@ export class RichTextEditorPageObject {
|
|
|
58
58
|
editor.dispatchEvent(shiftTabEvent);
|
|
59
59
|
await waitForUpdatesAsync();
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
62
|
-
* To click a formatting button in the footer section, pass its position value as an index (starting from '0')
|
|
63
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
64
|
-
*/
|
|
65
61
|
async clickFooterButton(button) {
|
|
66
62
|
const toggleButton = this.getFormattingButton(button);
|
|
67
63
|
toggleButton.click();
|
|
68
64
|
await waitForUpdatesAsync();
|
|
69
65
|
}
|
|
70
|
-
/**
|
|
71
|
-
* To retrieve the checked state of the button, provide its position value as an index (starting from '0')
|
|
72
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
73
|
-
*/
|
|
74
66
|
getButtonCheckedState(button) {
|
|
75
67
|
const toggleButton = this.getFormattingButton(button);
|
|
76
68
|
return toggleButton.checked;
|
|
77
69
|
}
|
|
78
|
-
/**
|
|
79
|
-
* To retrieve the tab index of the button, provide its position value as an index (starting from '0')
|
|
80
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
81
|
-
*/
|
|
82
70
|
getButtonTabIndex(button) {
|
|
83
71
|
const toggleButton = this.getFormattingButton(button);
|
|
84
72
|
return toggleButton.tabIndex;
|
|
85
73
|
}
|
|
86
|
-
/**
|
|
87
|
-
* To trigger a space key press for the button, provide its position value as an index (starting from '0')
|
|
88
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
89
|
-
*/
|
|
90
74
|
spaceKeyActivatesButton(button) {
|
|
91
75
|
const toggleButton = this.getFormattingButton(button);
|
|
92
76
|
const event = new KeyboardEvent('keypress', {
|
|
@@ -94,10 +78,6 @@ export class RichTextEditorPageObject {
|
|
|
94
78
|
});
|
|
95
79
|
toggleButton.control.dispatchEvent(event);
|
|
96
80
|
}
|
|
97
|
-
/**
|
|
98
|
-
* To trigger a enter key press for the button, provide its position value as an index (starting from '0')
|
|
99
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
100
|
-
*/
|
|
101
81
|
enterKeyActivatesButton(button) {
|
|
102
82
|
const toggleButton = this.getFormattingButton(button);
|
|
103
83
|
const event = new KeyboardEvent('keypress', {
|
|
@@ -129,15 +109,56 @@ export class RichTextEditorPageObject {
|
|
|
129
109
|
})
|
|
130
110
|
.map(el => el.textContent || '');
|
|
131
111
|
}
|
|
112
|
+
isRichTextEditorActiveElement() {
|
|
113
|
+
return (document.activeElement === this.richTextEditorElement
|
|
114
|
+
&& document.activeElement?.shadowRoot?.activeElement
|
|
115
|
+
=== this.getTiptapEditor());
|
|
116
|
+
}
|
|
117
|
+
getEditorTabIndex() {
|
|
118
|
+
return this.getTiptapEditor()?.getAttribute('tabindex') ?? '';
|
|
119
|
+
}
|
|
120
|
+
async setFooterHidden(footerHidden) {
|
|
121
|
+
if (footerHidden) {
|
|
122
|
+
this.richTextEditorElement.setAttribute('footer-hidden', '');
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this.richTextEditorElement.removeAttribute('footer-hidden');
|
|
126
|
+
}
|
|
127
|
+
await waitForUpdatesAsync();
|
|
128
|
+
}
|
|
129
|
+
isFooterHidden() {
|
|
130
|
+
const footerSection = this.getFooter();
|
|
131
|
+
return window.getComputedStyle(footerSection).display === 'none';
|
|
132
|
+
}
|
|
133
|
+
async setDisabled(disabled) {
|
|
134
|
+
if (disabled) {
|
|
135
|
+
this.richTextEditorElement.setAttribute('disabled', '');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.richTextEditorElement.removeAttribute('disabled');
|
|
139
|
+
}
|
|
140
|
+
await waitForUpdatesAsync();
|
|
141
|
+
}
|
|
142
|
+
isButtonDisabled(button) {
|
|
143
|
+
const toggleButton = this.getFormattingButton(button);
|
|
144
|
+
return toggleButton.hasAttribute('disabled');
|
|
145
|
+
}
|
|
146
|
+
getPlaceholderValue() {
|
|
147
|
+
const editor = this.getTiptapEditor();
|
|
148
|
+
return editor.firstElementChild?.getAttribute('data-placeholder') ?? '';
|
|
149
|
+
}
|
|
132
150
|
getEditorSection() {
|
|
133
151
|
return this.richTextEditorElement.shadowRoot?.querySelector('.editor');
|
|
134
152
|
}
|
|
153
|
+
getFooter() {
|
|
154
|
+
return this.richTextEditorElement.shadowRoot.querySelector('.footer-section');
|
|
155
|
+
}
|
|
135
156
|
getTiptapEditor() {
|
|
136
157
|
return this.richTextEditorElement.shadowRoot?.querySelector('.ProseMirror');
|
|
137
158
|
}
|
|
138
|
-
getFormattingButton(
|
|
159
|
+
getFormattingButton(button) {
|
|
139
160
|
const buttons = this.richTextEditorElement.shadowRoot.querySelectorAll('nimble-toggle-button');
|
|
140
|
-
return buttons[
|
|
161
|
+
return buttons[button];
|
|
141
162
|
}
|
|
142
163
|
}
|
|
143
164
|
//# sourceMappingURL=rich-text-editor.pageobject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-editor.pageobject.js","sourceRoot":"","sources":["../../../../src/rich-text-editor/testing/rich-text-editor.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAIlE;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACjC,YACqB,qBAAqC;QAArC,0BAAqB,GAArB,qBAAqB,CAAgB;IACvD,CAAC;IAEG,0BAA0B;QAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9C,OAAO,aAAc,CAAC,aAAa,EAAE,CAAC;IAC1C,CAAC;IAE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,CAAC;QACtC,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE;YAC/C,GAAG,EAAE,MAAM;YACX,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,MAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACrC,MAAM,mBAAmB,EAAE,CAAC;IAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"rich-text-editor.pageobject.js","sourceRoot":"","sources":["../../../../src/rich-text-editor/testing/rich-text-editor.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAIlE;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACjC,YACqB,qBAAqC;QAArC,0BAAqB,GAArB,qBAAqB,CAAgB;IACvD,CAAC;IAEG,0BAA0B;QAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9C,OAAO,aAAc,CAAC,aAAa,EAAE,CAAC;IAC1C,CAAC;IAEM,0CAA0C;QAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9C,OAAO,aAAc,CAAC,iBAAkB,CAAC,SAAS,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAChC,WAAmB,EACnB,UAAmB;QAEnB,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE;YACvC,GAAG,EAAE,WAAW;YAChB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,UAAU;YACpB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,MAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QA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oundationElement } from '@microsoft/fast-foundation';
|
|
1
|
+
import { ARIAGlobalStatesAndProperties, FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
2
3
|
import type { ToggleButton } from '../toggle-button';
|
|
4
|
+
import type { ErrorPattern } from '../patterns/error/types';
|
|
3
5
|
declare global {
|
|
4
6
|
interface HTMLElementTagNameMap {
|
|
5
7
|
'nimble-rich-text-editor': RichTextEditor;
|
|
@@ -8,7 +10,54 @@ declare global {
|
|
|
8
10
|
/**
|
|
9
11
|
* A nimble styled rich text editor
|
|
10
12
|
*/
|
|
11
|
-
export declare class RichTextEditor extends FoundationElement {
|
|
13
|
+
export declare class RichTextEditor extends FoundationElement implements ErrorPattern {
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
editor: HTMLDivElement;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
tiptapEditor: Editor;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to disable user from editing and interacting with toolbar buttons
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* HTML Attribute: disabled
|
|
27
|
+
*/
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to hide the footer of the rich text editor
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* HTML Attribute: footer-hidden
|
|
34
|
+
*/
|
|
35
|
+
footerHidden: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to display the error state.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
* HTML Attribute: error-visible
|
|
41
|
+
*/
|
|
42
|
+
errorVisible: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* A message explaining why the value is invalid.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
* HTML Attribute: error-text
|
|
48
|
+
*/
|
|
49
|
+
errorText?: string;
|
|
50
|
+
/**
|
|
51
|
+
* @public
|
|
52
|
+
* HTML Attribute: placeholder
|
|
53
|
+
*/
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
/**
|
|
56
|
+
* True if the editor is empty or contains only whitespace, false otherwise.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
get empty(): boolean;
|
|
12
61
|
/**
|
|
13
62
|
* @internal
|
|
14
63
|
*/
|
|
@@ -25,17 +74,21 @@ export declare class RichTextEditor extends FoundationElement {
|
|
|
25
74
|
* @internal
|
|
26
75
|
*/
|
|
27
76
|
numberedListButton: ToggleButton;
|
|
77
|
+
/**
|
|
78
|
+
* The width of the vertical scrollbar, if displayed.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
scrollbarWidth: number;
|
|
28
82
|
/**
|
|
29
83
|
* @internal
|
|
30
84
|
*/
|
|
31
85
|
editorContainer: HTMLDivElement;
|
|
32
|
-
private
|
|
33
|
-
private
|
|
86
|
+
private resizeObserver?;
|
|
87
|
+
private updateScrollbarWidthQueued;
|
|
34
88
|
private readonly markdownParser;
|
|
35
89
|
private readonly markdownSerializer;
|
|
36
90
|
private readonly domSerializer;
|
|
37
91
|
private readonly xmlSerializer;
|
|
38
|
-
constructor();
|
|
39
92
|
/**
|
|
40
93
|
* @internal
|
|
41
94
|
*/
|
|
@@ -44,6 +97,19 @@ export declare class RichTextEditor extends FoundationElement {
|
|
|
44
97
|
* @internal
|
|
45
98
|
*/
|
|
46
99
|
disconnectedCallback(): void;
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
disabledChanged(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Update the placeholder text and view of the editor.
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
placeholderChanged(): void;
|
|
109
|
+
/**
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
ariaLabelChanged(): void;
|
|
47
113
|
/**
|
|
48
114
|
* Toggle the bold mark and focus back to the editor
|
|
49
115
|
* @internal
|
|
@@ -98,6 +164,8 @@ export declare class RichTextEditor extends FoundationElement {
|
|
|
98
164
|
* @internal
|
|
99
165
|
*/
|
|
100
166
|
stopEventPropagation(event: Event): boolean;
|
|
167
|
+
private createEditor;
|
|
168
|
+
private createTiptapEditor;
|
|
101
169
|
/**
|
|
102
170
|
* This function takes the Fragment from parseMarkdownToDOM function and return the serialized string using XMLSerializer
|
|
103
171
|
*/
|
|
@@ -105,7 +173,6 @@ export declare class RichTextEditor extends FoundationElement {
|
|
|
105
173
|
private initializeMarkdownParser;
|
|
106
174
|
private initializeMarkdownSerializer;
|
|
107
175
|
private parseMarkdownToDOM;
|
|
108
|
-
private initializeEditor;
|
|
109
176
|
/**
|
|
110
177
|
* Binding the "transaction" event to the editor allows continuous monitoring the events and updating the button state in response to
|
|
111
178
|
* various actions such as mouse events, keyboard events, changes in the editor content etc,.
|
|
@@ -115,5 +182,30 @@ export declare class RichTextEditor extends FoundationElement {
|
|
|
115
182
|
private unbindEditorTransactionEvent;
|
|
116
183
|
private updateEditorButtonsState;
|
|
117
184
|
private keyActivatesButton;
|
|
185
|
+
private unbindEditorUpdateEvent;
|
|
186
|
+
/**
|
|
187
|
+
* input event is fired when there is a change in the content of the editor.
|
|
188
|
+
*
|
|
189
|
+
* https://tiptap.dev/api/events#update
|
|
190
|
+
*/
|
|
191
|
+
private bindEditorUpdateEvent;
|
|
192
|
+
/**
|
|
193
|
+
* Stopping the native input event propagation emitted by the contenteditable element in the Tiptap
|
|
194
|
+
* since there is an issue (linked below) in ProseMirror where selecting the text and removing it
|
|
195
|
+
* does not trigger the native HTMLElement input event. So using the "update" event emitted by the
|
|
196
|
+
* Tiptap to capture it as an "input" customEvent in the rich text editor.
|
|
197
|
+
*
|
|
198
|
+
* Prose Mirror issue: https://discuss.prosemirror.net/t/how-to-handle-select-backspace-delete-cut-type-kind-of-events-handletextinput-or-handledomevents-input-doesnt-help/4844
|
|
199
|
+
*/
|
|
200
|
+
private stopNativeInputEventPropagation;
|
|
201
|
+
private unbindNativeInputEvent;
|
|
202
|
+
private queueUpdateScrollbarWidth;
|
|
203
|
+
private updateScrollbarWidth;
|
|
204
|
+
private onResize;
|
|
205
|
+
private getTipTapExtension;
|
|
206
|
+
private setEditorTabIndex;
|
|
207
|
+
private forceFocusEditor;
|
|
208
|
+
}
|
|
209
|
+
export interface RichTextEditor extends ARIAGlobalStatesAndProperties {
|
|
118
210
|
}
|
|
119
211
|
export declare const richTextEditorTag: string;
|
|
@@ -12,37 +12,25 @@ export declare class RichTextEditorPageObject {
|
|
|
12
12
|
pressEnterKeyInEditor(): Promise<void>;
|
|
13
13
|
pressTabKeyInEditor(): Promise<void>;
|
|
14
14
|
pressShiftTabKeysInEditor(): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* To click a formatting button in the footer section, pass its position value as an index (starting from '0')
|
|
17
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
18
|
-
*/
|
|
19
15
|
clickFooterButton(button: ToolbarButton): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* To retrieve the checked state of the button, provide its position value as an index (starting from '0')
|
|
22
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
23
|
-
*/
|
|
24
16
|
getButtonCheckedState(button: ToolbarButton): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* To retrieve the tab index of the button, provide its position value as an index (starting from '0')
|
|
27
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
28
|
-
*/
|
|
29
17
|
getButtonTabIndex(button: ToolbarButton): number;
|
|
30
|
-
/**
|
|
31
|
-
* To trigger a space key press for the button, provide its position value as an index (starting from '0')
|
|
32
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
33
|
-
*/
|
|
34
18
|
spaceKeyActivatesButton(button: ToolbarButton): void;
|
|
35
|
-
/**
|
|
36
|
-
* To trigger a enter key press for the button, provide its position value as an index (starting from '0')
|
|
37
|
-
* @param button can be imported from an enum for each button using the `ButtonIndex`.
|
|
38
|
-
*/
|
|
39
19
|
enterKeyActivatesButton(button: ToolbarButton): void;
|
|
40
20
|
setEditorTextContent(value: string): Promise<void>;
|
|
41
21
|
getEditorFirstChildTagName(): string;
|
|
42
22
|
getEditorFirstChildTextContent(): string;
|
|
43
23
|
getEditorTagNames(): string[];
|
|
44
24
|
getEditorLeafContents(): string[];
|
|
25
|
+
isRichTextEditorActiveElement(): boolean;
|
|
26
|
+
getEditorTabIndex(): string;
|
|
27
|
+
setFooterHidden(footerHidden: boolean): Promise<void>;
|
|
28
|
+
isFooterHidden(): boolean;
|
|
29
|
+
setDisabled(disabled: boolean): Promise<void>;
|
|
30
|
+
isButtonDisabled(button: ToolbarButton): boolean;
|
|
31
|
+
getPlaceholderValue(): string;
|
|
45
32
|
private getEditorSection;
|
|
33
|
+
private getFooter;
|
|
46
34
|
private getTiptapEditor;
|
|
47
35
|
private getFormattingButton;
|
|
48
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/nimble-components",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.20",
|
|
4
4
|
"description": "Styled web components for the NI Nimble Design System",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run generate-icons && npm run build-components && npm run bundle-components && npm run generate-scss && npm run build-storybook",
|
|
@@ -64,16 +64,17 @@
|
|
|
64
64
|
"@ni/nimble-tokens": "^6.3.0",
|
|
65
65
|
"@tanstack/table-core": "^8.9.3",
|
|
66
66
|
"@tanstack/virtual-core": "^3.0.0-beta.44",
|
|
67
|
-
"@tiptap/core": "^2.
|
|
68
|
-
"@tiptap/extension-bold": "^2.
|
|
69
|
-
"@tiptap/extension-bullet-list": "^2.
|
|
70
|
-
"@tiptap/extension-document": "^2.
|
|
71
|
-
"@tiptap/extension-history": "^2.
|
|
72
|
-
"@tiptap/extension-italic": "^2.
|
|
73
|
-
"@tiptap/extension-list-item": "^2.
|
|
74
|
-
"@tiptap/extension-ordered-list": "^2.
|
|
75
|
-
"@tiptap/extension-paragraph": "^2.
|
|
76
|
-
"@tiptap/extension-
|
|
67
|
+
"@tiptap/core": "^2.1.6",
|
|
68
|
+
"@tiptap/extension-bold": "^2.1.6",
|
|
69
|
+
"@tiptap/extension-bullet-list": "^2.1.6",
|
|
70
|
+
"@tiptap/extension-document": "^2.1.6",
|
|
71
|
+
"@tiptap/extension-history": "^2.1.6",
|
|
72
|
+
"@tiptap/extension-italic": "^2.1.6",
|
|
73
|
+
"@tiptap/extension-list-item": "^2.1.6",
|
|
74
|
+
"@tiptap/extension-ordered-list": "^2.1.6",
|
|
75
|
+
"@tiptap/extension-paragraph": "^2.1.6",
|
|
76
|
+
"@tiptap/extension-placeholder": "^2.1.6",
|
|
77
|
+
"@tiptap/extension-text": "^2.1.6",
|
|
77
78
|
"@types/d3-array": "^3.0.4",
|
|
78
79
|
"@types/d3-random": "^3.0.1",
|
|
79
80
|
"@types/d3-scale": "^4.0.2",
|