@aquera/nile-elements 2.0.21 → 2.0.22
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/README.md +4 -0
- package/dist/index.js +120 -47
- package/dist/nile-empty-state/nile-empty-state.cjs.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.cjs.js.map +1 -1
- package/dist/nile-empty-state/nile-empty-state.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +73 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +3 -2
- package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
- package/dist/src/nile-empty-state/nile-empty-state.d.ts +5 -0
- package/dist/src/nile-empty-state/nile-empty-state.js +11 -2
- package/dist/src/nile-empty-state/nile-empty-state.js.map +1 -1
- package/dist/src/nile-empty-state/nile-empty-state.test.js +31 -0
- package/dist/src/nile-empty-state/nile-empty-state.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/index.d.ts +2 -1
- package/dist/src/nile-wysiwyg-editor/index.js +1 -1
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +75 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +37 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +108 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/types.d.ts +8 -0
- package/dist/src/nile-wysiwyg-editor/types.js +50 -0
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-empty-state/nile-empty-state.test.ts +24 -0
- package/src/nile-empty-state/nile-empty-state.ts +12 -2
- package/src/nile-wysiwyg-editor/index.ts +2 -1
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +76 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +132 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +40 -1
- package/src/nile-wysiwyg-editor/types.ts +52 -0
- package/vscode-html-custom-data.json +23 -2
package/package.json
CHANGED
|
@@ -280,4 +280,28 @@ describe('NileEmptyState', () => {
|
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
it('165. full new-API integration', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state status="not-found" layout="page" size="lg" code="Error 404" bordered><button>Go back</button></nile-empty-state>`); expect(el.text).to.contain(`couldn't find that`); expect(el.tone).to.equal('warning'); expect(container(el).getAttribute('role')).to.equal('status'); expect(container(el).classList.contains('empty-state--page')).to.be.true; expect(container(el).classList.contains('empty-state--bordered')).to.be.true; expect(el.shadowRoot!.querySelector('[part="code"]')!.textContent).to.contain('Error 404'); expect(el.querySelector('button')).to.exist; });
|
|
283
|
+
// iconMethod: stroke stays the default everywhere; fill is opt-in.
|
|
284
|
+
it('192. iconMethod defaults to stroke', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state></nile-empty-state>`); expect(el.iconMethod).to.equal('stroke'); });
|
|
285
|
+
it('193. default glyph method is stroke in every variant and layout', async () => {
|
|
286
|
+
for (const t of [
|
|
287
|
+
html`<nile-empty-state variant="tonal"></nile-empty-state>`,
|
|
288
|
+
html`<nile-empty-state variant="content"></nile-empty-state>`,
|
|
289
|
+
html`<nile-empty-state variant="flat"></nile-empty-state>`,
|
|
290
|
+
html`<nile-empty-state layout="inline"></nile-empty-state>`,
|
|
291
|
+
html`<nile-empty-state svgIconUrl="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E"></nile-empty-state>`,
|
|
292
|
+
]) { const el = await fixture<NileEmptyState>(t); expect(glyph(el).getAttribute('method')).to.equal('stroke'); }
|
|
293
|
+
});
|
|
294
|
+
it('194. iconMethod is not reflected, so existing hosts gain no attribute', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state></nile-empty-state>`); expect(el.hasAttribute('iconmethod')).to.be.false; });
|
|
295
|
+
it('195. iconMethod="fill" passes method="fill" in every variant and layout', async () => {
|
|
296
|
+
for (const t of [
|
|
297
|
+
html`<nile-empty-state iconMethod="fill" variant="tonal"></nile-empty-state>`,
|
|
298
|
+
html`<nile-empty-state iconMethod="fill" variant="content"></nile-empty-state>`,
|
|
299
|
+
html`<nile-empty-state iconMethod="fill" variant="flat"></nile-empty-state>`,
|
|
300
|
+
html`<nile-empty-state iconMethod="fill" layout="inline"></nile-empty-state>`,
|
|
301
|
+
]) { const el = await fixture<NileEmptyState>(t); expect(glyph(el).getAttribute('method')).to.equal('fill'); }
|
|
302
|
+
});
|
|
303
|
+
it('196. iconMethod="fill" with svgIconUrl keeps noFill so the SVG keeps its own colours', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state iconMethod="fill" svgIconUrl="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E"></nile-empty-state>`); expect(glyph(el).getAttribute('method')).to.equal('fill'); expect(glyph(el).hasAttribute('nofill')).to.be.true; });
|
|
304
|
+
it('197. unknown iconMethod falls back to stroke', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state iconMethod="bogus"></nile-empty-state>`); expect(glyph(el).getAttribute('method')).to.equal('stroke'); });
|
|
305
|
+
it('198. iconMethod can be toggled at runtime', async () => { const el = await fixture<NileEmptyState>(html`<nile-empty-state></nile-empty-state>`); el.iconMethod = 'fill'; await el.updateComplete; expect(glyph(el).getAttribute('method')).to.equal('fill'); el.iconMethod = 'stroke'; await el.updateComplete; expect(glyph(el).getAttribute('method')).to.equal('stroke'); });
|
|
306
|
+
it('199. iconMethod does not change icon, size or colour', async () => { const a = await fixture<NileEmptyState>(html`<nile-empty-state status="error"></nile-empty-state>`); const b = await fixture<NileEmptyState>(html`<nile-empty-state status="error" iconMethod="fill"></nile-empty-state>`); for (const attr of ['name', 'size', 'color']) expect(glyph(b).getAttribute(attr), attr).to.equal(glyph(a).getAttribute(attr)); });
|
|
283
307
|
});
|
|
@@ -27,6 +27,9 @@ export type NileEmptyStateTone = 'neutral' | 'info' | 'warning' | 'error';
|
|
|
27
27
|
/** What shape the state occupies. */
|
|
28
28
|
export type NileEmptyStateLayout = 'stack' | 'inline' | 'page';
|
|
29
29
|
|
|
30
|
+
/** How the glyph is drawn: outlined (`stroke`, the default) or filled (`fill`). */
|
|
31
|
+
export type NileEmptyStateIconMethod = 'stroke' | 'fill';
|
|
32
|
+
|
|
30
33
|
interface StatusPreset {
|
|
31
34
|
icon: string;
|
|
32
35
|
tone: NileEmptyStateTone;
|
|
@@ -109,6 +112,7 @@ export class NileEmptyState extends NileElement {
|
|
|
109
112
|
*/
|
|
110
113
|
@property({ type: Number, attribute: true }) svgIconSize?: number;
|
|
111
114
|
@property({ type: String, attribute: true }) svgIconColor: string;
|
|
115
|
+
@property({ type: String, attribute: true }) iconMethod: NileEmptyStateIconMethod = 'stroke';
|
|
112
116
|
|
|
113
117
|
private _icon?: string;
|
|
114
118
|
private _text?: string;
|
|
@@ -169,6 +173,11 @@ export class NileEmptyState extends NileElement {
|
|
|
169
173
|
return this.status ? STATUS_PRESETS[this.status] : undefined;
|
|
170
174
|
}
|
|
171
175
|
|
|
176
|
+
/** `fill` only when asked for explicitly; anything else keeps today's `stroke`. */
|
|
177
|
+
private get glyphMethod(): NileEmptyStateIconMethod {
|
|
178
|
+
return this.iconMethod === 'fill' ? 'fill' : 'stroke';
|
|
179
|
+
}
|
|
180
|
+
|
|
172
181
|
private get glyphColor(): string | undefined {
|
|
173
182
|
return this.svgIconColor ?? TONE_GLYPH_COLOR[this.tone];
|
|
174
183
|
}
|
|
@@ -182,18 +191,19 @@ export class NileEmptyState extends NileElement {
|
|
|
182
191
|
|
|
183
192
|
private renderGlyph(size: number | string): TemplateResult {
|
|
184
193
|
const color = this.glyphColor;
|
|
194
|
+
const method = this.glyphMethod;
|
|
185
195
|
return this.svgIconUrl ? html`
|
|
186
196
|
<nile-glyph
|
|
187
197
|
customSvgPath="${this.svgIconUrl}"
|
|
188
198
|
size="${this.svgIconSize ?? size}"
|
|
189
|
-
method="
|
|
199
|
+
method="${method}"
|
|
190
200
|
color="${ifDefined(color)}"
|
|
191
201
|
noFill
|
|
192
202
|
></nile-glyph>
|
|
193
203
|
` : html`
|
|
194
204
|
<nile-glyph
|
|
195
205
|
name="${this.icon}"
|
|
196
|
-
method="
|
|
206
|
+
method="${method}"
|
|
197
207
|
size="${size}"
|
|
198
208
|
color="${ifDefined(color)}"
|
|
199
209
|
></nile-glyph>
|
|
@@ -3,6 +3,7 @@ export { NileWysiwygToolbarItem } from './nile-wysiwyg-toolbar/nile-wysiwyg-tool
|
|
|
3
3
|
export { NileWysiwygBubbleItem } from './ui/bubble-item';
|
|
4
4
|
export type { AuthoredToolbarItem } from './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar';
|
|
5
5
|
export type { WysiwygChangeDetail, WysiwygCommandDetail, ToolbarConfig } from './types';
|
|
6
|
-
export { DEFAULT_TOOLBAR } from './types';
|
|
6
|
+
export { DEFAULT_TOOLBAR, NO_THEME_COMPONENTS } from './types';
|
|
7
|
+
export type { NoThemeComponent } from './types';
|
|
7
8
|
export { createKatexRenderer } from './math/katex-renderer';
|
|
8
9
|
export type { KatexLike, KatexRendererOptions } from './math/katex-renderer';
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
+
/** Semantic --ng-* tokens used inside the editing surface, re-pointed at their
|
|
4
|
+
* light-theme primitives. Used by no-theme / no-theme-components. */
|
|
5
|
+
const lightThemeTokens = css`
|
|
6
|
+
--ng-colors-bg-primary: var(--ng-color-base-white);
|
|
7
|
+
--ng-colors-bg-secondary: var(--ng-color-graylightmode-50);
|
|
8
|
+
--ng-colors-bg-tertiary: var(--ng-color-graylightmode-100);
|
|
9
|
+
--ng-colors-bg-disabled-subtle: var(--ng-color-graylightmode-50);
|
|
10
|
+
--ng-colors-text-primary-900: var(--ng-color-graylightmode-900);
|
|
11
|
+
--ng-colors-text-tertiary-600: var(--ng-color-graylightmode-600);
|
|
12
|
+
--ng-colors-text-quaternary-500: var(--ng-color-graylightmode-500);
|
|
13
|
+
--ng-colors-text-disabled: var(--ng-color-graylightmode-400);
|
|
14
|
+
--ng-colors-text-brand-tertiary-600: var(--ng-color-bluedark-600);
|
|
15
|
+
--ng-colors-border-primary: var(--ng-color-graylightmode-300);
|
|
16
|
+
--ng-colors-border-secondary: var(--ng-color-graylightmode-200);
|
|
17
|
+
--ng-colors-border-neutral: var(--ng-color-graylightmode-400);
|
|
18
|
+
--ng-colors-border-disabled: var(--ng-color-graylightmode-200);
|
|
19
|
+
/* mention chips, code highlighting, tracked changes */
|
|
20
|
+
--ng-componentcolors-utility-blue-50: var(--ng-color-blue-50);
|
|
21
|
+
--ng-componentcolors-utility-blue-600: var(--ng-color-blue-600);
|
|
22
|
+
--ng-componentcolors-utility-blue-700: var(--ng-color-blue-700);
|
|
23
|
+
--ng-componentcolors-utility-error-600: var(--ng-color-error-600);
|
|
24
|
+
--ng-componentcolors-utility-gray-500: var(--ng-color-graylightmode-500);
|
|
25
|
+
--ng-componentcolors-utility-green-600: var(--ng-color-green-600);
|
|
26
|
+
--ng-componentcolors-utility-indigo-600: var(--ng-color-indigo-600);
|
|
27
|
+
--ng-componentcolors-utility-orange-600: var(--ng-color-orange-600);
|
|
28
|
+
--ng-componentcolors-utility-purple-300: var(--ng-color-purple-300);
|
|
29
|
+
--ng-componentcolors-utility-purple-600: var(--ng-color-purple-600);
|
|
30
|
+
`;
|
|
31
|
+
|
|
3
32
|
export const styles = css`
|
|
4
33
|
:host {
|
|
5
34
|
display: block;
|
|
@@ -74,6 +103,53 @@ export const styles = css`
|
|
|
74
103
|
max-height: var(--nile-wysiwyg-max-height, none);
|
|
75
104
|
}
|
|
76
105
|
|
|
106
|
+
/* --- no-theme / no-theme-components: keep content on light colours ---
|
|
107
|
+
* Dark themes remap the semantic --ng-* tokens at :root; the primitives they
|
|
108
|
+
* point at do not change. Re-pointing the semantic tokens at their light
|
|
109
|
+
* primitives (lightThemeTokens) on an element keeps it and everything inside
|
|
110
|
+
* it light, while the rest of the editor keeps following the page theme.
|
|
111
|
+
* no-theme -> the whole editing surface
|
|
112
|
+
* no-theme-components="a,b" -> only the listed content components
|
|
113
|
+
* (all | mentions | merge-fields | links | math | code | blockquote |
|
|
114
|
+
* table | task-list | images) */
|
|
115
|
+
:host([no-theme]) .nile-wysiwyg__surface,
|
|
116
|
+
.nile-wysiwyg[data-no-theme~='all'] .nile-wysiwyg__surface {
|
|
117
|
+
color-scheme: light;
|
|
118
|
+
${lightThemeTokens}
|
|
119
|
+
background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
120
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Inline components and those that paint their own background: the light
|
|
124
|
+
* tokens are enough. */
|
|
125
|
+
.nile-wysiwyg[data-no-theme~='mentions'] .ProseMirror span.nile-wysiwyg__mention,
|
|
126
|
+
.nile-wysiwyg[data-no-theme~='merge-fields'] .ProseMirror span.nile-wysiwyg__merge-field,
|
|
127
|
+
.nile-wysiwyg[data-no-theme~='links'] .ProseMirror a,
|
|
128
|
+
.nile-wysiwyg[data-no-theme~='math'] .ProseMirror span.nile-wysiwyg__math,
|
|
129
|
+
.nile-wysiwyg[data-no-theme~='code'] .ProseMirror code.nile-wysiwyg__inline-code,
|
|
130
|
+
.nile-wysiwyg[data-no-theme~='code'] .ProseMirror pre.nile-wysiwyg__code-block {
|
|
131
|
+
color-scheme: light;
|
|
132
|
+
${lightThemeTokens}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Text inside these inherits the surface colour, so pin it too. */
|
|
136
|
+
.nile-wysiwyg[data-no-theme~='code'] .ProseMirror code.nile-wysiwyg__inline-code,
|
|
137
|
+
.nile-wysiwyg[data-no-theme~='code'] .ProseMirror pre.nile-wysiwyg__code-block,
|
|
138
|
+
.nile-wysiwyg[data-no-theme~='math'] .ProseMirror span.nile-wysiwyg__math {
|
|
139
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Block components with no background of their own get the light surface. */
|
|
143
|
+
.nile-wysiwyg[data-no-theme~='table'] .ProseMirror table,
|
|
144
|
+
.nile-wysiwyg[data-no-theme~='blockquote'] .ProseMirror blockquote,
|
|
145
|
+
.nile-wysiwyg[data-no-theme~='task-list'] .ProseMirror ul.nile-wysiwyg__task-list,
|
|
146
|
+
.nile-wysiwyg[data-no-theme~='images'] .ProseMirror figure.nile-wysiwyg__figure {
|
|
147
|
+
color-scheme: light;
|
|
148
|
+
${lightThemeTokens}
|
|
149
|
+
background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
150
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
151
|
+
}
|
|
152
|
+
|
|
77
153
|
/* --- ProseMirror base rules (inlined from prosemirror-view/style) --- */
|
|
78
154
|
.ProseMirror {
|
|
79
155
|
position: relative;
|
|
@@ -1008,4 +1008,136 @@ describe('nile-wysiwyg-editor', () => {
|
|
|
1008
1008
|
expect(weightOf(el, 'normalCell')).to.equal('400');
|
|
1009
1009
|
});
|
|
1010
1010
|
});
|
|
1011
|
+
describe('no-theme', () => {
|
|
1012
|
+
const DARK_STYLE_ID = 'no-theme-test-dark';
|
|
1013
|
+
afterEach(() => document.getElementById(DARK_STYLE_ID)?.remove());
|
|
1014
|
+
|
|
1015
|
+
function applyDarkTokens() {
|
|
1016
|
+
const style = document.createElement('style');
|
|
1017
|
+
style.id = DARK_STYLE_ID;
|
|
1018
|
+
style.textContent = `:root {
|
|
1019
|
+
--ng-color-base-white: rgb(255, 255, 255);
|
|
1020
|
+
--ng-color-graylightmode-900: rgb(24, 29, 39);
|
|
1021
|
+
--ng-colors-bg-primary: rgb(34, 38, 47);
|
|
1022
|
+
--ng-colors-text-primary-900: rgb(247, 247, 247);
|
|
1023
|
+
}`;
|
|
1024
|
+
document.head.appendChild(style);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
const surfaceOf = (el: NileWysiwygEditor) =>
|
|
1028
|
+
el.shadowRoot!.querySelector('.nile-wysiwyg__surface') as HTMLElement;
|
|
1029
|
+
|
|
1030
|
+
it('is off by default and reflects to the no-theme attribute', async () => {
|
|
1031
|
+
const el = await editorFixture();
|
|
1032
|
+
expect(el.noTheme).to.equal(false);
|
|
1033
|
+
expect(el.hasAttribute('no-theme')).to.equal(false);
|
|
1034
|
+
el.noTheme = true;
|
|
1035
|
+
await el.updateComplete;
|
|
1036
|
+
expect(el.hasAttribute('no-theme')).to.equal(true);
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
it('keeps the surface on light colours under a dark theme', async () => {
|
|
1040
|
+
applyDarkTokens();
|
|
1041
|
+
const el = await editorFixture(
|
|
1042
|
+
html`<nile-wysiwyg-editor no-theme value="<p>hi</p>"></nile-wysiwyg-editor>`
|
|
1043
|
+
);
|
|
1044
|
+
const cs = getComputedStyle(surfaceOf(el));
|
|
1045
|
+
expect(cs.backgroundColor).to.equal('rgb(255, 255, 255)');
|
|
1046
|
+
expect(cs.color).to.equal('rgb(24, 29, 39)');
|
|
1047
|
+
expect(cs.colorScheme).to.equal('light');
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
it('keeps mention chips on light colours under a dark theme', async () => {
|
|
1051
|
+
applyDarkTokens();
|
|
1052
|
+
const style = document.getElementById(DARK_STYLE_ID)!;
|
|
1053
|
+
style.textContent += `:root {
|
|
1054
|
+
--ng-color-blue-50: rgb(239, 248, 255);
|
|
1055
|
+
--ng-componentcolors-utility-blue-50: rgb(16, 42, 86);
|
|
1056
|
+
}`;
|
|
1057
|
+
const el = await editorFixture(
|
|
1058
|
+
html`<nile-wysiwyg-editor no-theme></nile-wysiwyg-editor>`
|
|
1059
|
+
);
|
|
1060
|
+
el.mentions = { '@': [{ key: 'u1', label: 'Ada' }] };
|
|
1061
|
+
el.value = '<p><span class="nile-wysiwyg__mention" data-mention-key="u1" data-mention-trigger="@">@Ada</span></p>';
|
|
1062
|
+
await el.updateComplete;
|
|
1063
|
+
const chip = el.shadowRoot!.querySelector('span.nile-wysiwyg__mention') as HTMLElement;
|
|
1064
|
+
expect(chip, 'mention chip rendered').to.exist;
|
|
1065
|
+
expect(getComputedStyle(chip).backgroundColor).to.equal('rgb(239, 248, 255)');
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
describe('no-theme-components', () => {
|
|
1069
|
+
const baseOf = (el: NileWysiwygEditor) =>
|
|
1070
|
+
el.shadowRoot!.querySelector('[part="base"]') as HTMLElement;
|
|
1071
|
+
|
|
1072
|
+
it('parses comma, space, JSON and unquoted-array forms and drops unknown names', async () => {
|
|
1073
|
+
const cases: [string, string[]][] = [
|
|
1074
|
+
['mentions,table', ['mentions', 'table']],
|
|
1075
|
+
['Mentions table, code', ['mentions', 'table', 'code']],
|
|
1076
|
+
['["table","mentions","table"]', ['table', 'mentions']],
|
|
1077
|
+
['[mentions, table]', ['mentions', 'table']],
|
|
1078
|
+
['bogus, links', ['links']],
|
|
1079
|
+
];
|
|
1080
|
+
for (const [attr, expected] of cases) {
|
|
1081
|
+
const el = await editorFixture(
|
|
1082
|
+
html`<nile-wysiwyg-editor no-theme-components=${attr}></nile-wysiwyg-editor>`
|
|
1083
|
+
);
|
|
1084
|
+
expect(el.noThemeComponents, attr).to.deep.equal(expected);
|
|
1085
|
+
expect(baseOf(el).dataset.noTheme, attr).to.equal(expected.join(' '));
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
it('accepts an array property and omits data-no-theme when empty', async () => {
|
|
1090
|
+
const el = await editorFixture();
|
|
1091
|
+
expect(baseOf(el).hasAttribute('data-no-theme')).to.equal(false);
|
|
1092
|
+
el.noThemeComponents = ['table', 'mentions'];
|
|
1093
|
+
await el.updateComplete;
|
|
1094
|
+
expect(baseOf(el).dataset.noTheme).to.equal('table mentions');
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
it('keeps only the listed component light; the surface follows the theme', async () => {
|
|
1098
|
+
applyDarkTokens();
|
|
1099
|
+
const style = document.getElementById(DARK_STYLE_ID)!;
|
|
1100
|
+
style.textContent += `:root {
|
|
1101
|
+
--ng-color-blue-50: rgb(239, 248, 255);
|
|
1102
|
+
--ng-componentcolors-utility-blue-50: rgb(16, 42, 86);
|
|
1103
|
+
}`;
|
|
1104
|
+
const el = await editorFixture(
|
|
1105
|
+
html`<nile-wysiwyg-editor no-theme-components="mentions"></nile-wysiwyg-editor>`
|
|
1106
|
+
);
|
|
1107
|
+
el.mentions = { '@': [{ key: 'u1', label: 'Ada' }] };
|
|
1108
|
+
el.value =
|
|
1109
|
+
'<p>Hi <span data-mention-key="u1" data-mention-trigger="@">@Ada</span></p>' +
|
|
1110
|
+
'<table><tbody><tr><td>cell</td></tr></tbody></table>';
|
|
1111
|
+
await el.updateComplete;
|
|
1112
|
+
const chip = el.shadowRoot!.querySelector('span.nile-wysiwyg__mention') as HTMLElement;
|
|
1113
|
+
const table = el.shadowRoot!.querySelector('.ProseMirror table') as HTMLElement;
|
|
1114
|
+
expect(getComputedStyle(chip).backgroundColor).to.equal('rgb(239, 248, 255)');
|
|
1115
|
+
expect(getComputedStyle(table).backgroundColor).to.not.equal('rgb(255, 255, 255)');
|
|
1116
|
+
expect(getComputedStyle(surfaceOf(el)).backgroundColor).to.not.equal('rgb(255, 255, 255)');
|
|
1117
|
+
|
|
1118
|
+
el.noThemeComponents = ['table'];
|
|
1119
|
+
await el.updateComplete;
|
|
1120
|
+
expect(getComputedStyle(table).backgroundColor).to.equal('rgb(255, 255, 255)');
|
|
1121
|
+
expect(getComputedStyle(table).color).to.equal('rgb(24, 29, 39)');
|
|
1122
|
+
expect(getComputedStyle(chip).backgroundColor).to.not.equal('rgb(239, 248, 255)');
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
it('"all" behaves like no-theme', async () => {
|
|
1126
|
+
applyDarkTokens();
|
|
1127
|
+
const el = await editorFixture(
|
|
1128
|
+
html`<nile-wysiwyg-editor no-theme-components="all"></nile-wysiwyg-editor>`
|
|
1129
|
+
);
|
|
1130
|
+
const cs = getComputedStyle(surfaceOf(el));
|
|
1131
|
+
expect(cs.backgroundColor).to.equal('rgb(255, 255, 255)');
|
|
1132
|
+
expect(cs.color).to.equal('rgb(24, 29, 39)');
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
it('leaves the surface on theme colours without no-theme', async () => {
|
|
1137
|
+
applyDarkTokens();
|
|
1138
|
+
const el = await editorFixture();
|
|
1139
|
+
const cs = getComputedStyle(surfaceOf(el));
|
|
1140
|
+
expect(cs.backgroundColor).to.not.equal('rgb(255, 255, 255)');
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1011
1143
|
});
|
|
@@ -66,7 +66,8 @@ import type {
|
|
|
66
66
|
MergeFieldConfig,
|
|
67
67
|
TemplateConfig,
|
|
68
68
|
} from './types';
|
|
69
|
-
import { DEFAULT_TOOLBAR } from './types';
|
|
69
|
+
import { DEFAULT_TOOLBAR, parseNoThemeComponents } from './types';
|
|
70
|
+
import type { NoThemeComponent } from './types';
|
|
70
71
|
import { EMOJI } from './emoji';
|
|
71
72
|
|
|
72
73
|
import './nile-wysiwyg-toolbar/nile-wysiwyg-toolbar';
|
|
@@ -144,6 +145,15 @@ function readFileAsDataURL(file: File): Promise<string> {
|
|
|
144
145
|
|
|
145
146
|
const CHANGE_DEBOUNCE_MS = 250;
|
|
146
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Attribute converter for `no-theme-components`. A named constant (not an inline
|
|
150
|
+
* arrow) so the @property options stay parenthesis-free: nile-lint's manifest
|
|
151
|
+
* scanner reads `@property({...})` with a regex that stops at the first `)`.
|
|
152
|
+
*/
|
|
153
|
+
const NO_THEME_COMPONENTS_CONVERTER = {
|
|
154
|
+
fromAttribute: (value: string | null): NoThemeComponent[] => parseNoThemeComponents(value),
|
|
155
|
+
};
|
|
156
|
+
|
|
147
157
|
/**
|
|
148
158
|
* WYSIWYG rich text editor powered by ProseMirror.
|
|
149
159
|
*
|
|
@@ -398,6 +408,25 @@ export class NileWysiwygEditor extends NileElement {
|
|
|
398
408
|
@property({ type: Boolean, attribute: 'show-blocks', reflect: true })
|
|
399
409
|
showBlocks = false;
|
|
400
410
|
|
|
411
|
+
/**
|
|
412
|
+
* Keeps the editing surface on light-theme colours whatever the page theme
|
|
413
|
+
* (e.g. nxtgen dark), so authored content looks the way it will be sent.
|
|
414
|
+
* The toolbar still follows the theme.
|
|
415
|
+
*/
|
|
416
|
+
@property({ type: Boolean, attribute: 'no-theme', reflect: true })
|
|
417
|
+
noTheme = false;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Like `noTheme`, but only for the listed content components, which stay on
|
|
421
|
+
* light-theme colours while the rest of the surface follows the page theme.
|
|
422
|
+
* Values: `all`, `mentions`, `merge-fields`, `links`, `math`, `code`,
|
|
423
|
+
* `blockquote`, `table`, `task-list`, `images`. Unknown names are ignored.
|
|
424
|
+
* Set as an array (`['mentions', 'table']`), or as an attribute holding a
|
|
425
|
+
* comma/space-separated list (`"mentions, table"`) or a JSON array.
|
|
426
|
+
*/
|
|
427
|
+
@property({ attribute: 'no-theme-components', converter: NO_THEME_COMPONENTS_CONVERTER })
|
|
428
|
+
noThemeComponents: NoThemeComponent[] = [];
|
|
429
|
+
|
|
401
430
|
@state() private toolbarState?: ToolbarState;
|
|
402
431
|
|
|
403
432
|
@state() private hasFocus = false;
|
|
@@ -2178,6 +2207,15 @@ export class NileWysiwygEditor extends NileElement {
|
|
|
2178
2207
|
this.closeAllPanels(insideWidget);
|
|
2179
2208
|
};
|
|
2180
2209
|
|
|
2210
|
+
/** Space-separated, validated list for the base element's data-no-theme,
|
|
2211
|
+
* which the stylesheet matches with [data-no-theme~='name']. Accepts a
|
|
2212
|
+
* string too, for callers that set the property from plain JS. */
|
|
2213
|
+
private noThemeComponentsAttr(): string {
|
|
2214
|
+
return parseNoThemeComponents(
|
|
2215
|
+
this.noThemeComponents as unknown as string | readonly string[]
|
|
2216
|
+
).join(' ');
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2181
2219
|
public render(): TemplateResult {
|
|
2182
2220
|
const hasAuthoredToolbar = (this.authoredToolbar?.length ?? 0) > 0;
|
|
2183
2221
|
// Keep the toolbar mounted in source mode too, so the main menu stays put
|
|
@@ -2190,6 +2228,7 @@ export class NileWysiwygEditor extends NileElement {
|
|
|
2190
2228
|
<div
|
|
2191
2229
|
class="nile-wysiwyg ${this.showBlocks ? 'nile-wysiwyg--show-blocks' : ''}"
|
|
2192
2230
|
part="base"
|
|
2231
|
+
data-no-theme=${this.noThemeComponentsAttr() || nothing}
|
|
2193
2232
|
@wysiwyg-command=${this.handleCommand}
|
|
2194
2233
|
@focusout=${this.handleChromeFocusOut}
|
|
2195
2234
|
@keydown=${this.handleBaseKeydown}
|
|
@@ -83,3 +83,55 @@ export const DEFAULT_TOOLBAR =
|
|
|
83
83
|
'>> mergeField template | ' +
|
|
84
84
|
'formatPainter caseChange clearFormatting pastePlainText showBlocks sourceView | ' +
|
|
85
85
|
'importMarkdown importWord exportInlineHtml exportWord exportPdf | shortcutHelp fullscreen';
|
|
86
|
+
|
|
87
|
+
/** Content components that `no-theme-components` can keep on light colours. */
|
|
88
|
+
export const NO_THEME_COMPONENTS = [
|
|
89
|
+
'all',
|
|
90
|
+
'mentions',
|
|
91
|
+
'merge-fields',
|
|
92
|
+
'links',
|
|
93
|
+
'math',
|
|
94
|
+
'code',
|
|
95
|
+
'blockquote',
|
|
96
|
+
'table',
|
|
97
|
+
'task-list',
|
|
98
|
+
'images',
|
|
99
|
+
] as const;
|
|
100
|
+
|
|
101
|
+
export type NoThemeComponent = (typeof NO_THEME_COMPONENTS)[number];
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Normalises a `no-theme-components` value: a JSON array, or a comma/space
|
|
105
|
+
* separated list, or an unquoted `[a, b]`. Lower-cases, de-duplicates and drops unknown names.
|
|
106
|
+
*/
|
|
107
|
+
export function parseNoThemeComponents(
|
|
108
|
+
value: string | readonly string[] | null | undefined
|
|
109
|
+
): NoThemeComponent[] {
|
|
110
|
+
if (value == null) return [];
|
|
111
|
+
let names: unknown[] = [];
|
|
112
|
+
if (Array.isArray(value)) {
|
|
113
|
+
names = value;
|
|
114
|
+
} else {
|
|
115
|
+
const text = String(value).trim();
|
|
116
|
+
if (text.startsWith('[')) {
|
|
117
|
+
try {
|
|
118
|
+
const parsed = JSON.parse(text);
|
|
119
|
+
names = Array.isArray(parsed) ? parsed : [];
|
|
120
|
+
} catch {
|
|
121
|
+
// Unquoted form, e.g. [mentions, table]
|
|
122
|
+
names = text.replace(/^\[|\]$/g, '').split(/[\s,'"]+/);
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
names = text.split(/[\s,]+/);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const known = new Set<string>(NO_THEME_COMPONENTS);
|
|
129
|
+
const out: NoThemeComponent[] = [];
|
|
130
|
+
for (const n of names) {
|
|
131
|
+
const name = typeof n === 'string' ? n.trim().toLowerCase() : '';
|
|
132
|
+
if (known.has(name) && !out.includes(name as NoThemeComponent)) {
|
|
133
|
+
out.push(name as NoThemeComponent);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
@@ -3028,7 +3028,7 @@
|
|
|
3028
3028
|
},
|
|
3029
3029
|
{
|
|
3030
3030
|
"name": "nile-empty-state",
|
|
3031
|
-
"description": "Nile empty-state component.\n\nAttributes:\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - \n\n * `variant` {`\"content\" | \"flat\" | \"tonal\"`} - \n\n * `status` {`\"error\" | \"empty\" | \"no-results\" | \"not-found\" | \"no-access\" | \"offline\" | undefined`} - \n\n * `layout` {`NileEmptyStateLayout`} - \n\n * `code` {`string | undefined`} - \n\n * `bordered` {`boolean`} - \n\n * `svgIconUrl` {`string`} - \n\n * `svgIconSize` {`number | undefined`} - Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\nthe SVG matches whatever size the current variant/layout draws at.\n\n * `svgIconColor` {`string`} - \n\n * `icon` {`string`} - \n\n * `text` {`string`} - Headline. Resolves through the `status` preset to `DEFAULT_TEXT`.\n\n * `sub-text` {`string`} - Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`.\n\n * `tone` {`NileEmptyStateTone`} - \n\nProperties:\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - \n\n * `variant` {`\"content\" | \"flat\" | \"tonal\"`} - \n\n * `status` {`\"error\" | \"empty\" | \"no-results\" | \"not-found\" | \"no-access\" | \"offline\" | undefined`} - \n\n * `layout` {`NileEmptyStateLayout`} - \n\n * `code` {`string | undefined`} - \n\n * `bordered` {`boolean`} - \n\n * `svgIconUrl` {`string`} - \n\n * `svgIconSize` {`number | undefined`} - Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\nthe SVG matches whatever size the current variant/layout draws at.\n\n * `svgIconColor` {`string`} - \n\n * `_icon` {`string | undefined`} - \n\n * `_text` {`string | undefined`} - \n\n * `_subText` {`string | undefined`} - \n\n * `_tone` {`\"warning\" | \"error\" | \"info\" | \"neutral\" | undefined`} - \n\n * `icon` {`string`} - \n\n * `text` {`string`} - Headline. Resolves through the `status` preset to `DEFAULT_TEXT`.\n\n * `subText` {`string`} - Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`.\n\n * `tone` {`NileEmptyStateTone`} - \n\n * `preset` {`StatusPreset | undefined`} - The preset backing the current `status`, or undefined when none is set.\n\n * `glyphColor` {`string | undefined`} - \n\n * `liveRegion` {`{ role: string; live: string; } | undefined`} - ARIA wiring\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
3031
|
+
"description": "Nile empty-state component.\n\nAttributes:\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - \n\n * `variant` {`\"content\" | \"flat\" | \"tonal\"`} - \n\n * `status` {`\"error\" | \"empty\" | \"no-results\" | \"not-found\" | \"no-access\" | \"offline\" | undefined`} - \n\n * `layout` {`NileEmptyStateLayout`} - \n\n * `code` {`string | undefined`} - \n\n * `bordered` {`boolean`} - \n\n * `svgIconUrl` {`string`} - \n\n * `svgIconSize` {`number | undefined`} - Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\nthe SVG matches whatever size the current variant/layout draws at.\n\n * `svgIconColor` {`string`} - \n\n * `iconMethod` {`NileEmptyStateIconMethod`} - \n\n * `icon` {`string`} - \n\n * `text` {`string`} - Headline. Resolves through the `status` preset to `DEFAULT_TEXT`.\n\n * `sub-text` {`string`} - Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`.\n\n * `tone` {`NileEmptyStateTone`} - \n\nProperties:\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - \n\n * `variant` {`\"content\" | \"flat\" | \"tonal\"`} - \n\n * `status` {`\"error\" | \"empty\" | \"no-results\" | \"not-found\" | \"no-access\" | \"offline\" | undefined`} - \n\n * `layout` {`NileEmptyStateLayout`} - \n\n * `code` {`string | undefined`} - \n\n * `bordered` {`boolean`} - \n\n * `svgIconUrl` {`string`} - \n\n * `svgIconSize` {`number | undefined`} - Overrides the layout-driven glyph size for a custom `svgIconUrl`. Left unset,\nthe SVG matches whatever size the current variant/layout draws at.\n\n * `svgIconColor` {`string`} - \n\n * `iconMethod` {`NileEmptyStateIconMethod`} - \n\n * `_icon` {`string | undefined`} - \n\n * `_text` {`string | undefined`} - \n\n * `_subText` {`string | undefined`} - \n\n * `_tone` {`\"warning\" | \"error\" | \"info\" | \"neutral\" | undefined`} - \n\n * `icon` {`string`} - \n\n * `text` {`string`} - Headline. Resolves through the `status` preset to `DEFAULT_TEXT`.\n\n * `subText` {`string`} - Supporting line. Resolves through the `status` preset to `DEFAULT_SUB_TEXT`.\n\n * `tone` {`NileEmptyStateTone`} - \n\n * `preset` {`StatusPreset | undefined`} - The preset backing the current `status`, or undefined when none is set.\n\n * `glyphMethod` {`NileEmptyStateIconMethod`} - `fill` only when asked for explicitly; anything else keeps today's `stroke`.\n\n * `glyphColor` {`string | undefined`} - \n\n * `liveRegion` {`{ role: string; live: string; } | undefined`} - ARIA wiring\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
3032
3032
|
"attributes": [
|
|
3033
3033
|
{
|
|
3034
3034
|
"name": "size",
|
|
@@ -3122,6 +3122,18 @@
|
|
|
3122
3122
|
"name": "svgIconColor",
|
|
3123
3123
|
"description": "`svgIconColor` {`string`} - \n\nProperty: svgIconColor"
|
|
3124
3124
|
},
|
|
3125
|
+
{
|
|
3126
|
+
"name": "iconMethod",
|
|
3127
|
+
"description": "`iconMethod` {`NileEmptyStateIconMethod`} - \n\nProperty: iconMethod\n\nDefault: stroke",
|
|
3128
|
+
"values": [
|
|
3129
|
+
{
|
|
3130
|
+
"name": "stroke"
|
|
3131
|
+
},
|
|
3132
|
+
{
|
|
3133
|
+
"name": "fill"
|
|
3134
|
+
}
|
|
3135
|
+
]
|
|
3136
|
+
},
|
|
3125
3137
|
{
|
|
3126
3138
|
"name": "icon",
|
|
3127
3139
|
"description": "`icon` {`string`} - \n\nProperty: icon"
|
|
@@ -9025,7 +9037,7 @@
|
|
|
9025
9037
|
},
|
|
9026
9038
|
{
|
|
9027
9039
|
"name": "nile-wysiwyg-editor",
|
|
9028
|
-
"description": "WYSIWYG rich text editor powered by ProseMirror.\n\nRequires evergreen browsers: selection inside shadow DOM relies on\n`Selection.getComposedRanges()` (Safari 17+, recent Firefox) or Chrome's\n`shadowRoot.getSelection()`.\n\nEvents:\n\n * `nile-change` {} - Debounced content change. detail: { value, json, content }\n\n * `nile-input` {} - Every document change. detail: { value, json, content }\n\n * `nile-focus` {} - Editor gained focus.\n\n * `nile-blur` {} - Editor lost focus.\n\n * `nile-selection-change` {} - detail: ToolbarState snapshot.\n\n * `nile-image-upload-request` {} - Cancelable. detail: { file, insert(src, alt) }.\nCall preventDefault() and use insert() to fully own the upload.\n\n * `nile-image-upload-error` {} - detail: { file, error } when uploadHandler rejects.\n\n * `nile-mention-query` {} - detail: { trigger, query, provide(items) } for async sources.\n\n * `nile-mention-select` {} - detail: { trigger, key, label } when a mention is inserted.\n\n * `nile-word-count` {} - detail: { words, characters } on every document change.\n\n * `nile-autosave` {} - detail: { value, json, content } on the autosave interval.\n\nAttributes:\n\n * `value` {`string`} - Document content as HTML. Not reflected to the attribute.\n\n * `placeholder` {`string`} - \n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `toolbar` {`string`} - Toolbar config string; `\"none\"` hides the toolbar.\n\n * `bubble-menu` {`boolean`} - Shows a balloon toolbar over text selections.\n\n * `sanitize` {`boolean`} - Sanitizes incoming HTML (value, paste, insertHTML). Leave on.\n\n * `singleline` {`boolean`} - Constrains content to a single paragraph.\n\n * `name` {`string`} - Form field name.\n\n * `required` {`boolean`} - \n\n * `upload-from-computer` {`boolean`} - Shows an \"Upload from computer\" button in the Insert Image dialog. Off by\ndefault (URL-only, like the RTE's default); files can always be added via\ndrag & drop or paste regardless.\n\n * `image-max-file-size` {`number`} - Max upload size (bytes) shown/enforced by the image dialog. Default 2 MB.\n\n * `mentions` - Mention config: trigger character → items, same shape and JSON attribute\nformat as nile-rich-text-editor. For async sources, configure the\ntrigger with an empty array and listen to nile-mention-query.\n\n * `no-slash-commands` {`boolean`} - Disables the \"/\" command menu.\n\n * `no-emoji` {`boolean`} - Disables the \":\" emoji picker.\n\n * `no-table-menu` {`boolean`} - Hides the floating table toolbar; with `email-fidelity` it also hides in layout tables.\n\n * `maxlength` {`number`} - Maximum character count; further input is rejected. 0 = unlimited.\n\n * `show-counter` {`boolean`} - Always show the word/character counter footer (implied by maxlength).\n\n * `sticky-toolbar` {`boolean`} - Keeps the toolbar pinned to the viewport while scrolling long content.\n\n * `snippets` {`SnippetConfig[]`} - Reusable snippets surfaced in the \"/\" menu (JSON attribute).\n\n * `merge-fields` {`MergeFieldConfig[]`} - Merge fields offered in the merge-field picker (JSON attribute).\n\n * `templates` {`TemplateConfig[]`} - Content templates offered in the template picker (JSON attribute).\n\n * `autosave-interval` {`number`} - Emit nile-autosave every N ms while the document has changed. 0 = off.\n\n * `paste-as-plain-text` {`boolean`} - When on, every paste drops formatting and inserts plain text.\n\n * `no-markdown-paste` {`boolean`} - Disables Markdown detection on plain-text pastes.\n\n * `email-fidelity` {`boolean`} - Opt-in mode for table-based email HTML; off by default (output unchanged).\n\n * `allowed-styles` - Extra inline CSS to keep per tag under `email-fidelity`: `{ td: ['letter-spacing'] }` or `\"td: letter-spacing\"`.\n\n * `no-text-transform` {`boolean`} - Disables typography autocorrect (smart quotes, dashes, (c) → ©).\n\n * `fullscreen` {`boolean`} - Expands the editor to fill the viewport. Esc exits.\n\n * `show-blocks` {`boolean`} - Outlines block boundaries (paragraphs, headings, lists…) while editing.\n\nProperties:\n\n * `formAssociated` {`boolean`} - \n\n * `value` {`string`} - Document content as HTML. Not reflected to the attribute.\n\n * `placeholder` {`string`} - \n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `toolbar` {`string`} - Toolbar config string; `\"none\"` hides the toolbar.\n\n * `authoredToolbar` {`AuthoredToolbarItem[] | undefined`} - Toolbar built from authored `<nile-wysiwyg-toolbar-item>` light-DOM\nchildren. When present it takes precedence over the `toolbar` string.\n\n * `authoredBubble` {`AuthoredToolbarItem[] | undefined`} - Bubble menu built from authored `<nile-wysiwyg-bubble-item>` light-DOM\nchildren. When present it replaces the built-in bold/italic/underline/\nstrike/link set.\n\n * `toolbarObserver` {`MutationObserver | undefined`} - Watches authored toolbar/bubble children so edits re-render them.\n\n * `bubbleMenu` {`boolean`} - Shows a balloon toolbar over text selections.\n\n * `sanitize` {`boolean`} - Sanitizes incoming HTML (value, paste, insertHTML). Leave on.\n\n * `singleLine` {`boolean`} - Constrains content to a single paragraph.\n\n * `name` {`string`} - Form field name.\n\n * `required` {`boolean`} - \n\n * `uploadHandler` - Async image upload handler. When set, pasted/dropped/picked image files\nare uploaded through it (an \"Uploading…\" placeholder shows meanwhile)\nand the returned src is inserted.\n\n * `allowBase64Images` {`boolean`} - Fallback when no uploadHandler is set and no nile-image-upload-request\nlistener takes over: embed image files as base64 data URLs.\n\n * `uploadFromComputer` {`boolean`} - Shows an \"Upload from computer\" button in the Insert Image dialog. Off by\ndefault (URL-only, like the RTE's default); files can always be added via\ndrag & drop or paste regardless.\n\n * `imageMaxFileSize` {`number`} - Max upload size (bytes) shown/enforced by the image dialog. Default 2 MB.\n\n * `mentions` - Mention config: trigger character → items, same shape and JSON attribute\nformat as nile-rich-text-editor. For async sources, configure the\ntrigger with an empty array and listen to nile-mention-query.\n\n * `noSlashCommands` {`boolean`} - Disables the \"/\" command menu.\n\n * `noEmoji` {`boolean`} - Disables the \":\" emoji picker.\n\n * `noTableMenu` {`boolean`} - Hides the floating table toolbar; with `email-fidelity` it also hides in layout tables.\n\n * `maxLength` {`number`} - Maximum character count; further input is rejected. 0 = unlimited.\n\n * `showCounter` {`boolean`} - Always show the word/character counter footer (implied by maxlength).\n\n * `stickyToolbar` {`boolean`} - Keeps the toolbar pinned to the viewport while scrolling long content.\n\n * `snippets` {`SnippetConfig[]`} - Reusable snippets surfaced in the \"/\" menu (JSON attribute).\n\n * `mergeFields` {`MergeFieldConfig[]`} - Merge fields offered in the merge-field picker (JSON attribute).\n\n * `templates` {`TemplateConfig[]`} - Content templates offered in the template picker (JSON attribute).\n\n * `mathRenderer` - Renders a math node's LaTeX to HTML (KaTeX/MathJax/MathML). When unset,\nthe raw LaTeX is shown. Same trust level as uploadHandler — output is\ninserted as HTML.\n\n * `autosaveInterval` {`number`} - Emit nile-autosave every N ms while the document has changed. 0 = off.\n\n * `pasteAsPlainText` {`boolean`} - When on, every paste drops formatting and inserts plain text.\n\n * `noMarkdownPaste` {`boolean`} - Disables Markdown detection on plain-text pastes.\n\n * `emailFidelity` {`boolean`} - Opt-in mode for table-based email HTML; off by default (output unchanged).\n\n * `allowedStyles` - Extra inline CSS to keep per tag under `email-fidelity`: `{ td: ['letter-spacing'] }` or `\"td: letter-spacing\"`.\n\n * `noTextTransform` {`boolean`} - Disables typography autocorrect (smart quotes, dashes, (c) → ©).\n\n * `fullscreen` {`boolean`} - Expands the editor to fill the viewport. Esc exits.\n\n * `showBlocks` {`boolean`} - Outlines block boundaries (paragraphs, headings, lists…) while editing.\n\n * `toolbarState` {`ToolbarState | undefined`} - \n\n * `hasFocus` {`boolean`} - \n\n * `sourceMode` {`boolean`} - \n\n * `counter` {`{ words: number; characters: number; }`} - \n\n * `insertMenuMode` {`\"template\" | \"merge\" | null`} - Which list the shared insert-menu is showing, if open.\n\n * `baseEl` {`HTMLElement`} - \n\n * `toolbarEl` {`HTMLElement | undefined`} - \n\n * `surfaceEl` {`HTMLElement`} - \n\n * `linkEditorEl` - \n\n * `bubbleMenuEl` - \n\n * `imagePanelEl` - \n\n * `tableMenuEl` - \n\n * `suggestListEl` - \n\n * `findBarEl` - \n\n * `sourceViewEl` - \n\n * `embedPanelEl` - \n\n * `bookmarkPanelEl` - \n\n * `codeMenuEl` - \n\n * `shortcutHelpEl` - \n\n * `imageMenuEl` - \n\n * `embedMenuEl` - \n\n * `specialCharsEl` - \n\n * `emojiPickerEl` - \n\n * `insertMenuEl` - \n\n * `mathPanelEl` - \n\n * `markdownPanelEl` - \n\n * `view` - \n\n * `normalizedAllowedStyles` {`NormalizedAllowedStyles`} - Validated `allowedStyles`, recomputed once per config change (so the\ndrop warnings fire once, not on every paste).\n\n * `mentionMatch` {`SuggestionMatch | null`} - \n\n * `slashMatch` {`SuggestionMatch | null`} - \n\n * `emojiMatch` {`SuggestionMatch | null`} - \n\n * `activeSuggestSource` {`\"mention\" | \"slash\" | \"emoji\" | null`} - \n\n * `suggestDismissed` {`string | null`} - \n\n * `mentionQueryToken` {`string`} - \n\n * `autosaveTimer` - \n\n * `lastAutosaveValue` {`string`} - \n\n * `internals` - \n\n * `defaultValue` {`string`} - \n\n * `syncingValue` {`boolean`} - \n\n * `lastSourceHtml` {`string`} - Last raw HTML given to setContent; a re-parse reads it while the document is unedited.\n\n * `lastSerializedValue` {`string`} - \n\n * `changeTimer` - \n\n * `pendingChange` {`boolean`} - \n\n * `previousBodyOverflow` {`string | null`} - Body overflow value before fullscreen locked it; null = not locked.\n\n * `onAnyScroll` - \n\n * `renderProbe` {`HTMLElement | null`} - \n\n * `painterDragActive` {`boolean`} - True while a drag-selection is in progress with the format painter armed.\nSuppresses the mid-drag auto-apply in {@link handleTransaction} so the\ncopied formatting lands on the final, complete selection (on mouse-up).\n\n * `onPainterPointerDown` - \n\n * `onPainterPointerUp` - \n\n * `contentRoot` {`HTMLElement | null`} - The live, styled content element used as the source for exports.\n\n * `pmView` - The underlying ProseMirror EditorView. Advanced escape hatch.\n\n * `json` - Document as ProseMirror JSON.\n\n * `override` - \n\n * `floatingPanels` {`({ open: boolean; } | undefined)[]`} - The floating insert panels that should dismiss on outside interaction.\n\n * `onOutsidePointerDown` - Closes any open insert panel when the pointer goes down outside of it —\nwhether elsewhere in the editor (e.g. the content area) or off the widget.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
9040
|
+
"description": "WYSIWYG rich text editor powered by ProseMirror.\n\nRequires evergreen browsers: selection inside shadow DOM relies on\n`Selection.getComposedRanges()` (Safari 17+, recent Firefox) or Chrome's\n`shadowRoot.getSelection()`.\n\nEvents:\n\n * `nile-change` {} - Debounced content change. detail: { value, json, content }\n\n * `nile-input` {} - Every document change. detail: { value, json, content }\n\n * `nile-focus` {} - Editor gained focus.\n\n * `nile-blur` {} - Editor lost focus.\n\n * `nile-selection-change` {} - detail: ToolbarState snapshot.\n\n * `nile-image-upload-request` {} - Cancelable. detail: { file, insert(src, alt) }.\nCall preventDefault() and use insert() to fully own the upload.\n\n * `nile-image-upload-error` {} - detail: { file, error } when uploadHandler rejects.\n\n * `nile-mention-query` {} - detail: { trigger, query, provide(items) } for async sources.\n\n * `nile-mention-select` {} - detail: { trigger, key, label } when a mention is inserted.\n\n * `nile-word-count` {} - detail: { words, characters } on every document change.\n\n * `nile-autosave` {} - detail: { value, json, content } on the autosave interval.\n\nAttributes:\n\n * `value` {`string`} - Document content as HTML. Not reflected to the attribute.\n\n * `placeholder` {`string`} - \n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `toolbar` {`string`} - Toolbar config string; `\"none\"` hides the toolbar.\n\n * `bubble-menu` {`boolean`} - Shows a balloon toolbar over text selections.\n\n * `sanitize` {`boolean`} - Sanitizes incoming HTML (value, paste, insertHTML). Leave on.\n\n * `singleline` {`boolean`} - Constrains content to a single paragraph.\n\n * `name` {`string`} - Form field name.\n\n * `required` {`boolean`} - \n\n * `upload-from-computer` {`boolean`} - Shows an \"Upload from computer\" button in the Insert Image dialog. Off by\ndefault (URL-only, like the RTE's default); files can always be added via\ndrag & drop or paste regardless.\n\n * `image-max-file-size` {`number`} - Max upload size (bytes) shown/enforced by the image dialog. Default 2 MB.\n\n * `mentions` - Mention config: trigger character → items, same shape and JSON attribute\nformat as nile-rich-text-editor. For async sources, configure the\ntrigger with an empty array and listen to nile-mention-query.\n\n * `no-slash-commands` {`boolean`} - Disables the \"/\" command menu.\n\n * `no-emoji` {`boolean`} - Disables the \":\" emoji picker.\n\n * `no-table-menu` {`boolean`} - Hides the floating table toolbar; with `email-fidelity` it also hides in layout tables.\n\n * `maxlength` {`number`} - Maximum character count; further input is rejected. 0 = unlimited.\n\n * `show-counter` {`boolean`} - Always show the word/character counter footer (implied by maxlength).\n\n * `sticky-toolbar` {`boolean`} - Keeps the toolbar pinned to the viewport while scrolling long content.\n\n * `snippets` {`SnippetConfig[]`} - Reusable snippets surfaced in the \"/\" menu (JSON attribute).\n\n * `merge-fields` {`MergeFieldConfig[]`} - Merge fields offered in the merge-field picker (JSON attribute).\n\n * `templates` {`TemplateConfig[]`} - Content templates offered in the template picker (JSON attribute).\n\n * `autosave-interval` {`number`} - Emit nile-autosave every N ms while the document has changed. 0 = off.\n\n * `paste-as-plain-text` {`boolean`} - When on, every paste drops formatting and inserts plain text.\n\n * `no-markdown-paste` {`boolean`} - Disables Markdown detection on plain-text pastes.\n\n * `email-fidelity` {`boolean`} - Opt-in mode for table-based email HTML; off by default (output unchanged).\n\n * `allowed-styles` - Extra inline CSS to keep per tag under `email-fidelity`: `{ td: ['letter-spacing'] }` or `\"td: letter-spacing\"`.\n\n * `no-text-transform` {`boolean`} - Disables typography autocorrect (smart quotes, dashes, (c) → ©).\n\n * `fullscreen` {`boolean`} - Expands the editor to fill the viewport. Esc exits.\n\n * `show-blocks` {`boolean`} - Outlines block boundaries (paragraphs, headings, lists…) while editing.\n\n * `no-theme` {`boolean`} - Keeps the editing surface on light-theme colours whatever the page theme\n(e.g. nxtgen dark), so authored content looks the way it will be sent.\nThe toolbar still follows the theme.\n\n * `no-theme-components` {`(\"blockquote\" | \"code\" | \"table\" | \"all\" | \"mentions\" | \"merge-fields\" | \"links\" | \"math\" | \"task-list\" | \"images\")[]`} - Like `noTheme`, but only for the listed content components, which stay on\nlight-theme colours while the rest of the surface follows the page theme.\nValues: `all`, `mentions`, `merge-fields`, `links`, `math`, `code`,\n`blockquote`, `table`, `task-list`, `images`. Unknown names are ignored.\nSet as an array (`['mentions', 'table']`), or as an attribute holding a\ncomma/space-separated list (`\"mentions, table\"`) or a JSON array.\n\nProperties:\n\n * `formAssociated` {`boolean`} - \n\n * `value` {`string`} - Document content as HTML. Not reflected to the attribute.\n\n * `placeholder` {`string`} - \n\n * `disabled` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `toolbar` {`string`} - Toolbar config string; `\"none\"` hides the toolbar.\n\n * `authoredToolbar` {`AuthoredToolbarItem[] | undefined`} - Toolbar built from authored `<nile-wysiwyg-toolbar-item>` light-DOM\nchildren. When present it takes precedence over the `toolbar` string.\n\n * `authoredBubble` {`AuthoredToolbarItem[] | undefined`} - Bubble menu built from authored `<nile-wysiwyg-bubble-item>` light-DOM\nchildren. When present it replaces the built-in bold/italic/underline/\nstrike/link set.\n\n * `toolbarObserver` {`MutationObserver | undefined`} - Watches authored toolbar/bubble children so edits re-render them.\n\n * `bubbleMenu` {`boolean`} - Shows a balloon toolbar over text selections.\n\n * `sanitize` {`boolean`} - Sanitizes incoming HTML (value, paste, insertHTML). Leave on.\n\n * `singleLine` {`boolean`} - Constrains content to a single paragraph.\n\n * `name` {`string`} - Form field name.\n\n * `required` {`boolean`} - \n\n * `uploadHandler` - Async image upload handler. When set, pasted/dropped/picked image files\nare uploaded through it (an \"Uploading…\" placeholder shows meanwhile)\nand the returned src is inserted.\n\n * `allowBase64Images` {`boolean`} - Fallback when no uploadHandler is set and no nile-image-upload-request\nlistener takes over: embed image files as base64 data URLs.\n\n * `uploadFromComputer` {`boolean`} - Shows an \"Upload from computer\" button in the Insert Image dialog. Off by\ndefault (URL-only, like the RTE's default); files can always be added via\ndrag & drop or paste regardless.\n\n * `imageMaxFileSize` {`number`} - Max upload size (bytes) shown/enforced by the image dialog. Default 2 MB.\n\n * `mentions` - Mention config: trigger character → items, same shape and JSON attribute\nformat as nile-rich-text-editor. For async sources, configure the\ntrigger with an empty array and listen to nile-mention-query.\n\n * `noSlashCommands` {`boolean`} - Disables the \"/\" command menu.\n\n * `noEmoji` {`boolean`} - Disables the \":\" emoji picker.\n\n * `noTableMenu` {`boolean`} - Hides the floating table toolbar; with `email-fidelity` it also hides in layout tables.\n\n * `maxLength` {`number`} - Maximum character count; further input is rejected. 0 = unlimited.\n\n * `showCounter` {`boolean`} - Always show the word/character counter footer (implied by maxlength).\n\n * `stickyToolbar` {`boolean`} - Keeps the toolbar pinned to the viewport while scrolling long content.\n\n * `snippets` {`SnippetConfig[]`} - Reusable snippets surfaced in the \"/\" menu (JSON attribute).\n\n * `mergeFields` {`MergeFieldConfig[]`} - Merge fields offered in the merge-field picker (JSON attribute).\n\n * `templates` {`TemplateConfig[]`} - Content templates offered in the template picker (JSON attribute).\n\n * `mathRenderer` - Renders a math node's LaTeX to HTML (KaTeX/MathJax/MathML). When unset,\nthe raw LaTeX is shown. Same trust level as uploadHandler — output is\ninserted as HTML.\n\n * `autosaveInterval` {`number`} - Emit nile-autosave every N ms while the document has changed. 0 = off.\n\n * `pasteAsPlainText` {`boolean`} - When on, every paste drops formatting and inserts plain text.\n\n * `noMarkdownPaste` {`boolean`} - Disables Markdown detection on plain-text pastes.\n\n * `emailFidelity` {`boolean`} - Opt-in mode for table-based email HTML; off by default (output unchanged).\n\n * `allowedStyles` - Extra inline CSS to keep per tag under `email-fidelity`: `{ td: ['letter-spacing'] }` or `\"td: letter-spacing\"`.\n\n * `noTextTransform` {`boolean`} - Disables typography autocorrect (smart quotes, dashes, (c) → ©).\n\n * `fullscreen` {`boolean`} - Expands the editor to fill the viewport. Esc exits.\n\n * `showBlocks` {`boolean`} - Outlines block boundaries (paragraphs, headings, lists…) while editing.\n\n * `noTheme` {`boolean`} - Keeps the editing surface on light-theme colours whatever the page theme\n(e.g. nxtgen dark), so authored content looks the way it will be sent.\nThe toolbar still follows the theme.\n\n * `noThemeComponents` {`(\"blockquote\" | \"code\" | \"table\" | \"all\" | \"mentions\" | \"merge-fields\" | \"links\" | \"math\" | \"task-list\" | \"images\")[]`} - Like `noTheme`, but only for the listed content components, which stay on\nlight-theme colours while the rest of the surface follows the page theme.\nValues: `all`, `mentions`, `merge-fields`, `links`, `math`, `code`,\n`blockquote`, `table`, `task-list`, `images`. Unknown names are ignored.\nSet as an array (`['mentions', 'table']`), or as an attribute holding a\ncomma/space-separated list (`\"mentions, table\"`) or a JSON array.\n\n * `toolbarState` {`ToolbarState | undefined`} - \n\n * `hasFocus` {`boolean`} - \n\n * `sourceMode` {`boolean`} - \n\n * `counter` {`{ words: number; characters: number; }`} - \n\n * `insertMenuMode` {`\"template\" | \"merge\" | null`} - Which list the shared insert-menu is showing, if open.\n\n * `baseEl` {`HTMLElement`} - \n\n * `toolbarEl` {`HTMLElement | undefined`} - \n\n * `surfaceEl` {`HTMLElement`} - \n\n * `linkEditorEl` - \n\n * `bubbleMenuEl` - \n\n * `imagePanelEl` - \n\n * `tableMenuEl` - \n\n * `suggestListEl` - \n\n * `findBarEl` - \n\n * `sourceViewEl` - \n\n * `embedPanelEl` - \n\n * `bookmarkPanelEl` - \n\n * `codeMenuEl` - \n\n * `shortcutHelpEl` - \n\n * `imageMenuEl` - \n\n * `embedMenuEl` - \n\n * `specialCharsEl` - \n\n * `emojiPickerEl` - \n\n * `insertMenuEl` - \n\n * `mathPanelEl` - \n\n * `markdownPanelEl` - \n\n * `view` - \n\n * `normalizedAllowedStyles` {`NormalizedAllowedStyles`} - Validated `allowedStyles`, recomputed once per config change (so the\ndrop warnings fire once, not on every paste).\n\n * `mentionMatch` {`SuggestionMatch | null`} - \n\n * `slashMatch` {`SuggestionMatch | null`} - \n\n * `emojiMatch` {`SuggestionMatch | null`} - \n\n * `activeSuggestSource` {`\"mention\" | \"slash\" | \"emoji\" | null`} - \n\n * `suggestDismissed` {`string | null`} - \n\n * `mentionQueryToken` {`string`} - \n\n * `autosaveTimer` - \n\n * `lastAutosaveValue` {`string`} - \n\n * `internals` - \n\n * `defaultValue` {`string`} - \n\n * `syncingValue` {`boolean`} - \n\n * `lastSourceHtml` {`string`} - Last raw HTML given to setContent; a re-parse reads it while the document is unedited.\n\n * `lastSerializedValue` {`string`} - \n\n * `changeTimer` - \n\n * `pendingChange` {`boolean`} - \n\n * `previousBodyOverflow` {`string | null`} - Body overflow value before fullscreen locked it; null = not locked.\n\n * `onAnyScroll` - \n\n * `renderProbe` {`HTMLElement | null`} - \n\n * `painterDragActive` {`boolean`} - True while a drag-selection is in progress with the format painter armed.\nSuppresses the mid-drag auto-apply in {@link handleTransaction} so the\ncopied formatting lands on the final, complete selection (on mouse-up).\n\n * `onPainterPointerDown` - \n\n * `onPainterPointerUp` - \n\n * `contentRoot` {`HTMLElement | null`} - The live, styled content element used as the source for exports.\n\n * `pmView` - The underlying ProseMirror EditorView. Advanced escape hatch.\n\n * `json` - Document as ProseMirror JSON.\n\n * `override` - \n\n * `floatingPanels` {`({ open: boolean; } | undefined)[]`} - The floating insert panels that should dismiss on outside interaction.\n\n * `onOutsidePointerDown` - Closes any open insert panel when the pointer goes down outside of it —\nwhether elsewhere in the editor (e.g. the content area) or off the widget.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
|
9029
9041
|
"attributes": [
|
|
9030
9042
|
{
|
|
9031
9043
|
"name": "value",
|
|
@@ -9165,6 +9177,15 @@
|
|
|
9165
9177
|
"description": "`show-blocks` {`boolean`} - Outlines block boundaries (paragraphs, headings, lists…) while editing.\n\nProperty: showBlocks\n\nDefault: false",
|
|
9166
9178
|
"valueSet": "v"
|
|
9167
9179
|
},
|
|
9180
|
+
{
|
|
9181
|
+
"name": "no-theme",
|
|
9182
|
+
"description": "`no-theme` {`boolean`} - Keeps the editing surface on light-theme colours whatever the page theme\n(e.g. nxtgen dark), so authored content looks the way it will be sent.\nThe toolbar still follows the theme.\n\nProperty: noTheme\n\nDefault: false",
|
|
9183
|
+
"valueSet": "v"
|
|
9184
|
+
},
|
|
9185
|
+
{
|
|
9186
|
+
"name": "no-theme-components",
|
|
9187
|
+
"description": "`no-theme-components` {`(\"blockquote\" | \"code\" | \"table\" | \"all\" | \"mentions\" | \"merge-fields\" | \"links\" | \"math\" | \"task-list\" | \"images\")[]`} - Like `noTheme`, but only for the listed content components, which stay on\nlight-theme colours while the rest of the surface follows the page theme.\nValues: `all`, `mentions`, `merge-fields`, `links`, `math`, `code`,\n`blockquote`, `table`, `task-list`, `images`. Unknown names are ignored.\nSet as an array (`['mentions', 'table']`), or as an attribute holding a\ncomma/space-separated list (`\"mentions, table\"`) or a JSON array.\n\nProperty: noThemeComponents\n\nDefault: "
|
|
9188
|
+
},
|
|
9168
9189
|
{
|
|
9169
9190
|
"name": "onnile-change",
|
|
9170
9191
|
"description": "`nile-change` {} - Debounced content change. detail: { value, json, content }"
|