@4sh/ui-kit 0.16.0 → 0.17.1
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.fr.md +10 -10
- package/README.md +10 -10
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
- package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
- package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
- package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
- package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
- package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
- package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -1000
- package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
- package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2048
- package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
- package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
- package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
- package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
- package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -138
- package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -257
- package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -312
- package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
- package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -199
- package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
- package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
- package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
- package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
- package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
- package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
- package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
- package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
- package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
- package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -137
- package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
- package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
- package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms.mjs +721 -638
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
- package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
- package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
- package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
- package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
- package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
- package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
- package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
- package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
- package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
- package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
- package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
- package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
- package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
- package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
- package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
- package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
- package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
- package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
- package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
- package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
- package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
- package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
- package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
- package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
- package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
- package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
- package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
- package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
- package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
- package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
- package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
- package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
- package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-types.mjs +0 -12
- package/fesm2022/4sh-ui-kit.mjs +3 -15
- package/fesm2022/4sh-ui-kit.mjs.map +1 -1
- package/mcp/data/component-api.json +299 -2
- package/mcp/data/text-search-docs.json +149 -9
- package/mcp/data/ui-config.json +378 -1
- package/mcp/index.js +8190 -2876
- package/mcp/package.json +1 -1
- package/package.json +5 -1
- package/styles/component-vars.scss +22 -1
- package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
- package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
- package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
- package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
- package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
- package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
- package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +573 -376
- package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
- package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
- package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
- package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
- package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
- package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
- package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
- package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
- package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -59
- package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -96
- package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -104
- package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
- package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -118
- package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
- package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
- package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
- package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
- package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
- package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
- package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
- package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
- package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
- package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -56
- package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
- package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
- package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
- package/types/4sh-ui-kit-forms.d.ts +275 -194
- package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
- package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
- package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
- package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
- package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
- package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
- package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
- package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
- package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
- package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
- package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
- package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
- package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
- package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
- package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
- package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
- package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
- package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
- package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
- package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
- package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
- package/types/4sh-ui-kit-motion.d.ts +117 -67
- package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
- package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
- package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
- package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
- package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
- package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
- package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
- package/types/4sh-ui-kit-overlay.d.ts +6 -6
- package/types/4sh-ui-kit-ripple.d.ts +99 -74
- package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
- package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
- package/types/4sh-ui-kit-theming.d.ts +27 -29
- package/types/4sh-ui-kit-types.d.ts +6 -5
- package/types/4sh-ui-kit.d.ts +4 -3
- package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
|
@@ -1,1210 +1,1155 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { NgTemplateOutlet } from
|
|
4
|
-
import * as i1 from
|
|
5
|
-
import { FormsModule, NG_VALUE_ACCESSOR } from
|
|
6
|
-
import { DomSanitizer } from
|
|
7
|
-
import { BaseFormField } from
|
|
8
|
-
import { UiField } from
|
|
9
|
-
import { UiButton } from
|
|
10
|
-
import { UiSelect } from
|
|
11
|
-
import { DEFAULT_SWATCH_PALETTE, UiSwatchPicker } from
|
|
12
|
-
|
|
13
|
-
const EDITOR_SELECT_TOOLS = [
|
|
14
|
-
'fontFamily',
|
|
15
|
-
'fontSize',
|
|
16
|
-
];
|
|
17
|
-
/**
|
|
18
|
-
* Font key → class written into the value, token holding the family, and the
|
|
19
|
-
* fallback label used when the real name cannot be read (SSR, unset token).
|
|
20
|
-
*
|
|
21
|
-
* The dropdown shows the **actual** face name, resolved from the token at runtime
|
|
22
|
-
* (see {@link resolveFontLabel}) rather than hardcoded: a project that rebinds
|
|
23
|
-
* `--fontfamily-base` would otherwise see a menu naming a font it no longer uses.
|
|
24
|
-
*/
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, SecurityContext, afterNextRender, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import * as i1 from "@angular/forms";
|
|
5
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
6
|
+
import { DomSanitizer } from "@angular/platform-browser";
|
|
7
|
+
import { BaseFormField } from "@4sh/ui-kit/forms";
|
|
8
|
+
import { UiField } from "@4sh/ui-kit/forms/ui-field";
|
|
9
|
+
import { UiButton } from "@4sh/ui-kit/actions/ui-button";
|
|
10
|
+
import { UiSelect } from "@4sh/ui-kit/forms/ui-select";
|
|
11
|
+
import { DEFAULT_SWATCH_PALETTE, UiSwatchPicker } from "@4sh/ui-kit/forms/ui-swatch-picker";
|
|
12
|
+
const EDITOR_SELECT_TOOLS = ["fontFamily", "fontSize"];
|
|
25
13
|
const EDITOR_FONTS = [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
{
|
|
15
|
+
key: "base",
|
|
16
|
+
className: "ui-editor-font-base",
|
|
17
|
+
cssVar: "--fontfamily-base",
|
|
18
|
+
label: "Standard"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "title",
|
|
22
|
+
className: "ui-editor-font-title",
|
|
23
|
+
cssVar: "--fontfamily-title",
|
|
24
|
+
label: "Titre"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "monospace",
|
|
28
|
+
className: "ui-editor-font-monospace",
|
|
29
|
+
cssVar: "--fontfamily-monospace",
|
|
30
|
+
label: "Monospace"
|
|
31
|
+
}
|
|
39
32
|
];
|
|
40
|
-
/**
|
|
41
|
-
* First face named by a font token — what the family dropdown displays.
|
|
42
|
-
*
|
|
43
|
-
* `--fontfamily-base` holds a whole stack (`Inter, system-ui, …`); only the head
|
|
44
|
-
* of it is a name a person recognises.
|
|
45
|
-
*/
|
|
46
33
|
function resolveFontLabel(cssVar, fallback) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const raw = getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim();
|
|
50
|
-
const first = raw
|
|
51
|
-
.split(',')[0]
|
|
52
|
-
?.trim()
|
|
53
|
-
.replace(/^["']|["']$/g, '');
|
|
54
|
-
return first || fallback;
|
|
34
|
+
if (typeof document === "undefined") return fallback;
|
|
35
|
+
return getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim().split(",")[0]?.trim().replace(/^["']|["']$/g, "") || fallback;
|
|
55
36
|
}
|
|
56
|
-
/** Size key → class written into the value + French label for the dropdown. */
|
|
57
37
|
const EDITOR_SIZES = [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
38
|
+
{
|
|
39
|
+
key: "sm",
|
|
40
|
+
className: "ui-editor-size-sm",
|
|
41
|
+
label: "Petit"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "default",
|
|
45
|
+
className: "ui-editor-size-default",
|
|
46
|
+
label: "Normal"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "lg",
|
|
50
|
+
className: "ui-editor-size-lg",
|
|
51
|
+
label: "Grand"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: "xl",
|
|
55
|
+
className: "ui-editor-size-xl",
|
|
56
|
+
label: "Très grand"
|
|
57
|
+
}
|
|
62
58
|
];
|
|
63
59
|
const SIZE_CLASSES = new Set(EDITOR_SIZES.map((s) => s.className));
|
|
64
60
|
const FONT_CLASSES = new Set(EDITOR_FONTS.map((f) => f.className));
|
|
65
|
-
/**
|
|
66
|
-
* The tools enabled when the consumer does not provide a `tools` list.
|
|
67
|
-
*
|
|
68
|
-
* There is no block-level dropdown (no `blockFormat`, no headings): the editor
|
|
69
|
-
* only ever produces `<p>`. `fontFamily`/`fontSize` are both first-class,
|
|
70
|
-
* always-on tools rather than one gated behind the other.
|
|
71
|
-
*
|
|
72
|
-
* `clearFormat` is deliberately absent for now: `clearFormatMarkers()` does not
|
|
73
|
-
* reliably clear every marker class yet. It stays available for a project that
|
|
74
|
-
* explicitly adds it to `tools`, but shipping it by default would be shipping
|
|
75
|
-
* a broken button.
|
|
76
|
-
*/
|
|
77
61
|
const DEFAULT_EDITOR_TOOLS = [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
"fontFamily",
|
|
63
|
+
"fontSize",
|
|
64
|
+
"separator",
|
|
65
|
+
"bold",
|
|
66
|
+
"italic",
|
|
67
|
+
"underline",
|
|
68
|
+
"separator",
|
|
69
|
+
"bulletList",
|
|
70
|
+
"orderedList",
|
|
71
|
+
"separator",
|
|
72
|
+
"alignLeft",
|
|
73
|
+
"alignCenter",
|
|
74
|
+
"alignRight",
|
|
75
|
+
"alignJustify",
|
|
76
|
+
"separator",
|
|
77
|
+
"link",
|
|
78
|
+
"codeBlock"
|
|
95
79
|
];
|
|
96
|
-
/** Toolbar metadata per button tool: icon (FontAwesome) + French accessible name. */
|
|
97
80
|
const EDITOR_TOOL_META = {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
81
|
+
bold: {
|
|
82
|
+
icon: "bold",
|
|
83
|
+
label: "Gras"
|
|
84
|
+
},
|
|
85
|
+
italic: {
|
|
86
|
+
icon: "italic",
|
|
87
|
+
label: "Italique"
|
|
88
|
+
},
|
|
89
|
+
underline: {
|
|
90
|
+
icon: "underline",
|
|
91
|
+
label: "Souligné"
|
|
92
|
+
},
|
|
93
|
+
bulletList: {
|
|
94
|
+
icon: "list-ul",
|
|
95
|
+
label: "Liste à puces"
|
|
96
|
+
},
|
|
97
|
+
orderedList: {
|
|
98
|
+
icon: "list-ol",
|
|
99
|
+
label: "Liste numérotée"
|
|
100
|
+
},
|
|
101
|
+
codeBlock: {
|
|
102
|
+
icon: "code",
|
|
103
|
+
label: "Bloc de code"
|
|
104
|
+
},
|
|
105
|
+
indent: {
|
|
106
|
+
icon: "indent",
|
|
107
|
+
label: "Augmenter le retrait"
|
|
108
|
+
},
|
|
109
|
+
outdent: {
|
|
110
|
+
icon: "outdent",
|
|
111
|
+
label: "Diminuer le retrait"
|
|
112
|
+
},
|
|
113
|
+
alignLeft: {
|
|
114
|
+
icon: "align-left",
|
|
115
|
+
label: "Aligner à gauche"
|
|
116
|
+
},
|
|
117
|
+
alignCenter: {
|
|
118
|
+
icon: "align-center",
|
|
119
|
+
label: "Centrer"
|
|
120
|
+
},
|
|
121
|
+
alignRight: {
|
|
122
|
+
icon: "align-right",
|
|
123
|
+
label: "Aligner à droite"
|
|
124
|
+
},
|
|
125
|
+
alignJustify: {
|
|
126
|
+
icon: "align-justify",
|
|
127
|
+
label: "Justifier"
|
|
128
|
+
},
|
|
129
|
+
textColor: {
|
|
130
|
+
icon: "font",
|
|
131
|
+
label: "Couleur du texte"
|
|
132
|
+
},
|
|
133
|
+
highlightColor: {
|
|
134
|
+
icon: "highlighter",
|
|
135
|
+
label: "Couleur de surlignage"
|
|
136
|
+
},
|
|
137
|
+
link: {
|
|
138
|
+
icon: "link",
|
|
139
|
+
label: "Lien"
|
|
140
|
+
},
|
|
141
|
+
clearFormat: {
|
|
142
|
+
icon: "text-slash",
|
|
143
|
+
label: "Effacer le formatage"
|
|
144
|
+
}
|
|
114
145
|
};
|
|
115
|
-
/** Tool → legacy command name. */
|
|
116
146
|
const NATIVE_COMMAND = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
147
|
+
bold: "bold",
|
|
148
|
+
italic: "italic",
|
|
149
|
+
underline: "underline",
|
|
150
|
+
bulletList: "insertUnorderedList",
|
|
151
|
+
orderedList: "insertOrderedList",
|
|
152
|
+
indent: "indent",
|
|
153
|
+
outdent: "outdent",
|
|
154
|
+
alignLeft: "justifyLeft",
|
|
155
|
+
alignCenter: "justifyCenter",
|
|
156
|
+
alignRight: "justifyRight",
|
|
157
|
+
alignJustify: "justifyFull",
|
|
158
|
+
clearFormat: "removeFormat"
|
|
129
159
|
};
|
|
130
160
|
const TOGGLE_TOOLS = [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
161
|
+
"bold",
|
|
162
|
+
"italic",
|
|
163
|
+
"underline",
|
|
164
|
+
"bulletList",
|
|
165
|
+
"orderedList",
|
|
166
|
+
"alignLeft",
|
|
167
|
+
"alignCenter",
|
|
168
|
+
"alignRight",
|
|
169
|
+
"alignJustify"
|
|
140
170
|
];
|
|
141
|
-
/** Every state off — the value used before the first render and on SSR. */
|
|
142
171
|
function emptyEditorState() {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
172
|
+
return {
|
|
173
|
+
bold: false,
|
|
174
|
+
italic: false,
|
|
175
|
+
underline: false,
|
|
176
|
+
bulletList: false,
|
|
177
|
+
orderedList: false,
|
|
178
|
+
codeBlock: false,
|
|
179
|
+
alignLeft: false,
|
|
180
|
+
alignCenter: false,
|
|
181
|
+
alignRight: false,
|
|
182
|
+
alignJustify: false
|
|
183
|
+
};
|
|
155
184
|
}
|
|
156
|
-
/** Applies a formatting command to the current selection. */
|
|
157
185
|
function applyCommand(tool) {
|
|
158
|
-
|
|
186
|
+
document.execCommand(NATIVE_COMMAND[tool], false);
|
|
159
187
|
}
|
|
160
|
-
// --- Code block ---------------------------------------------------------
|
|
161
|
-
/** Toggles the block under the caret between `<pre>` and a plain paragraph. */
|
|
162
188
|
function toggleCodeBlock() {
|
|
163
|
-
|
|
189
|
+
document.execCommand("formatBlock", false, isInCodeBlock() ? "p" : "pre");
|
|
164
190
|
}
|
|
165
|
-
/** The caret sits in a code block. */
|
|
166
191
|
function isInCodeBlock() {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
192
|
+
try {
|
|
193
|
+
return (document.queryCommandValue("formatBlock") || "").toLowerCase() === "pre";
|
|
194
|
+
} catch {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
173
197
|
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Marker handed to `fontName`, immediately rewritten into a class.
|
|
177
|
-
*
|
|
178
|
-
* `fontName` is the only command that can apply a family to an arbitrary
|
|
179
|
-
* selection, but it emits `<font face="…">` — an obsolete tag carrying a raw
|
|
180
|
-
* family name. We let it run, then convert its output so the value only ever
|
|
181
|
-
* holds a class bound to a `--fontfamily-*` token.
|
|
182
|
-
*/
|
|
183
|
-
const FONT_MARKER = '__ui-editor-font__';
|
|
184
|
-
/** Applies a type family to the selection (see {@link convertFontMarkers}). */
|
|
198
|
+
const FONT_MARKER = "__ui-editor-font__";
|
|
185
199
|
function applyFontFamily() {
|
|
186
|
-
|
|
200
|
+
document.execCommand("fontName", false, FONT_MARKER);
|
|
187
201
|
}
|
|
188
|
-
/** Rewrites the `<font>` elements `fontName` just produced into `<span class>`. */
|
|
189
202
|
function convertFontMarkers(root, className) {
|
|
190
|
-
|
|
203
|
+
convertMarkers(root, `font[face="${FONT_MARKER}"]`, className, FONT_CLASSES);
|
|
191
204
|
}
|
|
192
|
-
/** @internal Replaces the matched legacy `<font>` elements with a classed span. */
|
|
193
205
|
function convertMarkers(root, selector, className, family) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const live = spans.filter((span) => span.isConnected);
|
|
218
|
-
const selection = document.getSelection();
|
|
219
|
-
if (!live.length || !selection)
|
|
220
|
-
return;
|
|
221
|
-
const last = live[live.length - 1];
|
|
222
|
-
const range = document.createRange();
|
|
223
|
-
range.setStart(live[0], 0);
|
|
224
|
-
range.setEnd(last, last.childNodes.length);
|
|
225
|
-
selection.removeAllRanges();
|
|
226
|
-
selection.addRange(range);
|
|
206
|
+
const spans = [];
|
|
207
|
+
for (const el of Array.from(root.querySelectorAll(selector))) {
|
|
208
|
+
const span = document.createElement("span");
|
|
209
|
+
span.className = className;
|
|
210
|
+
span.append(...Array.from(el.childNodes));
|
|
211
|
+
el.replaceWith(span);
|
|
212
|
+
spans.push(span);
|
|
213
|
+
}
|
|
214
|
+
for (const span of spans) for (const inner of Array.from(span.querySelectorAll("[class]"))) {
|
|
215
|
+
for (const cls of Array.from(inner.classList)) if (family.has(cls)) inner.classList.remove(cls);
|
|
216
|
+
if (inner.classList.length > 0) continue;
|
|
217
|
+
inner.removeAttribute("class");
|
|
218
|
+
if (inner.tagName === "SPAN" && inner.attributes.length === 0) inner.replaceWith(...Array.from(inner.childNodes));
|
|
219
|
+
}
|
|
220
|
+
const live = spans.filter((span) => span.isConnected);
|
|
221
|
+
const selection = document.getSelection();
|
|
222
|
+
if (!live.length || !selection) return;
|
|
223
|
+
const last = live[live.length - 1];
|
|
224
|
+
const range = document.createRange();
|
|
225
|
+
range.setStart(live[0], 0);
|
|
226
|
+
range.setEnd(last, last.childNodes.length);
|
|
227
|
+
selection.removeAllRanges();
|
|
228
|
+
selection.addRange(range);
|
|
227
229
|
}
|
|
228
|
-
/**
|
|
229
|
-
* Type family in force at the caret.
|
|
230
|
-
*
|
|
231
|
-
* Falls back to the family the text is actually rendered with when no class was
|
|
232
|
-
* applied: a heading carries `--fontfamily-title` from its own styling, and
|
|
233
|
-
* reporting the base family there would name a font the reader does not see.
|
|
234
|
-
* `null` only when the computed face matches none of the system families.
|
|
235
|
-
*/
|
|
236
230
|
function readFontFamily(node) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const rendered = firstFace(getComputedStyle(el).fontFamily);
|
|
244
|
-
return (EDITOR_FONTS.find((f) => firstFace(resolveFontLabel(f.cssVar, '')) === rendered)?.key ?? null);
|
|
231
|
+
const tagged = findClassKey(node, EDITOR_FONTS);
|
|
232
|
+
if (tagged) return tagged;
|
|
233
|
+
const el = node?.nodeType === Node.ELEMENT_NODE ? node : node?.parentElement ?? null;
|
|
234
|
+
if (!el || typeof getComputedStyle !== "function") return null;
|
|
235
|
+
const rendered = firstFace(getComputedStyle(el).fontFamily);
|
|
236
|
+
return EDITOR_FONTS.find((f) => firstFace(resolveFontLabel(f.cssVar, "")) === rendered)?.key ?? null;
|
|
245
237
|
}
|
|
246
|
-
/** @internal Head of a font stack, unquoted and lowercased for comparison. */
|
|
247
238
|
function firstFace(stack) {
|
|
248
|
-
|
|
249
|
-
.trim()
|
|
250
|
-
.replace(/^["']|["']$/g, '')
|
|
251
|
-
.toLowerCase();
|
|
239
|
+
return (stack.split(",")[0] ?? "").trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
252
240
|
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Marker handed to `fontSize`, immediately rewritten into a class.
|
|
256
|
-
*
|
|
257
|
-
* Same trick as the family: `fontSize` is the only command that can size an
|
|
258
|
-
* arbitrary selection, but it emits `<font size="7">` — a legacy 1-7 scale with
|
|
259
|
-
* no relation to the typography tokens.
|
|
260
|
-
*/
|
|
261
|
-
const SIZE_MARKER = '7';
|
|
262
|
-
/** Applies a text size to the selection (see {@link convertSizeMarkers}). */
|
|
241
|
+
const SIZE_MARKER = "7";
|
|
263
242
|
function applyFontSize() {
|
|
264
|
-
|
|
243
|
+
document.execCommand("fontSize", false, SIZE_MARKER);
|
|
265
244
|
}
|
|
266
|
-
/** Rewrites the `<font>` elements `fontSize` just produced into `<span class>`. */
|
|
267
245
|
function convertSizeMarkers(root, className) {
|
|
268
|
-
|
|
246
|
+
convertMarkers(root, `font[size="${SIZE_MARKER}"]`, className, SIZE_CLASSES);
|
|
269
247
|
}
|
|
270
|
-
/** Text size active at the caret, or `null` when the text uses the default. */
|
|
271
248
|
function readFontSize(node) {
|
|
272
|
-
|
|
249
|
+
return findClassKey(node, EDITOR_SIZES);
|
|
273
250
|
}
|
|
274
|
-
// --- Text color / highlight color ---------------------------------------
|
|
275
|
-
/**
|
|
276
|
-
* Color key → class written into the value, token holding the swatch, and
|
|
277
|
-
* label, derived from `ui-swatch-picker`'s default palette rather than
|
|
278
|
-
* hand-duplicated: the editor's color tools and the nuancier it opens must
|
|
279
|
-
* always offer the same token set.
|
|
280
|
-
*/
|
|
281
251
|
const EDITOR_COLORS = DEFAULT_SWATCH_PALETTE.flatMap((group) => group.swatches.map((swatch) => ({
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
252
|
+
key: swatch.key,
|
|
253
|
+
className: `ui-editor-color-${swatch.key}`,
|
|
254
|
+
cssVar: swatch.cssVar,
|
|
255
|
+
label: swatch.label
|
|
286
256
|
})));
|
|
287
|
-
/** Same key set as {@link EDITOR_COLORS}, classed separately for the highlight tool. */
|
|
288
257
|
const EDITOR_HIGHLIGHTS = DEFAULT_SWATCH_PALETTE.flatMap((group) => group.swatches.map((swatch) => ({
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
258
|
+
key: swatch.key,
|
|
259
|
+
className: `ui-editor-highlight-${swatch.key}`,
|
|
260
|
+
cssVar: swatch.cssVar,
|
|
261
|
+
label: swatch.label
|
|
293
262
|
})));
|
|
294
263
|
const COLOR_CLASSES = new Set(EDITOR_COLORS.map((c) => c.className));
|
|
295
264
|
const HIGHLIGHT_CLASSES = new Set(EDITOR_HIGHLIGHTS.map((c) => c.className));
|
|
296
|
-
|
|
297
|
-
* Marker handed to `foreColor`, immediately rewritten into a class.
|
|
298
|
-
*
|
|
299
|
-
* `foreColor` is the only command that can color an arbitrary selection, but
|
|
300
|
-
* it emits `<font color="…">` — same trick as the family/size markers. Must
|
|
301
|
-
* be a value the browser accepts as a real color (unlike `fontName`'s marker,
|
|
302
|
-
* which is free text): an unparseable string is silently dropped instead of
|
|
303
|
-
* being written to the `color` attribute. A hex triplet unlikely to collide
|
|
304
|
-
* with a real token value is used, and Chromium/Firefox both echo it back
|
|
305
|
-
* verbatim on the `<font color>` attribute (verified empirically).
|
|
306
|
-
*/
|
|
307
|
-
const COLOR_MARKER = '#010203';
|
|
308
|
-
/** Applies a text color to the selection (see {@link convertColorMarkers}). */
|
|
265
|
+
const COLOR_MARKER = "#010203";
|
|
309
266
|
function applyTextColor() {
|
|
310
|
-
|
|
267
|
+
document.execCommand("foreColor", false, COLOR_MARKER);
|
|
311
268
|
}
|
|
312
|
-
/** Rewrites the `<font>` elements `foreColor` just produced into `<span class>`. */
|
|
313
269
|
function convertColorMarkers(root, className) {
|
|
314
|
-
|
|
270
|
+
convertMarkers(root, `font[color="${COLOR_MARKER}"]`, className, COLOR_CLASSES);
|
|
315
271
|
}
|
|
316
|
-
/** Text color active at the caret, or `null` when the text uses the default. */
|
|
317
272
|
function readTextColor(node) {
|
|
318
|
-
|
|
273
|
+
return findClassKey(node, EDITOR_COLORS);
|
|
319
274
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
*
|
|
323
|
-
* Unlike `fontName`/`fontSize`/`foreColor`, `hiliteColor` does **not** emit a
|
|
324
|
-
* `<font>` element: verified empirically (Playwright, Chromium + Firefox)
|
|
325
|
-
* that it always produces `<span style="background-color: rgb(r, g, b);">`,
|
|
326
|
-
* converting whatever color is handed to it — including a hex marker — to an
|
|
327
|
-
* `rgb(...)` triplet in the `style` attribute. `HILITE_MARKER` is therefore
|
|
328
|
-
* kept as the hex value passed to the command, and `HILITE_MARKER_RGB` as the
|
|
329
|
-
* exact `rgb(...)` string both browsers echo back for it, used to build the
|
|
330
|
-
* `[style*="…"]` selector `convertHighlightMarkers` matches on.
|
|
331
|
-
*/
|
|
332
|
-
const HILITE_MARKER = '#040506';
|
|
333
|
-
/** @internal `rgb(...)` form both Chromium and Firefox normalize `HILITE_MARKER` to. */
|
|
334
|
-
const HILITE_MARKER_RGB = 'rgb(4, 5, 6)';
|
|
335
|
-
/** Applies a highlight color to the selection (see {@link convertHighlightMarkers}). */
|
|
275
|
+
const HILITE_MARKER = "#040506";
|
|
276
|
+
const HILITE_MARKER_RGB = "rgb(4, 5, 6)";
|
|
336
277
|
function applyHighlightColor() {
|
|
337
|
-
|
|
278
|
+
document.execCommand("hiliteColor", false, HILITE_MARKER);
|
|
338
279
|
}
|
|
339
|
-
/** Rewrites the `<span style>` elements `hiliteColor` just produced into `<span class>`. */
|
|
340
280
|
function convertHighlightMarkers(root, className) {
|
|
341
|
-
|
|
281
|
+
convertMarkers(root, `[style*="background-color: ${HILITE_MARKER_RGB}"]`, className, HIGHLIGHT_CLASSES);
|
|
342
282
|
}
|
|
343
|
-
/** Highlight color active at the caret, or `null` when the text carries none. */
|
|
344
283
|
function readHighlightColor(node) {
|
|
345
|
-
|
|
284
|
+
return findClassKey(node, EDITOR_HIGHLIGHTS);
|
|
346
285
|
}
|
|
347
|
-
/**
|
|
348
|
-
* Strips a color/highlight class from every element carrying it inside
|
|
349
|
-
* `range`, unwrapping the element when nothing else justifies it (a plain
|
|
350
|
-
* `<span>` holding only that class).
|
|
351
|
-
*
|
|
352
|
-
* Used by the pickers' "no color" swatch: `foreColor`/`hiliteColor` can only
|
|
353
|
-
* set a color, there is no native command to remove one, so this undoes what
|
|
354
|
-
* {@link convertColorMarkers}/{@link convertHighlightMarkers} previously wrote.
|
|
355
|
-
*/
|
|
356
286
|
function clearMarkerClass(root, range, className) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (el.tagName === 'SPAN' && el.attributes.length === 0) {
|
|
365
|
-
el.replaceWith(...Array.from(el.childNodes));
|
|
366
|
-
}
|
|
367
|
-
}
|
|
287
|
+
for (const el of Array.from(root.querySelectorAll(`.${className}`))) {
|
|
288
|
+
if (!range.intersectsNode(el)) continue;
|
|
289
|
+
el.classList.remove(className);
|
|
290
|
+
if (el.classList.length > 0) continue;
|
|
291
|
+
el.removeAttribute("class");
|
|
292
|
+
if (el.tagName === "SPAN" && el.attributes.length === 0) el.replaceWith(...Array.from(el.childNodes));
|
|
293
|
+
}
|
|
368
294
|
}
|
|
369
|
-
/**
|
|
370
|
-
* Strips every font/size/color/highlight class the editor writes, from
|
|
371
|
-
* whatever intersects `range`.
|
|
372
|
-
*
|
|
373
|
-
* `removeFormat` (the `clearFormat` tool's native command) only knows inline
|
|
374
|
-
* formatting the browser itself applies (bold, italic, underline…) — it never
|
|
375
|
-
* touches the `<span class="ui-editor-*">` wrappers `fontFamily`/`fontSize`/
|
|
376
|
-
* `textColor`/`highlightColor` write, so "Clear formatting" needs this on top
|
|
377
|
-
* of it to actually clear everything.
|
|
378
|
-
*/
|
|
379
295
|
function clearFormatMarkers(root, range) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
296
|
+
for (const className of [
|
|
297
|
+
...FONT_CLASSES,
|
|
298
|
+
...SIZE_CLASSES,
|
|
299
|
+
...COLOR_CLASSES,
|
|
300
|
+
...HIGHLIGHT_CLASSES
|
|
301
|
+
]) clearMarkerClass(root, range, className);
|
|
383
302
|
}
|
|
384
|
-
/** @internal Nearest ancestor carrying one of the given classes. */
|
|
385
303
|
function findClassKey(node, table) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return null;
|
|
304
|
+
let el = node?.nodeType === Node.ELEMENT_NODE ? node : node?.parentElement ?? null;
|
|
305
|
+
while (el) {
|
|
306
|
+
const match = table.find((entry) => el.classList?.contains(entry.className));
|
|
307
|
+
if (match) return match.key;
|
|
308
|
+
el = el.parentElement;
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
394
311
|
}
|
|
395
|
-
/** Wraps the current selection in a link (`removeFormat` alone cannot unlink). */
|
|
396
312
|
function applyLink(href) {
|
|
397
|
-
|
|
313
|
+
document.execCommand("createLink", false, href);
|
|
398
314
|
}
|
|
399
|
-
/** Removes the link around the caret. */
|
|
400
315
|
function removeLink() {
|
|
401
|
-
|
|
316
|
+
document.execCommand("unlink", false);
|
|
402
317
|
}
|
|
403
|
-
/** Reads the formatting active at the caret. */
|
|
404
318
|
function readEditorState() {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
state.codeBlock = isInCodeBlock();
|
|
416
|
-
return state;
|
|
319
|
+
const state = emptyEditorState();
|
|
320
|
+
for (const tool of TOGGLE_TOOLS) try {
|
|
321
|
+
state[tool] = document.queryCommandState(NATIVE_COMMAND[tool]);
|
|
322
|
+
} catch {
|
|
323
|
+
state[tool] = false;
|
|
324
|
+
}
|
|
325
|
+
state.codeBlock = isInCodeBlock();
|
|
326
|
+
return state;
|
|
417
327
|
}
|
|
418
|
-
/** Inserts already-sanitised markup at the caret, replacing the selection. */
|
|
419
328
|
function insertHtml(html) {
|
|
420
|
-
|
|
329
|
+
document.execCommand("insertHTML", false, html);
|
|
421
330
|
}
|
|
422
|
-
/** Inserts plain text at the caret, replacing the selection. */
|
|
423
331
|
function insertText(text) {
|
|
424
|
-
|
|
332
|
+
document.execCommand("insertText", false, text);
|
|
425
333
|
}
|
|
426
|
-
|
|
427
|
-
const LENGTH = String.raw `(?:0|-?\d+(?:\.\d+)?(?:px|em|rem|%))`;
|
|
334
|
+
const LENGTH = String.raw`(?:0|-?\d+(?:\.\d+)?(?:px|em|rem|%))`;
|
|
428
335
|
const LENGTHS = new RegExp(`^${LENGTH}(?:\\s+${LENGTH}){0,3}$`);
|
|
429
|
-
/** The only `style` a value keeps: alignment and indentation. Same list as the React kit. */
|
|
430
336
|
const STYLE_ALLOWLIST = {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
337
|
+
"text-align": /^(?:left|right|center|justify|start|end)$/,
|
|
338
|
+
margin: LENGTHS,
|
|
339
|
+
"margin-left": LENGTHS,
|
|
340
|
+
"margin-right": LENGTHS,
|
|
341
|
+
"margin-inline-start": LENGTHS,
|
|
342
|
+
padding: LENGTHS,
|
|
343
|
+
border: /^none$/
|
|
438
344
|
};
|
|
439
|
-
/** Keeps only the allowed declarations of a `style` attribute. */
|
|
440
345
|
function sanitizeStyle(style) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
kept.push(`${property}: ${value};`);
|
|
451
|
-
}
|
|
452
|
-
return kept.join(' ');
|
|
346
|
+
const kept = [];
|
|
347
|
+
for (const declaration of style.split(";")) {
|
|
348
|
+
const colon = declaration.indexOf(":");
|
|
349
|
+
if (colon < 0) continue;
|
|
350
|
+
const property = declaration.slice(0, colon).trim().toLowerCase();
|
|
351
|
+
const value = declaration.slice(colon + 1).trim().toLowerCase();
|
|
352
|
+
if (STYLE_ALLOWLIST[property]?.test(value)) kept.push(`${property}: ${value};`);
|
|
353
|
+
}
|
|
354
|
+
return kept.join(" ");
|
|
453
355
|
}
|
|
454
|
-
const STYLE_RELAY =
|
|
455
|
-
/** Sanitises a value with `sanitize`, relaying the allowed `style` through a class it keeps. */
|
|
356
|
+
const STYLE_RELAY = "ui-editor-style-";
|
|
456
357
|
function sanitizeEditorHtml(html, sanitize) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
const kept = styles[Number(cls.slice(STYLE_RELAY.length))];
|
|
488
|
-
if (kept)
|
|
489
|
-
el.setAttribute('style', kept);
|
|
490
|
-
}
|
|
491
|
-
if (!el.classList.length)
|
|
492
|
-
el.removeAttribute('class');
|
|
493
|
-
}
|
|
494
|
-
return out.innerHTML;
|
|
358
|
+
if (typeof DOMParser === "undefined" || !/\sstyle\s*=/i.test(html)) return sanitize(html);
|
|
359
|
+
const styles = [];
|
|
360
|
+
const source = parseInert(html);
|
|
361
|
+
for (const el of Array.from(source.querySelectorAll("*"))) {
|
|
362
|
+
const forged = Array.from(el.classList).filter((cls) => cls.startsWith(STYLE_RELAY));
|
|
363
|
+
if (forged.length) {
|
|
364
|
+
el.classList.remove(...forged);
|
|
365
|
+
if (!el.classList.length) el.removeAttribute("class");
|
|
366
|
+
}
|
|
367
|
+
const style = el.getAttribute("style");
|
|
368
|
+
if (style === null) continue;
|
|
369
|
+
el.removeAttribute("style");
|
|
370
|
+
const kept = sanitizeStyle(style);
|
|
371
|
+
if (!kept) continue;
|
|
372
|
+
el.classList.add(`${STYLE_RELAY}${styles.length}`);
|
|
373
|
+
styles.push(kept);
|
|
374
|
+
}
|
|
375
|
+
const safe = sanitize(source.innerHTML);
|
|
376
|
+
if (!styles.length) return safe;
|
|
377
|
+
const out = parseInert(safe);
|
|
378
|
+
for (const el of Array.from(out.querySelectorAll(`[class*="${STYLE_RELAY}"]`))) {
|
|
379
|
+
for (const cls of Array.from(el.classList)) {
|
|
380
|
+
if (!cls.startsWith(STYLE_RELAY)) continue;
|
|
381
|
+
el.classList.remove(cls);
|
|
382
|
+
const kept = styles[Number(cls.slice(16))];
|
|
383
|
+
if (kept) el.setAttribute("style", kept);
|
|
384
|
+
}
|
|
385
|
+
if (!el.classList.length) el.removeAttribute("class");
|
|
386
|
+
}
|
|
387
|
+
return out.innerHTML;
|
|
495
388
|
}
|
|
496
|
-
/** @internal Inert parse; the leading `<remove>` keeps head-only tags in the body. */
|
|
497
389
|
function parseInert(html) {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
390
|
+
const body = new DOMParser().parseFromString(`<body><remove></remove>${html}`, "text/html").body;
|
|
391
|
+
body.firstChild?.remove();
|
|
392
|
+
return body;
|
|
501
393
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
'H2',
|
|
522
|
-
'H3',
|
|
394
|
+
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
395
|
+
"B",
|
|
396
|
+
"STRONG",
|
|
397
|
+
"I",
|
|
398
|
+
"EM",
|
|
399
|
+
"U",
|
|
400
|
+
"A",
|
|
401
|
+
"UL",
|
|
402
|
+
"OL",
|
|
403
|
+
"LI",
|
|
404
|
+
"P",
|
|
405
|
+
"BR",
|
|
406
|
+
"DIV",
|
|
407
|
+
"SPAN",
|
|
408
|
+
"PRE",
|
|
409
|
+
"CODE",
|
|
410
|
+
"H1",
|
|
411
|
+
"H2",
|
|
412
|
+
"H3"
|
|
523
413
|
]);
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
const VOIDED_TAGS = 'script, style, noscript, iframe, object, embed, template, title, meta, link';
|
|
532
|
-
/** Only `href` survives, and only on a link. */
|
|
533
|
-
const ALLOWED_HREF_PROTOCOLS = ['http:', 'https:', 'mailto:', 'tel:'];
|
|
534
|
-
/**
|
|
535
|
-
* Strips everything outside the whitelist, keeping the text of dropped elements.
|
|
536
|
-
*
|
|
537
|
-
* Runs on paste, on top of Angular's `DomSanitizer`: the sanitizer removes what is
|
|
538
|
-
* dangerous, this removes what is merely foreign to the editor (Word spans, inline
|
|
539
|
-
* styles, headings, tables) so the value stays a small, predictable HTML subset.
|
|
540
|
-
*/
|
|
414
|
+
const VOIDED_TAGS = "script, style, noscript, iframe, object, embed, template, title, meta, link";
|
|
415
|
+
const ALLOWED_HREF_PROTOCOLS = [
|
|
416
|
+
"http:",
|
|
417
|
+
"https:",
|
|
418
|
+
"mailto:",
|
|
419
|
+
"tel:"
|
|
420
|
+
];
|
|
541
421
|
function normalizeHtml(html) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
injection dans le document. Registre : docs/SECURITY-PRACTICES.md. */
|
|
548
|
-
template.innerHTML = html;
|
|
549
|
-
scrubNode(template.content);
|
|
550
|
-
return template.innerHTML;
|
|
422
|
+
if (typeof document === "undefined") return html;
|
|
423
|
+
const template = document.createElement("template");
|
|
424
|
+
template.innerHTML = html;
|
|
425
|
+
scrubNode(template.content);
|
|
426
|
+
return template.innerHTML;
|
|
551
427
|
}
|
|
552
|
-
/**
|
|
553
|
-
* Applies the same scrubbing to a live element, in place.
|
|
554
|
-
*
|
|
555
|
-
* `insertHTML` re-decorates what it inserts (`style="background-color: transparent"`
|
|
556
|
-
* and friends) *after* our normalisation, so the markup has to be cleaned once more
|
|
557
|
-
* once it is in the document. Attributes are removed node by node rather than by
|
|
558
|
-
* rewriting `innerHTML`, which would drop the caret.
|
|
559
|
-
*/
|
|
560
428
|
function scrubInPlace(root) {
|
|
561
|
-
|
|
429
|
+
scrubNode(root);
|
|
562
430
|
}
|
|
563
|
-
/** @internal Unwraps disallowed elements, voids the unsafe ones, drops attributes. */
|
|
564
431
|
function scrubNode(root) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
HIGHLIGHT_CLASSES.has(c));
|
|
582
|
-
if (kept.length)
|
|
583
|
-
el.setAttribute('class', kept.join(' '));
|
|
584
|
-
else
|
|
585
|
-
el.removeAttribute('class');
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
const keep = el.tagName === 'A' && attr.name === 'href' && isSafeHref(attr.value);
|
|
589
|
-
if (!keep)
|
|
590
|
-
el.removeAttribute(attr.name);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
432
|
+
for (const el of Array.from(root.querySelectorAll(VOIDED_TAGS))) el.remove();
|
|
433
|
+
for (const el of Array.from(root.querySelectorAll("*"))) {
|
|
434
|
+
if (!ALLOWED_TAGS.has(el.tagName)) {
|
|
435
|
+
el.replaceWith(...Array.from(el.childNodes));
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
for (const attr of Array.from(el.attributes)) {
|
|
439
|
+
if (attr.name === "class") {
|
|
440
|
+
const kept = attr.value.split(/\s+/).filter((c) => FONT_CLASSES.has(c) || SIZE_CLASSES.has(c) || COLOR_CLASSES.has(c) || HIGHLIGHT_CLASSES.has(c));
|
|
441
|
+
if (kept.length) el.setAttribute("class", kept.join(" "));
|
|
442
|
+
else el.removeAttribute("class");
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
if (!(el.tagName === "A" && attr.name === "href" && isSafeHref(attr.value))) el.removeAttribute(attr.name);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
593
448
|
}
|
|
594
|
-
/** @internal Rejects `javascript:` and other non-navigational schemes. */
|
|
595
449
|
function isSafeHref(href) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
450
|
+
try {
|
|
451
|
+
return ALLOWED_HREF_PROTOCOLS.includes(new URL(href, document.baseURI).protocol);
|
|
452
|
+
} catch {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
602
455
|
}
|
|
603
|
-
/** Normalises a browser-produced empty document (`<br>`, empty block) to `''`. */
|
|
604
456
|
function isEmptyHtml(html) {
|
|
605
|
-
|
|
457
|
+
return htmlToText(html).length === 0 && !/<(img|hr)\b/i.test(html);
|
|
606
458
|
}
|
|
607
|
-
/** Plain-text projection of the value — what the character counter measures. */
|
|
608
459
|
function htmlToText(html) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
const template = document.createElement('template');
|
|
616
|
-
/* eslint-disable-next-line no-restricted-syntax -- EXCEPTION JUSTIFIÉE :
|
|
617
|
-
`<template>` détaché, contenu inerte, jamais rendu — on n'en lit que
|
|
618
|
-
`textContent` pour compter les caractères. Registre :
|
|
619
|
-
docs/SECURITY-PRACTICES.md. */
|
|
620
|
-
template.innerHTML = html;
|
|
621
|
-
return (template.content.textContent ?? '').trim();
|
|
460
|
+
if (!html) return "";
|
|
461
|
+
if (typeof document === "undefined") return html.replace(/<[^>]*>/g, "").trim();
|
|
462
|
+
const template = document.createElement("template");
|
|
463
|
+
template.innerHTML = html;
|
|
464
|
+
return (template.content.textContent ?? "").trim();
|
|
622
465
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
*/
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
*/
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiEditor, isStandalone: true, selector: "ui-editor", inputs: { tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minRows: { classPropertyName: "minRows", publicName: "minRows", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, showCount: { classPropertyName: "showCount", publicName: "showCount", isSignal: true, isRequired: false, transformFunction: null }, toolbarPosition: { classPropertyName: "toolbarPosition", publicName: "toolbarPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", editorFocus: "editorFocus", editorBlur: "editorBlur", selectionChange: "selectionChange" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiEditor), multi: true }], viewQueries: [{ propertyName: "contentEl", first: true, predicate: ["contentEl"], descendants: true, isSignal: true }, { propertyName: "toolbarEl", first: true, predicate: ["toolbarEl"], descendants: true, isSignal: true }, { propertyName: "textColorPicker", first: true, predicate: ["textColorPicker"], descendants: true, isSignal: true }, { propertyName: "highlightColorPicker", first: true, predicate: ["highlightColorPicker"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <div class=\"ui-editor\" [class._small]=\"size() === 'small'\" [style.--_rows]=\"minRows()\">\n @if (toolbarPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n\n <div class=\"ui-editor-area\">\n <div\n #contentEl\n class=\"ui-editor-content\"\n [class._small]=\"size() === 'small'\"\n [id]=\"resolvedId()\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.contenteditable]=\"isEditable() ? 'true' : 'false'\"\n [attr.tabindex]=\"isDisabled() ? -1 : (tabindex() ?? 0)\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (beforeinput)=\"onBeforeInput($any($event))\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onContentKeydown($event)\"\n (keyup)=\"refreshState()\"\n (mouseup)=\"refreshState()\"\n (focus)=\"editorFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></div>\n\n @if (showPlaceholder()) {\n <span class=\"ui-editor-placeholder\" aria-hidden=\"true\">{{ placeholder() }}</span>\n }\n </div>\n\n @if (toolbarPosition() === 'bottom') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n </div>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-editor-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n\n<ng-template #toolbarTpl>\n @if (hasToolbar()) {\n <!-- ARIA toolbar pattern: keyboard delegated to the role=\"toolbar\" container,\n focus lives on the items (roving tabindex), same as ui-menu. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #toolbarEl\n class=\"ui-editor-toolbar\"\n [class._bottom]=\"toolbarPosition() === 'bottom'\"\n role=\"toolbar\"\n aria-label=\"Mise en forme\"\n aria-orientation=\"horizontal\"\n (mousedown)=\"onToolbarMousedown($event)\"\n (keydown)=\"onToolbarKeydown($event)\"\n >\n @for (entry of toolbar(); track entry.index) {\n @if (entry.isSeparator) {\n <span class=\"ui-editor-toolbar-separator\" aria-hidden=\"true\"></span>\n } @else if (entry.select; as select) {\n <!-- The dropdown takes the focus, so the command restores the caret\n before it runs (see onSelectValueChange). -->\n <ui-select\n class=\"ui-editor-tool ui-editor-select\"\n size=\"small\"\n [options]=\"selectOptions(select)\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [ngModel]=\"selectValue(select)\"\n [ariaLabel]=\"selectLabel(select)\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n (valueChange)=\"onSelectValueChange(select, $event, entry.index)\"\n />\n } @else {\n <ui-button\n class=\"ui-editor-tool\"\n [class._colorTool]=\"\n entry.buttonTool === 'textColor' || entry.buttonTool === 'highlightColor'\n \"\n variant=\"ghost\"\n level=\"low\"\n size=\"small\"\n iconOnly\n [icon]=\"entry.meta!.icon\"\n [ariaLabel]=\"entry.meta!.label\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n [buttonProps]=\"toolProps(entry.buttonTool!)\"\n [style.--ui-editor-swatch-indicator-color]=\"colorIndicatorVar(entry.buttonTool)\"\n (buttonClick)=\"runTool(entry.buttonTool!, entry.index, $event)\"\n />\n }\n }\n\n <!-- `textColor`/`highlightColor` popups: no trigger of their own (same\n composition contract as `ui-menu`), opened via `runTool` ->\n `onColorToolClick` -> `toggle(event)`. -->\n <ui-swatch-picker\n #textColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentTextColor()\"\n ariaLabel=\"Couleur du texte\"\n (swatchSelect)=\"onTextColorSelect($event)\"\n (opened)=\"textColorPickerOpen.set(true)\"\n (closed)=\"textColorPickerOpen.set(false)\"\n />\n <ui-swatch-picker\n #highlightColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentHighlightColor()\"\n ariaLabel=\"Couleur de surlignage\"\n (swatchSelect)=\"onHighlightColorSelect($event)\"\n (opened)=\"highlightColorPickerOpen.set(true)\"\n (closed)=\"highlightColorPickerOpen.set(false)\"\n />\n </div>\n }\n</ng-template>\n", styles: [".ui-editor{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;border-radius:var(--ui-editor-radius, inherit);overflow:hidden}.ui-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--ui-editor-toolbar-gap, var(--units-2xs));flex-shrink:0;padding:var(--ui-editor-toolbar-padding-y, var(--units-2xs)) var(--ui-editor-toolbar-padding-x, var(--units-xs));background-color:var(--ui-editor-toolbar-surface, var(--global-background-muted));border-block-end:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar._bottom{border-block-end:none;border-block-start:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar-separator{flex-shrink:0;inline-size:var(--ui-editor-separator-width, var(--stroke-sm));block-size:var(--ui-editor-separator-height, var(--size-typography-text-default));background-color:var(--ui-editor-separator-color, var(--form-low-stroke-default))}.ui-editor-select{display:inline-flex;flex-shrink:0;min-inline-size:var(--ui-editor-select-width, 13ch);--ui-field-stroke-width: 0}.ui-editor-select ::ng-deep .ui-select{inline-size:100%}.ui-editor-select ::ng-deep .ui-field-box{background:transparent;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-editor-select ::ng-deep .ui-field-box:hover{background-color:var(--ui-editor-toolbar-select-surface-hover, var(--form-low-surface-hover))}.ui-editor-tool._colorTool{position:relative}.ui-editor-tool._colorTool:after{content:\"\";position:absolute;inset-inline:var(--ui-editor-swatch-indicator-offset-x, var(--units-2xs));inset-block-end:0;block-size:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));border-radius:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));background-color:var(--ui-editor-swatch-indicator-color, transparent)}.ui-editor-area{position:relative;display:flex;flex:1 1 auto;min-height:0}.ui-editor-content{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-editor-content::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-editor-content:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-editor-content{box-sizing:border-box;width:100%;min-height:var(--ui-editor-min-height, calc(var(--_rows, 4) * var(--ui-editor-line-height, 1.5) * 1em));max-height:var(--ui-editor-max-height, none);padding:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default))) var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));overflow-y:auto;line-height:var(--ui-editor-line-height, 1.5);font-size:var(--ui-editor-font-size, var(--size-typography-text-default));overflow-wrap:break-word}.ui-editor-content._small{padding-block:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content:focus,.ui-editor-content:focus-visible{outline:none}.ui-editor-content[contenteditable=false]{cursor:default}.ui-editor-placeholder{position:absolute;inset-block-start:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default)));inset-inline-start:var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));line-height:var(--ui-editor-line-height, 1.5);font-family:var(--ui-editor-placeholder-font-family, var(--fontfamily-base));font-size:var(--ui-editor-font-size, var(--size-typography-text-default));color:var(--ui-editor-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-editor._small .ui-editor-placeholder{inset-block-start:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content ::ng-deep p{margin-block:0 var(--ui-editor-block-gap, var(--units-sm))}.ui-editor-content ::ng-deep p:last-child{margin-block-end:0}.ui-editor-content ::ng-deep ul,.ui-editor-content ::ng-deep ol{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding-inline-start:var(--ui-editor-list-padding-inline-start, var(--units-xl))}.ui-editor-content ::ng-deep ul:last-child,.ui-editor-content ::ng-deep ol:last-child{margin-block-end:0}.ui-editor-content ::ng-deep li+li{margin-block-start:var(--ui-editor-list-item-gap, var(--units-2xs))}.ui-editor-content ::ng-deep b,.ui-editor-content ::ng-deep strong{font-weight:var(--ui-editor-bold-weight, var(--weight-bold))}.ui-editor-content ::ng-deep a{color:var(--ui-editor-link-color, var(--global-text-brand));text-decoration:var(--ui-editor-link-text-decoration, underline)}.ui-editor-content ::ng-deep pre{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding:var(--ui-editor-code-padding-y, var(--units-sm)) var(--ui-editor-code-padding-x, var(--units-md));border-radius:var(--ui-editor-code-radius, var(--radius-xs));background-color:var(--ui-editor-code-surface, var(--global-background-muted));color:var(--ui-editor-code-color, var(--global-text-default));font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace));font-size:var(--ui-editor-code-font-size, var(--size-typography-text-md));white-space:pre-wrap;overflow-wrap:break-word}.ui-editor-content ::ng-deep pre:last-child{margin-block-end:0}.ui-editor-content ::ng-deep code{font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace))}.ui-editor-content ::ng-deep h1,.ui-editor-content ::ng-deep h2,.ui-editor-content ::ng-deep h3{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));font-family:var(--ui-editor-heading-font-family, var(--fontfamily-title));font-weight:var(--ui-editor-heading-weight, var(--weight-bold));line-height:var(--ui-editor-heading-line-height, 1.25)}.ui-editor-content ::ng-deep h1:last-child,.ui-editor-content ::ng-deep h2:last-child,.ui-editor-content ::ng-deep h3:last-child{margin-block-end:0}.ui-editor-content ::ng-deep h1{font-size:var(--ui-editor-heading-1-font-size, var(--size-typography-title-lg))}.ui-editor-content ::ng-deep h2{font-size:var(--ui-editor-heading-2-font-size, var(--size-typography-title-md))}.ui-editor-content ::ng-deep h3{font-size:var(--ui-editor-heading-3-font-size, var(--size-typography-title-sm))}.ui-editor-content ::ng-deep .ui-editor-font-base{font-family:var(--fontfamily-base)}.ui-editor-content ::ng-deep .ui-editor-font-title{font-family:var(--fontfamily-title)}.ui-editor-content ::ng-deep .ui-editor-font-monospace{font-family:var(--fontfamily-monospace)}.ui-editor-content ::ng-deep .ui-editor-size-sm{font-size:var(--ui-editor-size-sm-font-size, var(--size-typography-text-sm))}.ui-editor-content ::ng-deep .ui-editor-size-default{font-size:var(--ui-editor-size-default-font-size, var(--size-typography-text-default))}.ui-editor-content ::ng-deep .ui-editor-size-lg{font-size:var(--ui-editor-size-lg-font-size, var(--size-typography-text-lg))}.ui-editor-content ::ng-deep .ui-editor-size-xl{font-size:var(--ui-editor-size-xl-font-size, var(--size-typography-text-xl))}.ui-editor-content ::ng-deep .ui-editor-color-primary-900{color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-900{background-color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-color-primary-700{color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-700{background-color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-color-primary-500{color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-500{background-color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-color-primary-300{color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-300{background-color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-color-primary-100{color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-100{background-color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-900{color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-900{background-color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-700{color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-700{background-color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-500{color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-500{background-color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-300{color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-300{background-color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-100{color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-100{background-color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-color-green-900{color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-900{background-color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-color-green-700{color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-700{background-color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-color-green-500{color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-500{background-color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-color-green-300{color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-300{background-color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-color-green-100{color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-100{background-color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-color-orange-900{color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-900{background-color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-color-orange-700{color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-700{background-color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-color-orange-500{color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-500{background-color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-color-orange-300{color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-300{background-color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-color-orange-100{color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-100{background-color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-color-red-900{color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-900{background-color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-color-red-700{color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-700{background-color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-color-red-500{color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-500{background-color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-color-red-300{color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-300{background-color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-color-red-100{color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-100{background-color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-color-slate-900{color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-900{background-color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-color-slate-700{color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-700{background-color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-color-slate-500{color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-500{background-color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-color-slate-300{color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-300{background-color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-color-slate-100{color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-100{background-color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-color-grey-900{color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-900{background-color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-color-grey-700{color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-700{background-color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-color-grey-500{color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-500{background-color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-color-grey-300{color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-300{background-color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-color-grey-100{color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-100{background-color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-color-black{color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-color-white{color:var(--primitives-white-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-black{background-color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-white{background-color:var(--primitives-white-base)}.ui-editor-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-editor-count-font-family, var(--fontfamily-base));font-size:var(--ui-editor-count-font-size, var(--size-typography-text-md));color:var(--ui-editor-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-editor-count._small{font-size:var(--ui-editor-count-font-size-small, var(--size-typography-text-sm))}.ui-editor-count._over{color:var(--ui-editor-count-color-over, var(--form-error-content-default))}.ui-editor-count._disabled{color:var(--ui-editor-count-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "component", type: UiButton, selector: "ui-button", inputs: ["label", "ariaLabel", "type", "level", "variant", "onColor", "size", "icon", "iconPos", "iconOnly", "loading", "loadingIcon", "expanded", "rounded", "disabled", "ripple", "tabindex", "buttonProps", "iconTemplate", "loadingIconTemplate", "href", "routerLink", "target", "rel"], outputs: ["buttonClick", "buttonFocus", "buttonBlur"] }, { kind: "component", type: UiSwatchPicker, selector: "ui-swatch-picker", inputs: ["palette", "value", "popup", "size", "allowClear", "ariaLabel"], outputs: ["valueChange", "swatchSelect", "opened", "closed"] }, { kind: "component", type: UiSelect, selector: "ui-select", inputs: ["options", "optionLabel", "optionValue", "optionDisabled", "group", "optionGroupLabel", "optionGroupChildren", "dataKey", "multiple", "checkmark", "checkbox", "maxSelectedLabels", "overflowLabel", "placeholder", "showClear", "clearAriaLabel", "icon", "showIcon", "filter", "filterPlaceholder", "filterAriaLabel", "filterBy", "autofocusFilter", "resetFilterOnHide", "ripple", "emptyMessage", "emptyFilterMessage", "editable", "loading", "autoOptionFocus", "selectOnFocus", "focusOnHover", "virtualScroll", "virtualScrollItemSize", "lazy", "scrollHeight", "autoFlip", "panelStyleClass", "panelWidth"], outputs: ["valueChange", "opened", "closed", "cleared", "filterChange", "lazyLoad", "inputFocus", "inputBlur"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
args: [{ selector: 'ui-editor', imports: [UiField, UiButton, UiSwatchPicker, UiSelect, NgTemplateOutlet, FormsModule], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiEditor), multi: true }], template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <div class=\"ui-editor\" [class._small]=\"size() === 'small'\" [style.--_rows]=\"minRows()\">\n @if (toolbarPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n\n <div class=\"ui-editor-area\">\n <div\n #contentEl\n class=\"ui-editor-content\"\n [class._small]=\"size() === 'small'\"\n [id]=\"resolvedId()\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.contenteditable]=\"isEditable() ? 'true' : 'false'\"\n [attr.tabindex]=\"isDisabled() ? -1 : (tabindex() ?? 0)\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (beforeinput)=\"onBeforeInput($any($event))\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onContentKeydown($event)\"\n (keyup)=\"refreshState()\"\n (mouseup)=\"refreshState()\"\n (focus)=\"editorFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></div>\n\n @if (showPlaceholder()) {\n <span class=\"ui-editor-placeholder\" aria-hidden=\"true\">{{ placeholder() }}</span>\n }\n </div>\n\n @if (toolbarPosition() === 'bottom') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n </div>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-editor-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n\n<ng-template #toolbarTpl>\n @if (hasToolbar()) {\n <!-- ARIA toolbar pattern: keyboard delegated to the role=\"toolbar\" container,\n focus lives on the items (roving tabindex), same as ui-menu. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #toolbarEl\n class=\"ui-editor-toolbar\"\n [class._bottom]=\"toolbarPosition() === 'bottom'\"\n role=\"toolbar\"\n aria-label=\"Mise en forme\"\n aria-orientation=\"horizontal\"\n (mousedown)=\"onToolbarMousedown($event)\"\n (keydown)=\"onToolbarKeydown($event)\"\n >\n @for (entry of toolbar(); track entry.index) {\n @if (entry.isSeparator) {\n <span class=\"ui-editor-toolbar-separator\" aria-hidden=\"true\"></span>\n } @else if (entry.select; as select) {\n <!-- The dropdown takes the focus, so the command restores the caret\n before it runs (see onSelectValueChange). -->\n <ui-select\n class=\"ui-editor-tool ui-editor-select\"\n size=\"small\"\n [options]=\"selectOptions(select)\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [ngModel]=\"selectValue(select)\"\n [ariaLabel]=\"selectLabel(select)\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n (valueChange)=\"onSelectValueChange(select, $event, entry.index)\"\n />\n } @else {\n <ui-button\n class=\"ui-editor-tool\"\n [class._colorTool]=\"\n entry.buttonTool === 'textColor' || entry.buttonTool === 'highlightColor'\n \"\n variant=\"ghost\"\n level=\"low\"\n size=\"small\"\n iconOnly\n [icon]=\"entry.meta!.icon\"\n [ariaLabel]=\"entry.meta!.label\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n [buttonProps]=\"toolProps(entry.buttonTool!)\"\n [style.--ui-editor-swatch-indicator-color]=\"colorIndicatorVar(entry.buttonTool)\"\n (buttonClick)=\"runTool(entry.buttonTool!, entry.index, $event)\"\n />\n }\n }\n\n <!-- `textColor`/`highlightColor` popups: no trigger of their own (same\n composition contract as `ui-menu`), opened via `runTool` ->\n `onColorToolClick` -> `toggle(event)`. -->\n <ui-swatch-picker\n #textColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentTextColor()\"\n ariaLabel=\"Couleur du texte\"\n (swatchSelect)=\"onTextColorSelect($event)\"\n (opened)=\"textColorPickerOpen.set(true)\"\n (closed)=\"textColorPickerOpen.set(false)\"\n />\n <ui-swatch-picker\n #highlightColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentHighlightColor()\"\n ariaLabel=\"Couleur de surlignage\"\n (swatchSelect)=\"onHighlightColorSelect($event)\"\n (opened)=\"highlightColorPickerOpen.set(true)\"\n (closed)=\"highlightColorPickerOpen.set(false)\"\n />\n </div>\n }\n</ng-template>\n", styles: [".ui-editor{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;border-radius:var(--ui-editor-radius, inherit);overflow:hidden}.ui-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--ui-editor-toolbar-gap, var(--units-2xs));flex-shrink:0;padding:var(--ui-editor-toolbar-padding-y, var(--units-2xs)) var(--ui-editor-toolbar-padding-x, var(--units-xs));background-color:var(--ui-editor-toolbar-surface, var(--global-background-muted));border-block-end:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar._bottom{border-block-end:none;border-block-start:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar-separator{flex-shrink:0;inline-size:var(--ui-editor-separator-width, var(--stroke-sm));block-size:var(--ui-editor-separator-height, var(--size-typography-text-default));background-color:var(--ui-editor-separator-color, var(--form-low-stroke-default))}.ui-editor-select{display:inline-flex;flex-shrink:0;min-inline-size:var(--ui-editor-select-width, 13ch);--ui-field-stroke-width: 0}.ui-editor-select ::ng-deep .ui-select{inline-size:100%}.ui-editor-select ::ng-deep .ui-field-box{background:transparent;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-editor-select ::ng-deep .ui-field-box:hover{background-color:var(--ui-editor-toolbar-select-surface-hover, var(--form-low-surface-hover))}.ui-editor-tool._colorTool{position:relative}.ui-editor-tool._colorTool:after{content:\"\";position:absolute;inset-inline:var(--ui-editor-swatch-indicator-offset-x, var(--units-2xs));inset-block-end:0;block-size:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));border-radius:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));background-color:var(--ui-editor-swatch-indicator-color, transparent)}.ui-editor-area{position:relative;display:flex;flex:1 1 auto;min-height:0}.ui-editor-content{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-editor-content::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-editor-content:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-editor-content{box-sizing:border-box;width:100%;min-height:var(--ui-editor-min-height, calc(var(--_rows, 4) * var(--ui-editor-line-height, 1.5) * 1em));max-height:var(--ui-editor-max-height, none);padding:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default))) var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));overflow-y:auto;line-height:var(--ui-editor-line-height, 1.5);font-size:var(--ui-editor-font-size, var(--size-typography-text-default));overflow-wrap:break-word}.ui-editor-content._small{padding-block:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content:focus,.ui-editor-content:focus-visible{outline:none}.ui-editor-content[contenteditable=false]{cursor:default}.ui-editor-placeholder{position:absolute;inset-block-start:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default)));inset-inline-start:var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));line-height:var(--ui-editor-line-height, 1.5);font-family:var(--ui-editor-placeholder-font-family, var(--fontfamily-base));font-size:var(--ui-editor-font-size, var(--size-typography-text-default));color:var(--ui-editor-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-editor._small .ui-editor-placeholder{inset-block-start:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content ::ng-deep p{margin-block:0 var(--ui-editor-block-gap, var(--units-sm))}.ui-editor-content ::ng-deep p:last-child{margin-block-end:0}.ui-editor-content ::ng-deep ul,.ui-editor-content ::ng-deep ol{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding-inline-start:var(--ui-editor-list-padding-inline-start, var(--units-xl))}.ui-editor-content ::ng-deep ul:last-child,.ui-editor-content ::ng-deep ol:last-child{margin-block-end:0}.ui-editor-content ::ng-deep li+li{margin-block-start:var(--ui-editor-list-item-gap, var(--units-2xs))}.ui-editor-content ::ng-deep b,.ui-editor-content ::ng-deep strong{font-weight:var(--ui-editor-bold-weight, var(--weight-bold))}.ui-editor-content ::ng-deep a{color:var(--ui-editor-link-color, var(--global-text-brand));text-decoration:var(--ui-editor-link-text-decoration, underline)}.ui-editor-content ::ng-deep pre{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding:var(--ui-editor-code-padding-y, var(--units-sm)) var(--ui-editor-code-padding-x, var(--units-md));border-radius:var(--ui-editor-code-radius, var(--radius-xs));background-color:var(--ui-editor-code-surface, var(--global-background-muted));color:var(--ui-editor-code-color, var(--global-text-default));font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace));font-size:var(--ui-editor-code-font-size, var(--size-typography-text-md));white-space:pre-wrap;overflow-wrap:break-word}.ui-editor-content ::ng-deep pre:last-child{margin-block-end:0}.ui-editor-content ::ng-deep code{font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace))}.ui-editor-content ::ng-deep h1,.ui-editor-content ::ng-deep h2,.ui-editor-content ::ng-deep h3{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));font-family:var(--ui-editor-heading-font-family, var(--fontfamily-title));font-weight:var(--ui-editor-heading-weight, var(--weight-bold));line-height:var(--ui-editor-heading-line-height, 1.25)}.ui-editor-content ::ng-deep h1:last-child,.ui-editor-content ::ng-deep h2:last-child,.ui-editor-content ::ng-deep h3:last-child{margin-block-end:0}.ui-editor-content ::ng-deep h1{font-size:var(--ui-editor-heading-1-font-size, var(--size-typography-title-lg))}.ui-editor-content ::ng-deep h2{font-size:var(--ui-editor-heading-2-font-size, var(--size-typography-title-md))}.ui-editor-content ::ng-deep h3{font-size:var(--ui-editor-heading-3-font-size, var(--size-typography-title-sm))}.ui-editor-content ::ng-deep .ui-editor-font-base{font-family:var(--fontfamily-base)}.ui-editor-content ::ng-deep .ui-editor-font-title{font-family:var(--fontfamily-title)}.ui-editor-content ::ng-deep .ui-editor-font-monospace{font-family:var(--fontfamily-monospace)}.ui-editor-content ::ng-deep .ui-editor-size-sm{font-size:var(--ui-editor-size-sm-font-size, var(--size-typography-text-sm))}.ui-editor-content ::ng-deep .ui-editor-size-default{font-size:var(--ui-editor-size-default-font-size, var(--size-typography-text-default))}.ui-editor-content ::ng-deep .ui-editor-size-lg{font-size:var(--ui-editor-size-lg-font-size, var(--size-typography-text-lg))}.ui-editor-content ::ng-deep .ui-editor-size-xl{font-size:var(--ui-editor-size-xl-font-size, var(--size-typography-text-xl))}.ui-editor-content ::ng-deep .ui-editor-color-primary-900{color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-900{background-color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-color-primary-700{color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-700{background-color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-color-primary-500{color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-500{background-color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-color-primary-300{color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-300{background-color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-color-primary-100{color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-100{background-color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-900{color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-900{background-color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-700{color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-700{background-color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-500{color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-500{background-color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-300{color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-300{background-color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-100{color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-100{background-color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-color-green-900{color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-900{background-color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-color-green-700{color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-700{background-color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-color-green-500{color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-500{background-color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-color-green-300{color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-300{background-color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-color-green-100{color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-100{background-color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-color-orange-900{color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-900{background-color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-color-orange-700{color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-700{background-color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-color-orange-500{color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-500{background-color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-color-orange-300{color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-300{background-color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-color-orange-100{color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-100{background-color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-color-red-900{color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-900{background-color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-color-red-700{color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-700{background-color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-color-red-500{color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-500{background-color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-color-red-300{color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-300{background-color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-color-red-100{color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-100{background-color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-color-slate-900{color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-900{background-color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-color-slate-700{color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-700{background-color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-color-slate-500{color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-500{background-color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-color-slate-300{color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-300{background-color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-color-slate-100{color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-100{background-color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-color-grey-900{color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-900{background-color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-color-grey-700{color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-700{background-color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-color-grey-500{color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-500{background-color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-color-grey-300{color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-300{background-color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-color-grey-100{color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-100{background-color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-color-black{color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-color-white{color:var(--primitives-white-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-black{background-color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-white{background-color:var(--primitives-white-base)}.ui-editor-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-editor-count-font-family, var(--fontfamily-base));font-size:var(--ui-editor-count-font-size, var(--size-typography-text-md));color:var(--ui-editor-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-editor-count._small{font-size:var(--ui-editor-count-font-size-small, var(--size-typography-text-sm))}.ui-editor-count._over{color:var(--ui-editor-count-color-over, var(--form-error-content-default))}.ui-editor-count._disabled{color:var(--ui-editor-count-color-disabled, var(--form-high-content-disabled))}\n"] }]
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
466
|
+
const SHORTCUTS = {
|
|
467
|
+
b: "bold",
|
|
468
|
+
i: "italic",
|
|
469
|
+
u: "underline"
|
|
470
|
+
};
|
|
471
|
+
var UiEditor = class UiEditor extends BaseFormField {
|
|
472
|
+
constructor() {
|
|
473
|
+
super();
|
|
474
|
+
this.tools = input(DEFAULT_EDITOR_TOOLS, {
|
|
475
|
+
...ngDevMode ? { debugName: "tools" } : /* istanbul ignore next */ {},
|
|
476
|
+
transform: (value) => value?.length ? value : DEFAULT_EDITOR_TOOLS
|
|
477
|
+
});
|
|
478
|
+
this.placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
479
|
+
this.minRows = input(4, ...ngDevMode ? [{ debugName: "minRows" }] : /* istanbul ignore next */ []);
|
|
480
|
+
this.maxlength = input(...ngDevMode ? [void 0, { debugName: "maxlength" }] : /* istanbul ignore next */ []);
|
|
481
|
+
this.showCount = input(false, {
|
|
482
|
+
...ngDevMode ? { debugName: "showCount" } : /* istanbul ignore next */ {},
|
|
483
|
+
transform: booleanAttribute
|
|
484
|
+
});
|
|
485
|
+
this.toolbarPosition = input("top", ...ngDevMode ? [{ debugName: "toolbarPosition" }] : /* istanbul ignore next */ []);
|
|
486
|
+
this.valueChange = output();
|
|
487
|
+
this.editorFocus = output();
|
|
488
|
+
this.editorBlur = output();
|
|
489
|
+
this.selectionChange = output();
|
|
490
|
+
this.sanitizer = inject(DomSanitizer);
|
|
491
|
+
this.contentEl = viewChild("contentEl", ...ngDevMode ? [{ debugName: "contentEl" }] : /* istanbul ignore next */ []);
|
|
492
|
+
this.toolbarEl = viewChild("toolbarEl", ...ngDevMode ? [{ debugName: "toolbarEl" }] : /* istanbul ignore next */ []);
|
|
493
|
+
this.textColorPicker = viewChild("textColorPicker", ...ngDevMode ? [{ debugName: "textColorPicker" }] : /* istanbul ignore next */ []);
|
|
494
|
+
this.highlightColorPicker = viewChild("highlightColorPicker", ...ngDevMode ? [{ debugName: "highlightColorPicker" }] : /* istanbul ignore next */ []);
|
|
495
|
+
this.lastEmitted = "";
|
|
496
|
+
this.state = signal(emptyEditorState(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
497
|
+
this.currentFont = signal(null, ...ngDevMode ? [{ debugName: "currentFont" }] : /* istanbul ignore next */ []);
|
|
498
|
+
this.currentSize = signal(null, ...ngDevMode ? [{ debugName: "currentSize" }] : /* istanbul ignore next */ []);
|
|
499
|
+
this.currentTextColor = signal(null, ...ngDevMode ? [{ debugName: "currentTextColor" }] : /* istanbul ignore next */ []);
|
|
500
|
+
this.currentHighlightColor = signal(null, ...ngDevMode ? [{ debugName: "currentHighlightColor" }] : /* istanbul ignore next */ []);
|
|
501
|
+
this.activeTool = signal(0, ...ngDevMode ? [{ debugName: "activeTool" }] : /* istanbul ignore next */ []);
|
|
502
|
+
this.textColorPickerOpen = signal(false, ...ngDevMode ? [{ debugName: "textColorPickerOpen" }] : /* istanbul ignore next */ []);
|
|
503
|
+
this.highlightColorPickerOpen = signal(false, ...ngDevMode ? [{ debugName: "highlightColorPickerOpen" }] : /* istanbul ignore next */ []);
|
|
504
|
+
this.savedRange = null;
|
|
505
|
+
this.safeValue = computed(() => sanitizeEditorHtml(this.modelValue() ?? "", (html) => this.sanitizer.sanitize(SecurityContext.HTML, html) ?? ""), ...ngDevMode ? [{ debugName: "safeValue" }] : /* istanbul ignore next */ []);
|
|
506
|
+
this.charCount = computed(() => htmlToText(this.safeValue()).length, ...ngDevMode ? [{ debugName: "charCount" }] : /* istanbul ignore next */ []);
|
|
507
|
+
this.isFilled = computed(() => this.charCount() > 0, ...ngDevMode ? [{ debugName: "isFilled" }] : /* istanbul ignore next */ []);
|
|
508
|
+
this.overLimit = computed(() => {
|
|
509
|
+
const max = this.maxlength();
|
|
510
|
+
return max != null && this.charCount() > max;
|
|
511
|
+
}, ...ngDevMode ? [{ debugName: "overLimit" }] : /* istanbul ignore next */ []);
|
|
512
|
+
this.showPlaceholder = computed(() => !!this.placeholder() && !this.hasFloatLabel() && this.charCount() === 0, ...ngDevMode ? [{ debugName: "showPlaceholder" }] : /* istanbul ignore next */ []);
|
|
513
|
+
this.isEditable = computed(() => !this.isDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "isEditable" }] : /* istanbul ignore next */ []);
|
|
514
|
+
this.toolbar = computed(() => this.tools().map((tool, index) => ({
|
|
515
|
+
tool,
|
|
516
|
+
index,
|
|
517
|
+
isSeparator: tool === "separator",
|
|
518
|
+
select: EDITOR_SELECT_TOOLS.includes(tool) ? tool : null,
|
|
519
|
+
buttonTool: tool === "separator" || EDITOR_SELECT_TOOLS.includes(tool) ? null : tool,
|
|
520
|
+
meta: tool === "separator" || EDITOR_SELECT_TOOLS.includes(tool) ? null : EDITOR_TOOL_META[tool]
|
|
521
|
+
})), ...ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []);
|
|
522
|
+
this.sizes = EDITOR_SIZES;
|
|
523
|
+
this.fonts = signal(EDITOR_FONTS.map((f) => ({ ...f })), ...ngDevMode ? [{ debugName: "fonts" }] : /* istanbul ignore next */ []);
|
|
524
|
+
this.fontFamilyOptions = computed(() => this.fonts().map((font) => ({
|
|
525
|
+
value: font.key,
|
|
526
|
+
label: font.label
|
|
527
|
+
})), ...ngDevMode ? [{ debugName: "fontFamilyOptions" }] : /* istanbul ignore next */ []);
|
|
528
|
+
this.fontSizeOptions = computed(() => this.sizes.map((size) => ({
|
|
529
|
+
value: size.key,
|
|
530
|
+
label: size.label
|
|
531
|
+
})), ...ngDevMode ? [{ debugName: "fontSizeOptions" }] : /* istanbul ignore next */ []);
|
|
532
|
+
this.currentTextColorSwatch = computed(() => EDITOR_COLORS.find((c) => c.key === this.currentTextColor()), ...ngDevMode ? [{ debugName: "currentTextColorSwatch" }] : /* istanbul ignore next */ []);
|
|
533
|
+
this.currentHighlightColorSwatch = computed(() => EDITOR_HIGHLIGHTS.find((c) => c.key === this.currentHighlightColor()), ...ngDevMode ? [{ debugName: "currentHighlightColorSwatch" }] : /* istanbul ignore next */ []);
|
|
534
|
+
this.hasToolbar = computed(() => this.tools().some((t) => t !== "separator"), ...ngDevMode ? [{ debugName: "hasToolbar" }] : /* istanbul ignore next */ []);
|
|
535
|
+
this.tabStop = computed(() => {
|
|
536
|
+
const actionable = this.toolbar().filter((entry) => !entry.isSeparator);
|
|
537
|
+
if (!actionable.length) return -1;
|
|
538
|
+
const active = this.activeTool();
|
|
539
|
+
return actionable.some((entry) => entry.index === active) ? active : actionable[0].index;
|
|
540
|
+
}, ...ngDevMode ? [{ debugName: "tabStop" }] : /* istanbul ignore next */ []);
|
|
541
|
+
this.countId = computed(() => `${this.resolvedId()}-count`, ...ngDevMode ? [{ debugName: "countId" }] : /* istanbul ignore next */ []);
|
|
542
|
+
this.describedByIds = computed(() => {
|
|
543
|
+
const ids = [this.displayMessage() ? this.messageId() : null, this.showCount() ? this.countId() : null].filter(Boolean);
|
|
544
|
+
return ids.length ? ids.join(" ") : null;
|
|
545
|
+
}, ...ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []);
|
|
546
|
+
afterNextRender(() => {
|
|
547
|
+
this.fonts.set(EDITOR_FONTS.map((f) => ({
|
|
548
|
+
...f,
|
|
549
|
+
label: resolveFontLabel(f.cssVar, f.label)
|
|
550
|
+
})));
|
|
551
|
+
});
|
|
552
|
+
effect(() => {
|
|
553
|
+
const value = this.safeValue();
|
|
554
|
+
const el = this.contentEl()?.nativeElement;
|
|
555
|
+
if (!el) return;
|
|
556
|
+
if (this.modelValue() === this.lastEmitted || el.innerHTML === value) return;
|
|
557
|
+
el.innerHTML = value;
|
|
558
|
+
this.lastEmitted = value;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
uidPrefix() {
|
|
562
|
+
return "ui-editor";
|
|
563
|
+
}
|
|
564
|
+
focus(options) {
|
|
565
|
+
this.contentEl()?.nativeElement.focus(options);
|
|
566
|
+
}
|
|
567
|
+
onInput() {
|
|
568
|
+
const el = this.contentEl()?.nativeElement;
|
|
569
|
+
if (!el) return;
|
|
570
|
+
const html = isEmptyHtml(el.innerHTML) ? "" : el.innerHTML;
|
|
571
|
+
this.lastEmitted = html;
|
|
572
|
+
this.modelValue.set(html);
|
|
573
|
+
this.emitChange(html);
|
|
574
|
+
this.valueChange.emit(html);
|
|
575
|
+
this.refreshState();
|
|
576
|
+
}
|
|
577
|
+
onBeforeInput(event) {
|
|
578
|
+
const max = this.maxlength();
|
|
579
|
+
if (max == null || !event.inputType.startsWith("insert")) return;
|
|
580
|
+
const selection = document.getSelection();
|
|
581
|
+
const replaced = selection && !selection.isCollapsed ? selection.toString().length : 0;
|
|
582
|
+
const incoming = event.data?.length ?? 1;
|
|
583
|
+
if (this.charCount() - replaced + incoming > max) event.preventDefault();
|
|
584
|
+
}
|
|
585
|
+
onPaste(event) {
|
|
586
|
+
if (!this.isEditable()) return;
|
|
587
|
+
event.preventDefault();
|
|
588
|
+
const clipboard = event.clipboardData;
|
|
589
|
+
if (!clipboard) return;
|
|
590
|
+
const html = clipboard.getData("text/html");
|
|
591
|
+
if (html) {
|
|
592
|
+
insertHtml(this.sanitizer.sanitize(SecurityContext.HTML, normalizeHtml(html)) ?? "");
|
|
593
|
+
const el = this.contentEl()?.nativeElement;
|
|
594
|
+
if (el) scrubInPlace(el);
|
|
595
|
+
} else insertText(clipboard.getData("text/plain"));
|
|
596
|
+
this.onInput();
|
|
597
|
+
}
|
|
598
|
+
onContentKeydown(event) {
|
|
599
|
+
if (!(event.metaKey || event.ctrlKey)) return;
|
|
600
|
+
if (!SHORTCUTS[event.key.toLowerCase()]) return;
|
|
601
|
+
queueMicrotask(() => this.refreshState());
|
|
602
|
+
}
|
|
603
|
+
onBlur(event) {
|
|
604
|
+
this.emitTouch();
|
|
605
|
+
this.editorBlur.emit(event);
|
|
606
|
+
}
|
|
607
|
+
refreshState() {
|
|
608
|
+
this.rememberSelection();
|
|
609
|
+
const anchor = document.getSelection()?.anchorNode ?? null;
|
|
610
|
+
this.currentFont.set(readFontFamily(anchor));
|
|
611
|
+
this.currentSize.set(readFontSize(anchor));
|
|
612
|
+
this.currentTextColor.set(readTextColor(anchor));
|
|
613
|
+
this.currentHighlightColor.set(readHighlightColor(anchor));
|
|
614
|
+
const next = readEditorState();
|
|
615
|
+
const prev = this.state();
|
|
616
|
+
if (Object.keys(next).every((k) => next[k] === prev[k])) return;
|
|
617
|
+
this.state.set(next);
|
|
618
|
+
this.selectionChange.emit(next);
|
|
619
|
+
}
|
|
620
|
+
rememberSelection() {
|
|
621
|
+
const el = this.contentEl()?.nativeElement;
|
|
622
|
+
const selection = document.getSelection();
|
|
623
|
+
if (!el || !selection?.rangeCount) return;
|
|
624
|
+
const range = selection.getRangeAt(0);
|
|
625
|
+
if (el.contains(range.commonAncestorContainer)) this.savedRange = range.cloneRange();
|
|
626
|
+
}
|
|
627
|
+
restoreSelection() {
|
|
628
|
+
this.focus();
|
|
629
|
+
const range = this.savedRange;
|
|
630
|
+
if (!range) return;
|
|
631
|
+
const selection = document.getSelection();
|
|
632
|
+
selection?.removeAllRanges();
|
|
633
|
+
selection?.addRange(range);
|
|
634
|
+
}
|
|
635
|
+
runTool(tool, index, event) {
|
|
636
|
+
if (!this.isEditable()) return;
|
|
637
|
+
this.activeTool.set(index);
|
|
638
|
+
if (tool === "textColor" || tool === "highlightColor") {
|
|
639
|
+
this.onColorToolClick(tool, event);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this.focus();
|
|
643
|
+
if (tool === "link") this.promptForLink();
|
|
644
|
+
else if (tool === "codeBlock") toggleCodeBlock();
|
|
645
|
+
else if (tool === "clearFormat") this.clearFormat();
|
|
646
|
+
else applyCommand(tool);
|
|
647
|
+
this.onInput();
|
|
648
|
+
}
|
|
649
|
+
clearFormat() {
|
|
650
|
+
applyCommand("clearFormat");
|
|
651
|
+
const el = this.contentEl()?.nativeElement;
|
|
652
|
+
const selection = document.getSelection();
|
|
653
|
+
if (!el || !selection?.rangeCount) return;
|
|
654
|
+
const range = selection.getRangeAt(0);
|
|
655
|
+
if (!el.contains(range.commonAncestorContainer)) return;
|
|
656
|
+
clearFormatMarkers(el, range);
|
|
657
|
+
}
|
|
658
|
+
onColorToolClick(tool, event) {
|
|
659
|
+
this.rememberSelection();
|
|
660
|
+
(tool === "textColor" ? this.textColorPicker() : this.highlightColorPicker())?.toggle(event);
|
|
661
|
+
}
|
|
662
|
+
onTextColorSelect(swatch) {
|
|
663
|
+
if (!this.isEditable()) return;
|
|
664
|
+
this.restoreSelection();
|
|
665
|
+
const el = this.contentEl()?.nativeElement;
|
|
666
|
+
if (swatch) {
|
|
667
|
+
applyTextColor();
|
|
668
|
+
if (el) convertColorMarkers(el, `ui-editor-color-${swatch.key}`);
|
|
669
|
+
} else if (el && this.savedRange) for (const color of EDITOR_COLORS) clearMarkerClass(el, this.savedRange, color.className);
|
|
670
|
+
this.onInput();
|
|
671
|
+
}
|
|
672
|
+
onHighlightColorSelect(swatch) {
|
|
673
|
+
if (!this.isEditable()) return;
|
|
674
|
+
this.restoreSelection();
|
|
675
|
+
const el = this.contentEl()?.nativeElement;
|
|
676
|
+
if (swatch) {
|
|
677
|
+
applyHighlightColor();
|
|
678
|
+
if (el) convertHighlightMarkers(el, `ui-editor-highlight-${swatch.key}`);
|
|
679
|
+
} else if (el && this.savedRange) for (const color of EDITOR_HIGHLIGHTS) clearMarkerClass(el, this.savedRange, color.className);
|
|
680
|
+
this.onInput();
|
|
681
|
+
}
|
|
682
|
+
selectOptions(tool) {
|
|
683
|
+
return tool === "fontFamily" ? this.fontFamilyOptions() : this.fontSizeOptions();
|
|
684
|
+
}
|
|
685
|
+
selectValue(tool) {
|
|
686
|
+
if (tool === "fontFamily") return this.currentFont() ?? "base";
|
|
687
|
+
return this.currentSize() ?? "default";
|
|
688
|
+
}
|
|
689
|
+
selectLabel(tool) {
|
|
690
|
+
if (tool === "fontFamily") return "Police";
|
|
691
|
+
return "Taille du texte";
|
|
692
|
+
}
|
|
693
|
+
onSelectValueChange(tool, value, index) {
|
|
694
|
+
this.activeTool.set(index);
|
|
695
|
+
if (!this.isEditable() || value == null) return;
|
|
696
|
+
this.restoreSelection();
|
|
697
|
+
const el = this.contentEl()?.nativeElement;
|
|
698
|
+
if (tool === "fontFamily") {
|
|
699
|
+
const choice = this.fonts().find((f) => f.key === value);
|
|
700
|
+
if (!choice) return;
|
|
701
|
+
applyFontFamily();
|
|
702
|
+
if (el) convertFontMarkers(el, choice.className);
|
|
703
|
+
} else {
|
|
704
|
+
const choice = this.sizes.find((s) => s.key === value);
|
|
705
|
+
if (!choice) return;
|
|
706
|
+
applyFontSize();
|
|
707
|
+
if (el) convertSizeMarkers(el, choice.className);
|
|
708
|
+
}
|
|
709
|
+
this.onInput();
|
|
710
|
+
}
|
|
711
|
+
promptForLink() {
|
|
712
|
+
const href = window.prompt("Adresse du lien (laisser vide pour retirer le lien)");
|
|
713
|
+
if (href === null) return;
|
|
714
|
+
if (href.trim() === "") removeLink();
|
|
715
|
+
else applyLink(href.trim());
|
|
716
|
+
}
|
|
717
|
+
onToolbarMousedown(event) {
|
|
718
|
+
event.preventDefault();
|
|
719
|
+
}
|
|
720
|
+
onToolbarKeydown(event) {
|
|
721
|
+
const indexes = this.toolbar().filter((entry) => !entry.isSeparator).map((entry) => entry.index);
|
|
722
|
+
if (!indexes.length) return;
|
|
723
|
+
const current = Math.max(0, indexes.indexOf(this.tabStop()));
|
|
724
|
+
let next;
|
|
725
|
+
switch (event.key) {
|
|
726
|
+
case "ArrowRight":
|
|
727
|
+
next = indexes[(current + 1) % indexes.length];
|
|
728
|
+
break;
|
|
729
|
+
case "ArrowLeft":
|
|
730
|
+
next = indexes[(current - 1 + indexes.length) % indexes.length];
|
|
731
|
+
break;
|
|
732
|
+
case "Home":
|
|
733
|
+
next = indexes[0];
|
|
734
|
+
break;
|
|
735
|
+
case "End":
|
|
736
|
+
next = indexes[indexes.length - 1];
|
|
737
|
+
break;
|
|
738
|
+
case "Escape":
|
|
739
|
+
event.preventDefault();
|
|
740
|
+
this.focus();
|
|
741
|
+
return;
|
|
742
|
+
default: return;
|
|
743
|
+
}
|
|
744
|
+
event.preventDefault();
|
|
745
|
+
this.activeTool.set(next);
|
|
746
|
+
this.focusTool(next);
|
|
747
|
+
}
|
|
748
|
+
focusTool(index) {
|
|
749
|
+
const position = this.toolbar().filter((e) => !e.isSeparator && e.index <= index).length - 1;
|
|
750
|
+
(this.toolbarEl()?.nativeElement.querySelectorAll("button"))?.[position]?.focus();
|
|
751
|
+
}
|
|
752
|
+
colorIndicatorVar(tool) {
|
|
753
|
+
const swatch = tool === "textColor" ? this.currentTextColorSwatch() : tool === "highlightColor" ? this.currentHighlightColorSwatch() : null;
|
|
754
|
+
return swatch ? `var(${swatch.cssVar})` : null;
|
|
755
|
+
}
|
|
756
|
+
toolProps(tool) {
|
|
757
|
+
if (tool === "textColor" || tool === "highlightColor") return {
|
|
758
|
+
"aria-haspopup": "true",
|
|
759
|
+
"aria-expanded": (tool === "textColor" ? this.textColorPickerOpen() : this.highlightColorPickerOpen()) ? "true" : "false"
|
|
760
|
+
};
|
|
761
|
+
const state = this.state();
|
|
762
|
+
if (!(tool in state)) return void 0;
|
|
763
|
+
return { "aria-pressed": state[tool] ? "true" : "false" };
|
|
764
|
+
}
|
|
765
|
+
static {
|
|
766
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
767
|
+
minVersion: "12.0.0",
|
|
768
|
+
version: "22.3.0",
|
|
769
|
+
ngImport: i0,
|
|
770
|
+
type: UiEditor,
|
|
771
|
+
deps: [],
|
|
772
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
static {
|
|
776
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
777
|
+
minVersion: "17.0.0",
|
|
778
|
+
version: "22.3.0",
|
|
779
|
+
type: UiEditor,
|
|
780
|
+
isStandalone: true,
|
|
781
|
+
selector: "ui-editor",
|
|
782
|
+
inputs: {
|
|
783
|
+
tools: {
|
|
784
|
+
classPropertyName: "tools",
|
|
785
|
+
publicName: "tools",
|
|
786
|
+
isSignal: true,
|
|
787
|
+
isRequired: false,
|
|
788
|
+
transformFunction: null
|
|
789
|
+
},
|
|
790
|
+
placeholder: {
|
|
791
|
+
classPropertyName: "placeholder",
|
|
792
|
+
publicName: "placeholder",
|
|
793
|
+
isSignal: true,
|
|
794
|
+
isRequired: false,
|
|
795
|
+
transformFunction: null
|
|
796
|
+
},
|
|
797
|
+
minRows: {
|
|
798
|
+
classPropertyName: "minRows",
|
|
799
|
+
publicName: "minRows",
|
|
800
|
+
isSignal: true,
|
|
801
|
+
isRequired: false,
|
|
802
|
+
transformFunction: null
|
|
803
|
+
},
|
|
804
|
+
maxlength: {
|
|
805
|
+
classPropertyName: "maxlength",
|
|
806
|
+
publicName: "maxlength",
|
|
807
|
+
isSignal: true,
|
|
808
|
+
isRequired: false,
|
|
809
|
+
transformFunction: null
|
|
810
|
+
},
|
|
811
|
+
showCount: {
|
|
812
|
+
classPropertyName: "showCount",
|
|
813
|
+
publicName: "showCount",
|
|
814
|
+
isSignal: true,
|
|
815
|
+
isRequired: false,
|
|
816
|
+
transformFunction: null
|
|
817
|
+
},
|
|
818
|
+
toolbarPosition: {
|
|
819
|
+
classPropertyName: "toolbarPosition",
|
|
820
|
+
publicName: "toolbarPosition",
|
|
821
|
+
isSignal: true,
|
|
822
|
+
isRequired: false,
|
|
823
|
+
transformFunction: null
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
outputs: {
|
|
827
|
+
valueChange: "valueChange",
|
|
828
|
+
editorFocus: "editorFocus",
|
|
829
|
+
editorBlur: "editorBlur",
|
|
830
|
+
selectionChange: "selectionChange"
|
|
831
|
+
},
|
|
832
|
+
providers: [{
|
|
833
|
+
provide: NG_VALUE_ACCESSOR,
|
|
834
|
+
useExisting: forwardRef(() => UiEditor),
|
|
835
|
+
multi: true
|
|
836
|
+
}],
|
|
837
|
+
viewQueries: [
|
|
838
|
+
{
|
|
839
|
+
propertyName: "contentEl",
|
|
840
|
+
first: true,
|
|
841
|
+
predicate: ["contentEl"],
|
|
842
|
+
descendants: true,
|
|
843
|
+
isSignal: true
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
propertyName: "toolbarEl",
|
|
847
|
+
first: true,
|
|
848
|
+
predicate: ["toolbarEl"],
|
|
849
|
+
descendants: true,
|
|
850
|
+
isSignal: true
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
propertyName: "textColorPicker",
|
|
854
|
+
first: true,
|
|
855
|
+
predicate: ["textColorPicker"],
|
|
856
|
+
descendants: true,
|
|
857
|
+
isSignal: true
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
propertyName: "highlightColorPicker",
|
|
861
|
+
first: true,
|
|
862
|
+
predicate: ["highlightColorPicker"],
|
|
863
|
+
descendants: true,
|
|
864
|
+
isSignal: true
|
|
865
|
+
}
|
|
866
|
+
],
|
|
867
|
+
usesInheritance: true,
|
|
868
|
+
ngImport: i0,
|
|
869
|
+
template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <div class=\"ui-editor\" [class._small]=\"size() === 'small'\" [style.--_rows]=\"minRows()\">\n @if (toolbarPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n\n <div class=\"ui-editor-area\">\n <div\n #contentEl\n class=\"ui-editor-content\"\n [class._small]=\"size() === 'small'\"\n [id]=\"resolvedId()\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.contenteditable]=\"isEditable() ? 'true' : 'false'\"\n [attr.tabindex]=\"isDisabled() ? -1 : (tabindex() ?? 0)\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (beforeinput)=\"onBeforeInput($any($event))\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onContentKeydown($event)\"\n (keyup)=\"refreshState()\"\n (mouseup)=\"refreshState()\"\n (focus)=\"editorFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></div>\n\n @if (showPlaceholder()) {\n <span class=\"ui-editor-placeholder\" aria-hidden=\"true\">{{ placeholder() }}</span>\n }\n </div>\n\n @if (toolbarPosition() === 'bottom') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n </div>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-editor-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n\n<ng-template #toolbarTpl>\n @if (hasToolbar()) {\n <!-- ARIA toolbar pattern: keyboard delegated to the role=\"toolbar\" container,\n focus lives on the items (roving tabindex), same as ui-menu. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #toolbarEl\n class=\"ui-editor-toolbar\"\n [class._bottom]=\"toolbarPosition() === 'bottom'\"\n role=\"toolbar\"\n aria-label=\"Mise en forme\"\n aria-orientation=\"horizontal\"\n (mousedown)=\"onToolbarMousedown($event)\"\n (keydown)=\"onToolbarKeydown($event)\"\n >\n @for (entry of toolbar(); track entry.index) {\n @if (entry.isSeparator) {\n <span class=\"ui-editor-toolbar-separator\" aria-hidden=\"true\"></span>\n } @else if (entry.select; as select) {\n <!-- The dropdown takes the focus, so the command restores the caret\n before it runs (see onSelectValueChange). -->\n <ui-select\n class=\"ui-editor-tool ui-editor-select\"\n size=\"small\"\n [options]=\"selectOptions(select)\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [ngModel]=\"selectValue(select)\"\n [ariaLabel]=\"selectLabel(select)\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n (valueChange)=\"onSelectValueChange(select, $event, entry.index)\"\n />\n } @else {\n <ui-button\n class=\"ui-editor-tool\"\n [class._colorTool]=\"\n entry.buttonTool === 'textColor' || entry.buttonTool === 'highlightColor'\n \"\n variant=\"ghost\"\n level=\"low\"\n size=\"small\"\n iconOnly\n [icon]=\"entry.meta!.icon\"\n [ariaLabel]=\"entry.meta!.label\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n [buttonProps]=\"toolProps(entry.buttonTool!)\"\n [style.--ui-editor-swatch-indicator-color]=\"colorIndicatorVar(entry.buttonTool)\"\n (buttonClick)=\"runTool(entry.buttonTool!, entry.index, $event)\"\n />\n }\n }\n\n <!-- `textColor`/`highlightColor` popups: no trigger of their own (same\n composition contract as `ui-menu`), opened via `runTool` ->\n `onColorToolClick` -> `toggle(event)`. -->\n <ui-swatch-picker\n #textColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentTextColor()\"\n ariaLabel=\"Couleur du texte\"\n (swatchSelect)=\"onTextColorSelect($event)\"\n (opened)=\"textColorPickerOpen.set(true)\"\n (closed)=\"textColorPickerOpen.set(false)\"\n />\n <ui-swatch-picker\n #highlightColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentHighlightColor()\"\n ariaLabel=\"Couleur de surlignage\"\n (swatchSelect)=\"onHighlightColorSelect($event)\"\n (opened)=\"highlightColorPickerOpen.set(true)\"\n (closed)=\"highlightColorPickerOpen.set(false)\"\n />\n </div>\n }\n</ng-template>\n",
|
|
870
|
+
styles: [".ui-editor{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;border-radius:var(--ui-editor-radius, inherit);overflow:hidden}.ui-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--ui-editor-toolbar-gap, var(--units-2xs));flex-shrink:0;padding:var(--ui-editor-toolbar-padding-y, var(--units-2xs)) var(--ui-editor-toolbar-padding-x, var(--units-xs));background-color:var(--ui-editor-toolbar-surface, var(--global-background-muted));border-block-end:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar._bottom{border-block-end:none;border-block-start:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar-separator{flex-shrink:0;inline-size:var(--ui-editor-separator-width, var(--stroke-sm));block-size:var(--ui-editor-separator-height, var(--size-typography-text-default));background-color:var(--ui-editor-separator-color, var(--form-low-stroke-default))}.ui-editor-select{display:inline-flex;flex-shrink:0;min-inline-size:var(--ui-editor-select-width, 13ch);--ui-field-stroke-width: 0}.ui-editor-select ::ng-deep .ui-select{inline-size:100%}.ui-editor-select ::ng-deep .ui-field-box{background:transparent;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-editor-select ::ng-deep .ui-field-box:hover{background-color:var(--ui-editor-toolbar-select-surface-hover, var(--form-low-surface-hover))}.ui-editor-tool._colorTool{position:relative}.ui-editor-tool._colorTool:after{content:\"\";position:absolute;inset-inline:var(--ui-editor-swatch-indicator-offset-x, var(--units-2xs));inset-block-end:0;block-size:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));border-radius:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));background-color:var(--ui-editor-swatch-indicator-color, transparent)}.ui-editor-area{position:relative;display:flex;flex:1 1 auto;min-height:0}.ui-editor-content{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-editor-content::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-editor-content:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-editor-content{box-sizing:border-box;width:100%;min-height:var(--ui-editor-min-height, calc(var(--_rows, 4) * var(--ui-editor-line-height, 1.5) * 1em));max-height:var(--ui-editor-max-height, none);padding:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default))) var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));overflow-y:auto;line-height:var(--ui-editor-line-height, 1.5);font-size:var(--ui-editor-font-size, var(--size-typography-text-default));overflow-wrap:break-word}.ui-editor-content._small{padding-block:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content:focus,.ui-editor-content:focus-visible{outline:none}.ui-editor-content[contenteditable=false]{cursor:default}.ui-editor-placeholder{position:absolute;inset-block-start:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default)));inset-inline-start:var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));line-height:var(--ui-editor-line-height, 1.5);font-family:var(--ui-editor-placeholder-font-family, var(--fontfamily-base));font-size:var(--ui-editor-font-size, var(--size-typography-text-default));color:var(--ui-editor-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-editor._small .ui-editor-placeholder{inset-block-start:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content ::ng-deep p{margin-block:0 var(--ui-editor-block-gap, var(--units-sm))}.ui-editor-content ::ng-deep p:last-child{margin-block-end:0}.ui-editor-content ::ng-deep ul,.ui-editor-content ::ng-deep ol{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding-inline-start:var(--ui-editor-list-padding-inline-start, var(--units-xl))}.ui-editor-content ::ng-deep ul:last-child,.ui-editor-content ::ng-deep ol:last-child{margin-block-end:0}.ui-editor-content ::ng-deep li+li{margin-block-start:var(--ui-editor-list-item-gap, var(--units-2xs))}.ui-editor-content ::ng-deep b,.ui-editor-content ::ng-deep strong{font-weight:var(--ui-editor-bold-weight, var(--weight-bold))}.ui-editor-content ::ng-deep a{color:var(--ui-editor-link-color, var(--global-text-brand));text-decoration:var(--ui-editor-link-text-decoration, underline)}.ui-editor-content ::ng-deep pre{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding:var(--ui-editor-code-padding-y, var(--units-sm)) var(--ui-editor-code-padding-x, var(--units-md));border-radius:var(--ui-editor-code-radius, var(--radius-xs));background-color:var(--ui-editor-code-surface, var(--global-background-muted));color:var(--ui-editor-code-color, var(--global-text-default));font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace));font-size:var(--ui-editor-code-font-size, var(--size-typography-text-md));white-space:pre-wrap;overflow-wrap:break-word}.ui-editor-content ::ng-deep pre:last-child{margin-block-end:0}.ui-editor-content ::ng-deep code{font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace))}.ui-editor-content ::ng-deep h1,.ui-editor-content ::ng-deep h2,.ui-editor-content ::ng-deep h3{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));font-family:var(--ui-editor-heading-font-family, var(--fontfamily-title));font-weight:var(--ui-editor-heading-weight, var(--weight-bold));line-height:var(--ui-editor-heading-line-height, 1.25)}.ui-editor-content ::ng-deep h1:last-child,.ui-editor-content ::ng-deep h2:last-child,.ui-editor-content ::ng-deep h3:last-child{margin-block-end:0}.ui-editor-content ::ng-deep h1{font-size:var(--ui-editor-heading-1-font-size, var(--size-typography-title-lg))}.ui-editor-content ::ng-deep h2{font-size:var(--ui-editor-heading-2-font-size, var(--size-typography-title-md))}.ui-editor-content ::ng-deep h3{font-size:var(--ui-editor-heading-3-font-size, var(--size-typography-title-sm))}.ui-editor-content ::ng-deep .ui-editor-font-base{font-family:var(--fontfamily-base)}.ui-editor-content ::ng-deep .ui-editor-font-title{font-family:var(--fontfamily-title)}.ui-editor-content ::ng-deep .ui-editor-font-monospace{font-family:var(--fontfamily-monospace)}.ui-editor-content ::ng-deep .ui-editor-size-sm{font-size:var(--ui-editor-size-sm-font-size, var(--size-typography-text-sm))}.ui-editor-content ::ng-deep .ui-editor-size-default{font-size:var(--ui-editor-size-default-font-size, var(--size-typography-text-default))}.ui-editor-content ::ng-deep .ui-editor-size-lg{font-size:var(--ui-editor-size-lg-font-size, var(--size-typography-text-lg))}.ui-editor-content ::ng-deep .ui-editor-size-xl{font-size:var(--ui-editor-size-xl-font-size, var(--size-typography-text-xl))}.ui-editor-content ::ng-deep .ui-editor-color-primary-900{color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-900{background-color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-color-primary-700{color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-700{background-color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-color-primary-500{color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-500{background-color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-color-primary-300{color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-300{background-color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-color-primary-100{color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-100{background-color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-900{color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-900{background-color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-700{color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-700{background-color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-500{color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-500{background-color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-300{color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-300{background-color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-100{color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-100{background-color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-color-green-900{color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-900{background-color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-color-green-700{color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-700{background-color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-color-green-500{color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-500{background-color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-color-green-300{color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-300{background-color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-color-green-100{color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-100{background-color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-color-orange-900{color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-900{background-color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-color-orange-700{color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-700{background-color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-color-orange-500{color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-500{background-color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-color-orange-300{color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-300{background-color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-color-orange-100{color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-100{background-color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-color-red-900{color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-900{background-color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-color-red-700{color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-700{background-color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-color-red-500{color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-500{background-color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-color-red-300{color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-300{background-color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-color-red-100{color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-100{background-color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-color-slate-900{color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-900{background-color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-color-slate-700{color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-700{background-color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-color-slate-500{color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-500{background-color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-color-slate-300{color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-300{background-color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-color-slate-100{color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-100{background-color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-color-grey-900{color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-900{background-color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-color-grey-700{color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-700{background-color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-color-grey-500{color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-500{background-color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-color-grey-300{color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-300{background-color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-color-grey-100{color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-100{background-color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-color-black{color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-color-white{color:var(--primitives-white-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-black{background-color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-white{background-color:var(--primitives-white-base)}.ui-editor-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-editor-count-font-family, var(--fontfamily-base));font-size:var(--ui-editor-count-font-size, var(--size-typography-text-md));color:var(--ui-editor-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-editor-count._small{font-size:var(--ui-editor-count-font-size-small, var(--size-typography-text-sm))}.ui-editor-count._over{color:var(--ui-editor-count-color-over, var(--form-error-content-default))}.ui-editor-count._disabled{color:var(--ui-editor-count-color-disabled, var(--form-high-content-disabled))}\n"],
|
|
871
|
+
dependencies: [
|
|
872
|
+
{
|
|
873
|
+
kind: "component",
|
|
874
|
+
type: UiField,
|
|
875
|
+
selector: "ui-field",
|
|
876
|
+
inputs: [
|
|
877
|
+
"label",
|
|
878
|
+
"for",
|
|
879
|
+
"required",
|
|
880
|
+
"size",
|
|
881
|
+
"level",
|
|
882
|
+
"floatLabel",
|
|
883
|
+
"filled",
|
|
884
|
+
"disabled",
|
|
885
|
+
"readonly",
|
|
886
|
+
"multiline",
|
|
887
|
+
"autoHeight",
|
|
888
|
+
"message",
|
|
889
|
+
"messageId",
|
|
890
|
+
"showMessageIcon",
|
|
891
|
+
"messageIcon",
|
|
892
|
+
"hasFooter",
|
|
893
|
+
"hasPrefix"
|
|
894
|
+
]
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
kind: "component",
|
|
898
|
+
type: UiButton,
|
|
899
|
+
selector: "ui-button",
|
|
900
|
+
inputs: [
|
|
901
|
+
"label",
|
|
902
|
+
"ariaLabel",
|
|
903
|
+
"type",
|
|
904
|
+
"level",
|
|
905
|
+
"variant",
|
|
906
|
+
"onColor",
|
|
907
|
+
"size",
|
|
908
|
+
"icon",
|
|
909
|
+
"iconPos",
|
|
910
|
+
"iconOnly",
|
|
911
|
+
"loading",
|
|
912
|
+
"loadingIcon",
|
|
913
|
+
"expanded",
|
|
914
|
+
"rounded",
|
|
915
|
+
"disabled",
|
|
916
|
+
"ripple",
|
|
917
|
+
"tabindex",
|
|
918
|
+
"buttonProps",
|
|
919
|
+
"iconTemplate",
|
|
920
|
+
"loadingIconTemplate",
|
|
921
|
+
"href",
|
|
922
|
+
"routerLink",
|
|
923
|
+
"target",
|
|
924
|
+
"rel"
|
|
925
|
+
],
|
|
926
|
+
outputs: [
|
|
927
|
+
"buttonClick",
|
|
928
|
+
"buttonFocus",
|
|
929
|
+
"buttonBlur"
|
|
930
|
+
]
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
kind: "component",
|
|
934
|
+
type: UiSwatchPicker,
|
|
935
|
+
selector: "ui-swatch-picker",
|
|
936
|
+
inputs: [
|
|
937
|
+
"palette",
|
|
938
|
+
"value",
|
|
939
|
+
"popup",
|
|
940
|
+
"size",
|
|
941
|
+
"allowClear",
|
|
942
|
+
"ariaLabel"
|
|
943
|
+
],
|
|
944
|
+
outputs: [
|
|
945
|
+
"valueChange",
|
|
946
|
+
"swatchSelect",
|
|
947
|
+
"opened",
|
|
948
|
+
"closed"
|
|
949
|
+
]
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
kind: "component",
|
|
953
|
+
type: UiSelect,
|
|
954
|
+
selector: "ui-select",
|
|
955
|
+
inputs: [
|
|
956
|
+
"options",
|
|
957
|
+
"optionLabel",
|
|
958
|
+
"optionValue",
|
|
959
|
+
"optionDisabled",
|
|
960
|
+
"group",
|
|
961
|
+
"optionGroupLabel",
|
|
962
|
+
"optionGroupChildren",
|
|
963
|
+
"dataKey",
|
|
964
|
+
"multiple",
|
|
965
|
+
"checkmark",
|
|
966
|
+
"checkbox",
|
|
967
|
+
"maxSelectedLabels",
|
|
968
|
+
"overflowLabel",
|
|
969
|
+
"placeholder",
|
|
970
|
+
"showClear",
|
|
971
|
+
"clearAriaLabel",
|
|
972
|
+
"icon",
|
|
973
|
+
"showIcon",
|
|
974
|
+
"filter",
|
|
975
|
+
"filterPlaceholder",
|
|
976
|
+
"filterAriaLabel",
|
|
977
|
+
"filterBy",
|
|
978
|
+
"autofocusFilter",
|
|
979
|
+
"resetFilterOnHide",
|
|
980
|
+
"ripple",
|
|
981
|
+
"emptyMessage",
|
|
982
|
+
"emptyFilterMessage",
|
|
983
|
+
"editable",
|
|
984
|
+
"loading",
|
|
985
|
+
"autoOptionFocus",
|
|
986
|
+
"selectOnFocus",
|
|
987
|
+
"focusOnHover",
|
|
988
|
+
"virtualScroll",
|
|
989
|
+
"virtualScrollItemSize",
|
|
990
|
+
"lazy",
|
|
991
|
+
"scrollHeight",
|
|
992
|
+
"autoFlip",
|
|
993
|
+
"panelStyleClass",
|
|
994
|
+
"panelWidth"
|
|
995
|
+
],
|
|
996
|
+
outputs: [
|
|
997
|
+
"valueChange",
|
|
998
|
+
"opened",
|
|
999
|
+
"closed",
|
|
1000
|
+
"cleared",
|
|
1001
|
+
"filterChange",
|
|
1002
|
+
"lazyLoad",
|
|
1003
|
+
"inputFocus",
|
|
1004
|
+
"inputBlur"
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
kind: "directive",
|
|
1009
|
+
type: NgTemplateOutlet,
|
|
1010
|
+
selector: "[ngTemplateOutlet]",
|
|
1011
|
+
inputs: [
|
|
1012
|
+
"ngTemplateOutletContext",
|
|
1013
|
+
"ngTemplateOutlet",
|
|
1014
|
+
"ngTemplateOutletInjector"
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
kind: "ngmodule",
|
|
1019
|
+
type: FormsModule
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
kind: "directive",
|
|
1023
|
+
type: i1.NgControlStatus,
|
|
1024
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
kind: "directive",
|
|
1028
|
+
type: i1.NgModel,
|
|
1029
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
1030
|
+
inputs: [
|
|
1031
|
+
"name",
|
|
1032
|
+
"disabled",
|
|
1033
|
+
"ngModel",
|
|
1034
|
+
"ngModelOptions"
|
|
1035
|
+
],
|
|
1036
|
+
outputs: ["ngModelChange"],
|
|
1037
|
+
exportAs: ["ngModel"]
|
|
1038
|
+
}
|
|
1039
|
+
]
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1044
|
+
minVersion: "12.0.0",
|
|
1045
|
+
version: "22.3.0",
|
|
1046
|
+
ngImport: i0,
|
|
1047
|
+
type: UiEditor,
|
|
1048
|
+
decorators: [{
|
|
1049
|
+
type: Component,
|
|
1050
|
+
args: [{
|
|
1051
|
+
selector: "ui-editor",
|
|
1052
|
+
imports: [
|
|
1053
|
+
UiField,
|
|
1054
|
+
UiButton,
|
|
1055
|
+
UiSwatchPicker,
|
|
1056
|
+
UiSelect,
|
|
1057
|
+
NgTemplateOutlet,
|
|
1058
|
+
FormsModule
|
|
1059
|
+
],
|
|
1060
|
+
providers: [{
|
|
1061
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1062
|
+
useExisting: forwardRef(() => UiEditor),
|
|
1063
|
+
multi: true
|
|
1064
|
+
}],
|
|
1065
|
+
template: "<ui-field\n multiline\n [label]=\"label()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <div class=\"ui-editor\" [class._small]=\"size() === 'small'\" [style.--_rows]=\"minRows()\">\n @if (toolbarPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n\n <div class=\"ui-editor-area\">\n <div\n #contentEl\n class=\"ui-editor-content\"\n [class._small]=\"size() === 'small'\"\n [id]=\"resolvedId()\"\n role=\"textbox\"\n aria-multiline=\"true\"\n [attr.contenteditable]=\"isEditable() ? 'true' : 'false'\"\n [attr.tabindex]=\"isDisabled() ? -1 : (tabindex() ?? 0)\"\n [attr.aria-label]=\"ariaLabel() || label() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n [attr.aria-disabled]=\"isDisabled() ? 'true' : null\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (beforeinput)=\"onBeforeInput($any($event))\"\n (paste)=\"onPaste($event)\"\n (keydown)=\"onContentKeydown($event)\"\n (keyup)=\"refreshState()\"\n (mouseup)=\"refreshState()\"\n (focus)=\"editorFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></div>\n\n @if (showPlaceholder()) {\n <span class=\"ui-editor-placeholder\" aria-hidden=\"true\">{{ placeholder() }}</span>\n }\n </div>\n\n @if (toolbarPosition() === 'bottom') {\n <ng-container [ngTemplateOutlet]=\"toolbarTpl\" />\n }\n </div>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-editor-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n / {{ max }}\n }\n </span>\n }\n</ui-field>\n\n<ng-template #toolbarTpl>\n @if (hasToolbar()) {\n <!-- ARIA toolbar pattern: keyboard delegated to the role=\"toolbar\" container,\n focus lives on the items (roving tabindex), same as ui-menu. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n #toolbarEl\n class=\"ui-editor-toolbar\"\n [class._bottom]=\"toolbarPosition() === 'bottom'\"\n role=\"toolbar\"\n aria-label=\"Mise en forme\"\n aria-orientation=\"horizontal\"\n (mousedown)=\"onToolbarMousedown($event)\"\n (keydown)=\"onToolbarKeydown($event)\"\n >\n @for (entry of toolbar(); track entry.index) {\n @if (entry.isSeparator) {\n <span class=\"ui-editor-toolbar-separator\" aria-hidden=\"true\"></span>\n } @else if (entry.select; as select) {\n <!-- The dropdown takes the focus, so the command restores the caret\n before it runs (see onSelectValueChange). -->\n <ui-select\n class=\"ui-editor-tool ui-editor-select\"\n size=\"small\"\n [options]=\"selectOptions(select)\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [ngModel]=\"selectValue(select)\"\n [ariaLabel]=\"selectLabel(select)\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n (valueChange)=\"onSelectValueChange(select, $event, entry.index)\"\n />\n } @else {\n <ui-button\n class=\"ui-editor-tool\"\n [class._colorTool]=\"\n entry.buttonTool === 'textColor' || entry.buttonTool === 'highlightColor'\n \"\n variant=\"ghost\"\n level=\"low\"\n size=\"small\"\n iconOnly\n [icon]=\"entry.meta!.icon\"\n [ariaLabel]=\"entry.meta!.label\"\n [disabled]=\"!isEditable()\"\n [tabindex]=\"entry.index === tabStop() ? 0 : -1\"\n [buttonProps]=\"toolProps(entry.buttonTool!)\"\n [style.--ui-editor-swatch-indicator-color]=\"colorIndicatorVar(entry.buttonTool)\"\n (buttonClick)=\"runTool(entry.buttonTool!, entry.index, $event)\"\n />\n }\n }\n\n <!-- `textColor`/`highlightColor` popups: no trigger of their own (same\n composition contract as `ui-menu`), opened via `runTool` ->\n `onColorToolClick` -> `toggle(event)`. -->\n <ui-swatch-picker\n #textColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentTextColor()\"\n ariaLabel=\"Couleur du texte\"\n (swatchSelect)=\"onTextColorSelect($event)\"\n (opened)=\"textColorPickerOpen.set(true)\"\n (closed)=\"textColorPickerOpen.set(false)\"\n />\n <ui-swatch-picker\n #highlightColorPicker\n popup\n size=\"small\"\n [allowClear]=\"true\"\n [value]=\"currentHighlightColor()\"\n ariaLabel=\"Couleur de surlignage\"\n (swatchSelect)=\"onHighlightColorSelect($event)\"\n (opened)=\"highlightColorPickerOpen.set(true)\"\n (closed)=\"highlightColorPickerOpen.set(false)\"\n />\n </div>\n }\n</ng-template>\n",
|
|
1066
|
+
styles: [".ui-editor{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;border-radius:var(--ui-editor-radius, inherit);overflow:hidden}.ui-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--ui-editor-toolbar-gap, var(--units-2xs));flex-shrink:0;padding:var(--ui-editor-toolbar-padding-y, var(--units-2xs)) var(--ui-editor-toolbar-padding-x, var(--units-xs));background-color:var(--ui-editor-toolbar-surface, var(--global-background-muted));border-block-end:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar._bottom{border-block-end:none;border-block-start:var(--ui-editor-toolbar-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-editor-toolbar-stroke, var(--form-low-stroke-default))}.ui-editor-toolbar-separator{flex-shrink:0;inline-size:var(--ui-editor-separator-width, var(--stroke-sm));block-size:var(--ui-editor-separator-height, var(--size-typography-text-default));background-color:var(--ui-editor-separator-color, var(--form-low-stroke-default))}.ui-editor-select{display:inline-flex;flex-shrink:0;min-inline-size:var(--ui-editor-select-width, 13ch);--ui-field-stroke-width: 0}.ui-editor-select ::ng-deep .ui-select{inline-size:100%}.ui-editor-select ::ng-deep .ui-field-box{background:transparent;transition:background-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-editor-select ::ng-deep .ui-field-box:hover{background-color:var(--ui-editor-toolbar-select-surface-hover, var(--form-low-surface-hover))}.ui-editor-tool._colorTool{position:relative}.ui-editor-tool._colorTool:after{content:\"\";position:absolute;inset-inline:var(--ui-editor-swatch-indicator-offset-x, var(--units-2xs));inset-block-end:0;block-size:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));border-radius:var(--ui-editor-swatch-indicator-height, var(--stroke-lg));background-color:var(--ui-editor-swatch-indicator-color, transparent)}.ui-editor-area{position:relative;display:flex;flex:1 1 auto;min-height:0}.ui-editor-content{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-editor-content::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-editor-content:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-editor-content{box-sizing:border-box;width:100%;min-height:var(--ui-editor-min-height, calc(var(--_rows, 4) * var(--ui-editor-line-height, 1.5) * 1em));max-height:var(--ui-editor-max-height, none);padding:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default))) var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));overflow-y:auto;line-height:var(--ui-editor-line-height, 1.5);font-size:var(--ui-editor-font-size, var(--size-typography-text-default));overflow-wrap:break-word}.ui-editor-content._small{padding-block:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content:focus,.ui-editor-content:focus-visible{outline:none}.ui-editor-content[contenteditable=false]{cursor:default}.ui-editor-placeholder{position:absolute;inset-block-start:var(--ui-editor-padding-y, var(--ui-form-textarea-padding-y, var(--units-default)));inset-inline-start:var(--ui-editor-padding-x, var(--ui-form-field-padding-x, var(--units-md)));line-height:var(--ui-editor-line-height, 1.5);font-family:var(--ui-editor-placeholder-font-family, var(--fontfamily-base));font-size:var(--ui-editor-font-size, var(--size-typography-text-default));color:var(--ui-editor-placeholder-color, var(--form-low-content-default));pointer-events:none;-webkit-user-select:none;user-select:none}.ui-editor._small .ui-editor-placeholder{inset-block-start:var(--ui-editor-padding-y-small, var(--ui-form-textarea-padding-y-small, var(--units-md)));font-size:var(--ui-editor-font-size-small, var(--size-typography-text-md))}.ui-editor-content ::ng-deep p{margin-block:0 var(--ui-editor-block-gap, var(--units-sm))}.ui-editor-content ::ng-deep p:last-child{margin-block-end:0}.ui-editor-content ::ng-deep ul,.ui-editor-content ::ng-deep ol{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding-inline-start:var(--ui-editor-list-padding-inline-start, var(--units-xl))}.ui-editor-content ::ng-deep ul:last-child,.ui-editor-content ::ng-deep ol:last-child{margin-block-end:0}.ui-editor-content ::ng-deep li+li{margin-block-start:var(--ui-editor-list-item-gap, var(--units-2xs))}.ui-editor-content ::ng-deep b,.ui-editor-content ::ng-deep strong{font-weight:var(--ui-editor-bold-weight, var(--weight-bold))}.ui-editor-content ::ng-deep a{color:var(--ui-editor-link-color, var(--global-text-brand));text-decoration:var(--ui-editor-link-text-decoration, underline)}.ui-editor-content ::ng-deep pre{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));padding:var(--ui-editor-code-padding-y, var(--units-sm)) var(--ui-editor-code-padding-x, var(--units-md));border-radius:var(--ui-editor-code-radius, var(--radius-xs));background-color:var(--ui-editor-code-surface, var(--global-background-muted));color:var(--ui-editor-code-color, var(--global-text-default));font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace));font-size:var(--ui-editor-code-font-size, var(--size-typography-text-md));white-space:pre-wrap;overflow-wrap:break-word}.ui-editor-content ::ng-deep pre:last-child{margin-block-end:0}.ui-editor-content ::ng-deep code{font-family:var(--ui-editor-code-font-family, var(--fontfamily-monospace))}.ui-editor-content ::ng-deep h1,.ui-editor-content ::ng-deep h2,.ui-editor-content ::ng-deep h3{margin-block:0 var(--ui-editor-block-gap, var(--units-sm));font-family:var(--ui-editor-heading-font-family, var(--fontfamily-title));font-weight:var(--ui-editor-heading-weight, var(--weight-bold));line-height:var(--ui-editor-heading-line-height, 1.25)}.ui-editor-content ::ng-deep h1:last-child,.ui-editor-content ::ng-deep h2:last-child,.ui-editor-content ::ng-deep h3:last-child{margin-block-end:0}.ui-editor-content ::ng-deep h1{font-size:var(--ui-editor-heading-1-font-size, var(--size-typography-title-lg))}.ui-editor-content ::ng-deep h2{font-size:var(--ui-editor-heading-2-font-size, var(--size-typography-title-md))}.ui-editor-content ::ng-deep h3{font-size:var(--ui-editor-heading-3-font-size, var(--size-typography-title-sm))}.ui-editor-content ::ng-deep .ui-editor-font-base{font-family:var(--fontfamily-base)}.ui-editor-content ::ng-deep .ui-editor-font-title{font-family:var(--fontfamily-title)}.ui-editor-content ::ng-deep .ui-editor-font-monospace{font-family:var(--fontfamily-monospace)}.ui-editor-content ::ng-deep .ui-editor-size-sm{font-size:var(--ui-editor-size-sm-font-size, var(--size-typography-text-sm))}.ui-editor-content ::ng-deep .ui-editor-size-default{font-size:var(--ui-editor-size-default-font-size, var(--size-typography-text-default))}.ui-editor-content ::ng-deep .ui-editor-size-lg{font-size:var(--ui-editor-size-lg-font-size, var(--size-typography-text-lg))}.ui-editor-content ::ng-deep .ui-editor-size-xl{font-size:var(--ui-editor-size-xl-font-size, var(--size-typography-text-xl))}.ui-editor-content ::ng-deep .ui-editor-color-primary-900{color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-900{background-color:var(--primitives-primary-900)}.ui-editor-content ::ng-deep .ui-editor-color-primary-700{color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-700{background-color:var(--primitives-primary-700)}.ui-editor-content ::ng-deep .ui-editor-color-primary-500{color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-500{background-color:var(--primitives-primary-500)}.ui-editor-content ::ng-deep .ui-editor-color-primary-300{color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-300{background-color:var(--primitives-primary-300)}.ui-editor-content ::ng-deep .ui-editor-color-primary-100{color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-primary-100{background-color:var(--primitives-primary-100)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-900{color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-900{background-color:var(--primitives-secondary-900)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-700{color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-700{background-color:var(--primitives-secondary-700)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-500{color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-500{background-color:var(--primitives-secondary-500)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-300{color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-300{background-color:var(--primitives-secondary-300)}.ui-editor-content ::ng-deep .ui-editor-color-secondary-100{color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-secondary-100{background-color:var(--primitives-secondary-100)}.ui-editor-content ::ng-deep .ui-editor-color-green-900{color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-900{background-color:var(--primitives-green-900)}.ui-editor-content ::ng-deep .ui-editor-color-green-700{color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-700{background-color:var(--primitives-green-700)}.ui-editor-content ::ng-deep .ui-editor-color-green-500{color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-500{background-color:var(--primitives-green-500)}.ui-editor-content ::ng-deep .ui-editor-color-green-300{color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-300{background-color:var(--primitives-green-300)}.ui-editor-content ::ng-deep .ui-editor-color-green-100{color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-green-100{background-color:var(--primitives-green-100)}.ui-editor-content ::ng-deep .ui-editor-color-orange-900{color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-900{background-color:var(--primitives-orange-900)}.ui-editor-content ::ng-deep .ui-editor-color-orange-700{color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-700{background-color:var(--primitives-orange-700)}.ui-editor-content ::ng-deep .ui-editor-color-orange-500{color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-500{background-color:var(--primitives-orange-500)}.ui-editor-content ::ng-deep .ui-editor-color-orange-300{color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-300{background-color:var(--primitives-orange-300)}.ui-editor-content ::ng-deep .ui-editor-color-orange-100{color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-orange-100{background-color:var(--primitives-orange-100)}.ui-editor-content ::ng-deep .ui-editor-color-red-900{color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-900{background-color:var(--primitives-red-900)}.ui-editor-content ::ng-deep .ui-editor-color-red-700{color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-700{background-color:var(--primitives-red-700)}.ui-editor-content ::ng-deep .ui-editor-color-red-500{color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-500{background-color:var(--primitives-red-500)}.ui-editor-content ::ng-deep .ui-editor-color-red-300{color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-300{background-color:var(--primitives-red-300)}.ui-editor-content ::ng-deep .ui-editor-color-red-100{color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-red-100{background-color:var(--primitives-red-100)}.ui-editor-content ::ng-deep .ui-editor-color-slate-900{color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-900{background-color:var(--primitives-slate-900)}.ui-editor-content ::ng-deep .ui-editor-color-slate-700{color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-700{background-color:var(--primitives-slate-700)}.ui-editor-content ::ng-deep .ui-editor-color-slate-500{color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-500{background-color:var(--primitives-slate-500)}.ui-editor-content ::ng-deep .ui-editor-color-slate-300{color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-300{background-color:var(--primitives-slate-300)}.ui-editor-content ::ng-deep .ui-editor-color-slate-100{color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-slate-100{background-color:var(--primitives-slate-100)}.ui-editor-content ::ng-deep .ui-editor-color-grey-900{color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-900{background-color:var(--primitives-grey-900)}.ui-editor-content ::ng-deep .ui-editor-color-grey-700{color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-700{background-color:var(--primitives-grey-700)}.ui-editor-content ::ng-deep .ui-editor-color-grey-500{color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-500{background-color:var(--primitives-grey-500)}.ui-editor-content ::ng-deep .ui-editor-color-grey-300{color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-300{background-color:var(--primitives-grey-300)}.ui-editor-content ::ng-deep .ui-editor-color-grey-100{color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-highlight-grey-100{background-color:var(--primitives-grey-100)}.ui-editor-content ::ng-deep .ui-editor-color-black{color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-color-white{color:var(--primitives-white-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-black{background-color:var(--primitives-black-base)}.ui-editor-content ::ng-deep .ui-editor-highlight-white{background-color:var(--primitives-white-base)}.ui-editor-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-editor-count-font-family, var(--fontfamily-base));font-size:var(--ui-editor-count-font-size, var(--size-typography-text-md));color:var(--ui-editor-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-editor-count._small{font-size:var(--ui-editor-count-font-size-small, var(--size-typography-text-sm))}.ui-editor-count._over{color:var(--ui-editor-count-color-over, var(--form-error-content-default))}.ui-editor-count._disabled{color:var(--ui-editor-count-color-disabled, var(--form-high-content-disabled))}\n"]
|
|
1067
|
+
}]
|
|
1068
|
+
}],
|
|
1069
|
+
ctorParameters: () => [],
|
|
1070
|
+
propDecorators: {
|
|
1071
|
+
tools: [{
|
|
1072
|
+
type: i0.Input,
|
|
1073
|
+
args: [{
|
|
1074
|
+
isSignal: true,
|
|
1075
|
+
alias: "tools",
|
|
1076
|
+
required: false
|
|
1077
|
+
}]
|
|
1078
|
+
}],
|
|
1079
|
+
placeholder: [{
|
|
1080
|
+
type: i0.Input,
|
|
1081
|
+
args: [{
|
|
1082
|
+
isSignal: true,
|
|
1083
|
+
alias: "placeholder",
|
|
1084
|
+
required: false
|
|
1085
|
+
}]
|
|
1086
|
+
}],
|
|
1087
|
+
minRows: [{
|
|
1088
|
+
type: i0.Input,
|
|
1089
|
+
args: [{
|
|
1090
|
+
isSignal: true,
|
|
1091
|
+
alias: "minRows",
|
|
1092
|
+
required: false
|
|
1093
|
+
}]
|
|
1094
|
+
}],
|
|
1095
|
+
maxlength: [{
|
|
1096
|
+
type: i0.Input,
|
|
1097
|
+
args: [{
|
|
1098
|
+
isSignal: true,
|
|
1099
|
+
alias: "maxlength",
|
|
1100
|
+
required: false
|
|
1101
|
+
}]
|
|
1102
|
+
}],
|
|
1103
|
+
showCount: [{
|
|
1104
|
+
type: i0.Input,
|
|
1105
|
+
args: [{
|
|
1106
|
+
isSignal: true,
|
|
1107
|
+
alias: "showCount",
|
|
1108
|
+
required: false
|
|
1109
|
+
}]
|
|
1110
|
+
}],
|
|
1111
|
+
toolbarPosition: [{
|
|
1112
|
+
type: i0.Input,
|
|
1113
|
+
args: [{
|
|
1114
|
+
isSignal: true,
|
|
1115
|
+
alias: "toolbarPosition",
|
|
1116
|
+
required: false
|
|
1117
|
+
}]
|
|
1118
|
+
}],
|
|
1119
|
+
valueChange: [{
|
|
1120
|
+
type: i0.Output,
|
|
1121
|
+
args: ["valueChange"]
|
|
1122
|
+
}],
|
|
1123
|
+
editorFocus: [{
|
|
1124
|
+
type: i0.Output,
|
|
1125
|
+
args: ["editorFocus"]
|
|
1126
|
+
}],
|
|
1127
|
+
editorBlur: [{
|
|
1128
|
+
type: i0.Output,
|
|
1129
|
+
args: ["editorBlur"]
|
|
1130
|
+
}],
|
|
1131
|
+
selectionChange: [{
|
|
1132
|
+
type: i0.Output,
|
|
1133
|
+
args: ["selectionChange"]
|
|
1134
|
+
}],
|
|
1135
|
+
contentEl: [{
|
|
1136
|
+
type: i0.ViewChild,
|
|
1137
|
+
args: ["contentEl", { isSignal: true }]
|
|
1138
|
+
}],
|
|
1139
|
+
toolbarEl: [{
|
|
1140
|
+
type: i0.ViewChild,
|
|
1141
|
+
args: ["toolbarEl", { isSignal: true }]
|
|
1142
|
+
}],
|
|
1143
|
+
textColorPicker: [{
|
|
1144
|
+
type: i0.ViewChild,
|
|
1145
|
+
args: ["textColorPicker", { isSignal: true }]
|
|
1146
|
+
}],
|
|
1147
|
+
highlightColorPicker: [{
|
|
1148
|
+
type: i0.ViewChild,
|
|
1149
|
+
args: ["highlightColorPicker", { isSignal: true }]
|
|
1150
|
+
}]
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1209
1153
|
export { DEFAULT_EDITOR_TOOLS, EDITOR_COLORS, EDITOR_FONTS, EDITOR_HIGHLIGHTS, EDITOR_SELECT_TOOLS, EDITOR_SIZES, EDITOR_TOOL_META, UiEditor, applyCommand, applyFontFamily, applyFontSize, applyHighlightColor, applyLink, applyTextColor, clearFormatMarkers, clearMarkerClass, convertColorMarkers, convertFontMarkers, convertHighlightMarkers, convertSizeMarkers, emptyEditorState, htmlToText, insertHtml, insertText, isEmptyHtml, isInCodeBlock, normalizeHtml, readEditorState, readFontFamily, readFontSize, readHighlightColor, readTextColor, removeLink, resolveFontLabel, sanitizeEditorHtml, sanitizeStyle, scrubInPlace, toggleCodeBlock };
|
|
1210
|
-
|
|
1154
|
+
|
|
1155
|
+
//# sourceMappingURL=4sh-ui-kit-forms-ui-editor.mjs.map
|