@aquera/nile-elements 1.9.4 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/index-5fef1a0d.esm.js +1 -0
- package/dist/index-8f38fae3.cjs.js +2 -0
- package/dist/index-8f38fae3.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1527 -804
- package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.css.esm.js +8 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/index.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.esm.js +1 -1
- package/dist/nile-command-menu/index.cjs.js +2 -0
- package/dist/nile-command-menu/index.cjs.js.map +1 -0
- package/dist/nile-command-menu/index.esm.js +1 -0
- package/dist/nile-command-menu/nile-command-menu.cjs.js +2 -0
- package/dist/nile-command-menu/nile-command-menu.cjs.js.map +1 -0
- package/dist/nile-command-menu/nile-command-menu.css.cjs.js +2 -0
- package/dist/nile-command-menu/nile-command-menu.css.cjs.js.map +1 -0
- package/dist/nile-command-menu/nile-command-menu.css.esm.js +182 -0
- package/dist/nile-command-menu/nile-command-menu.esm.js +97 -0
- package/dist/nile-command-menu-group/index.cjs.js +2 -0
- package/dist/nile-command-menu-group/index.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/index.esm.js +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js +2 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js +2 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.esm.js +33 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.esm.js +11 -0
- package/dist/nile-command-menu-item/index.cjs.js +2 -0
- package/dist/nile-command-menu-item/index.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/index.esm.js +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js +2 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js +2 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.esm.js +115 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.esm.js +21 -0
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/index.esm.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-dot-stepper/index.cjs.js +2 -0
- package/dist/nile-dot-stepper/index.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/index.esm.js +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js +2 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js +2 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.esm.js +77 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.esm.js +24 -0
- package/dist/nile-hero/nile-hero.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +14 -14
- package/dist/nile-hero/nile-hero.esm.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
- package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
- package/dist/nile-rich-text-editor/index.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
- package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
- package/dist/nile-section-message/nile-section-message.css.cjs.js +1 -1
- package/dist/nile-section-message/nile-section-message.css.cjs.js.map +1 -1
- package/dist/nile-section-message/nile-section-message.css.esm.js +7 -8
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-chip/nile-chip.css.js +8 -1
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-command-menu/index.d.ts +1 -0
- package/dist/src/nile-command-menu/index.js +2 -0
- package/dist/src/nile-command-menu/index.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.d.ts +12 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.js +194 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.d.ts +137 -0
- package/dist/src/nile-command-menu/nile-command-menu.js +557 -0
- package/dist/src/nile-command-menu/nile-command-menu.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.d.ts +3 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.js +268 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.js.map +1 -0
- package/dist/src/nile-command-menu-group/index.d.ts +1 -0
- package/dist/src/nile-command-menu-group/index.js +2 -0
- package/dist/src/nile-command-menu-group/index.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.d.ts +12 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js +45 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.d.ts +38 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.js +68 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.d.ts +2 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js +22 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js.map +1 -0
- package/dist/src/nile-command-menu-item/index.d.ts +1 -0
- package/dist/src/nile-command-menu-item/index.js +2 -0
- package/dist/src/nile-command-menu-item/index.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.d.ts +12 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js +127 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.d.ts +73 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.js +174 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.d.ts +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js +35 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js.map +1 -0
- package/dist/src/nile-dialog/nile-dialog.js +1 -1
- package/dist/src/nile-dialog/nile-dialog.js.map +1 -1
- package/dist/src/nile-dot-stepper/index.d.ts +1 -0
- package/dist/src/nile-dot-stepper/index.js +2 -0
- package/dist/src/nile-dot-stepper/index.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.d.ts +12 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js +89 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.d.ts +48 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.js +153 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.d.ts +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js +319 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js.map +1 -0
- package/dist/src/nile-hero/nile-hero.css.js +12 -12
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.js +1 -1
- package/dist/src/nile-hero/nile-hero.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
- package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
- package/dist/src/nile-section-message/nile-section-message.css.js +7 -8
- package/dist/src/nile-section-message/nile-section-message.css.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/index.ts +4 -0
- package/src/nile-chip/nile-chip.css.ts +8 -1
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-command-menu/index.ts +1 -0
- package/src/nile-command-menu/nile-command-menu.css.ts +196 -0
- package/src/nile-command-menu/nile-command-menu.test.ts +289 -0
- package/src/nile-command-menu/nile-command-menu.ts +601 -0
- package/src/nile-command-menu-group/index.ts +1 -0
- package/src/nile-command-menu-group/nile-command-menu-group.css.ts +47 -0
- package/src/nile-command-menu-group/nile-command-menu-group.test.ts +23 -0
- package/src/nile-command-menu-group/nile-command-menu-group.ts +72 -0
- package/src/nile-command-menu-item/index.ts +1 -0
- package/src/nile-command-menu-item/nile-command-menu-item.css.ts +129 -0
- package/src/nile-command-menu-item/nile-command-menu-item.test.ts +36 -0
- package/src/nile-command-menu-item/nile-command-menu-item.ts +172 -0
- package/src/nile-dialog/nile-dialog.ts +1 -1
- package/src/nile-dot-stepper/index.ts +1 -0
- package/src/nile-dot-stepper/nile-dot-stepper.css.ts +90 -0
- package/src/nile-dot-stepper/nile-dot-stepper.test.ts +493 -0
- package/src/nile-dot-stepper/nile-dot-stepper.ts +159 -0
- package/src/nile-hero/nile-hero.css.ts +12 -12
- package/src/nile-hero/nile-hero.ts +1 -1
- package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
- package/src/nile-hero-header/nile-hero-header.ts +1 -1
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
- package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
- package/src/nile-section-message/nile-section-message.css.ts +7 -8
- package/stories/dot-stepper.stories.ts +67 -0
- package/vscode-html-custom-data.json +220 -1
- package/dist/index-c0b5232c.cjs.js +0 -2
- package/dist/index-c0b5232c.cjs.js.map +0 -1
- package/dist/index-e43a18eb.esm.js +0 -1
|
@@ -37,12 +37,12 @@ export const styles = css`
|
|
|
37
37
|
|
|
38
38
|
.hero__container--collapsed{
|
|
39
39
|
height: 67px;
|
|
40
|
-
background-color: var(--nile-hero-collapsed-background);
|
|
40
|
+
background-color: var(--nile-hero-collapsed-background, var(--ng-colors-bg-primary));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.hero__container--expanded{
|
|
44
|
-
height:var(--nile-hero-height);
|
|
45
|
-
background:linear-gradient(180deg, var( --nile-hero-color-bg-from-gradient) 0%, var( --nile-hero-color-bg-to-gradient) 100%);
|
|
44
|
+
height:var(--nile-hero-height, var(--ng-height-200px));
|
|
45
|
+
background:linear-gradient(180deg, var( --nile-hero-color-bg-from-gradient, var(--ng-color-bluelight-50)) 0%, var( --nile-hero-color-bg-to-gradient, var(--ng-componentcolors-utility-gray-200)) 100%);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.icon__container {
|
|
@@ -50,17 +50,17 @@ export const styles = css`
|
|
|
50
50
|
aspect-ratio: 1 / 1;
|
|
51
51
|
place-items: center;
|
|
52
52
|
display: grid;
|
|
53
|
-
border-radius: var(--nile-radius-radius-xl);
|
|
54
|
-
border: 1px solid var(--nile-colors-neutral-400);
|
|
55
|
-
background: linear-gradient(180deg, var(--nile-hero-color-icon-bg-from-gradient) 0%, var(--nile-hero-color-icon-bg-to-gradient) 100%);
|
|
53
|
+
border-radius: var(--nile-radius-radius-xl, var(--ng-radius-md));
|
|
54
|
+
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
55
|
+
background: linear-gradient(180deg, var(--nile-hero-color-icon-bg-from-gradient, var(--ng-colors-bg-primary)) 0%, var(--nile-hero-color-icon-bg-to-gradient, var(--ng-colors-bg-secondary)) 100%);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.hero__slot__container {
|
|
59
|
-
height:var(--nile-hero-height);
|
|
60
|
-
padding-left: var(--nile-spacing-5xl);
|
|
59
|
+
height:var(--nile-hero-height, var(--ng-height-200px));
|
|
60
|
+
padding-left: var(--nile-spacing-5xl, var(--ng-spacing-5xl));
|
|
61
61
|
display: flex;
|
|
62
62
|
align-items: center;
|
|
63
|
-
gap:var(--nile-spacing-spacing-xl);
|
|
63
|
+
gap:var(--nile-spacing-spacing-xl, var(--ng-spacing-xl));
|
|
64
64
|
position: absolute;
|
|
65
65
|
left: 0;
|
|
66
66
|
bottom:0;
|
|
@@ -69,11 +69,11 @@ export const styles = css`
|
|
|
69
69
|
|
|
70
70
|
.hero__slot {
|
|
71
71
|
display: flex;
|
|
72
|
-
gap:var(--nile-spacing-spacing-xl);
|
|
72
|
+
gap:var(--nile-spacing-spacing-xl, var(--ng-spacing-xl));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.hero__img__container {
|
|
76
|
-
height:var(--nile-hero-height);
|
|
76
|
+
height:var(--nile-hero-height, var(--ng-height-200px));
|
|
77
77
|
overflow:hidden;
|
|
78
78
|
width:max-content;
|
|
79
79
|
position: absolute;
|
|
@@ -84,7 +84,7 @@ export const styles = css`
|
|
|
84
84
|
|
|
85
85
|
.hero__img {
|
|
86
86
|
object-fit:cover;
|
|
87
|
-
height:var(--nile-hero-height);
|
|
87
|
+
height:var(--nile-hero-height, var(--ng-height-200px));
|
|
88
88
|
width:auto;
|
|
89
89
|
}
|
|
90
90
|
`;
|
|
@@ -52,7 +52,7 @@ export class NileHero extends NileElement {
|
|
|
52
52
|
<div class="hero__slot__container" style="opacity:${this.collapse?0:1}">
|
|
53
53
|
<div class="hero__slot">
|
|
54
54
|
<span class="icon__container">
|
|
55
|
-
<nile-icon size="16" method="var(--nile-svg-method-stroke, var(--ng-svg-method-
|
|
55
|
+
<nile-icon size="16" method="var(--nile-svg-method-stroke, var(--ng-svg-method-fill))" name="${this.icon}"></nile-icon>
|
|
56
56
|
</span>
|
|
57
57
|
<slot></slot>
|
|
58
58
|
</div>
|
|
@@ -16,8 +16,8 @@ export const styles = css`
|
|
|
16
16
|
width:100%;
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
|
-
padding:var(--nile-spacing-xl) var(--nile-spacing-5xl);
|
|
20
|
-
gap: var(--nile-spacing-xl);
|
|
19
|
+
padding:var(--nile-spacing-xl, var(--ng-spacing-xl)) var(--nile-spacing-5xl, var(--ng-spacing-5xl));
|
|
20
|
+
gap: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
21
21
|
border-bottom: 1px solid rgb(234, 236, 240);
|
|
22
22
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
23
23
|
-moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));
|
|
@@ -29,17 +29,17 @@ export const styles = css`
|
|
|
29
29
|
aspect-ratio: 1 / 1;
|
|
30
30
|
place-items: center;
|
|
31
31
|
display: grid;
|
|
32
|
-
border-radius: var(--nile-radius-radius-xl);
|
|
33
|
-
border: 1px solid var(--nile-colors-neutral-400);
|
|
34
|
-
background: linear-gradient(180deg, var(--nile-hero-color-icon-bg-from-gradient) 0%, var(--nile-hero-color-icon-bg-to-gradient) 100%);
|
|
32
|
+
border-radius: var(--nile-radius-radius-xl, var(--ng-radius-md));
|
|
33
|
+
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
34
|
+
background: linear-gradient(180deg, var(--nile-hero-color-icon-bg-from-gradient, var(--ng-colors-bg-primary)) 0%, var(--nile-hero-color-icon-bg-to-gradient, var(--ng-colors-bg-secondary)) 100%);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.hero__text {
|
|
38
|
-
color: var(--nile-hero-text-color);
|
|
39
|
-
font-size: var(--nile-hero-text-font-size);
|
|
40
|
-
line-height: var(--nile-hero-text-line-height);
|
|
38
|
+
color: var(--nile-hero-text-color, var(--ng-colors-text-primary-900));
|
|
39
|
+
font-size: var(--nile-hero-text-font-size, var(--ng-font-size-text-md));
|
|
40
|
+
line-height: var(--nile-hero-text-line-height, var(--ng-line-height-text-md));
|
|
41
41
|
font-style: normal;
|
|
42
|
-
font-weight: var(--nile-hero-text-font-weight);
|
|
42
|
+
font-weight: var(--nile-hero-text-font-weight, var(--ng-font-weight-bold));
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
|
|
@@ -41,7 +41,7 @@ export class NileHeroHeader extends NileElement {
|
|
|
41
41
|
public render(): TemplateResult {
|
|
42
42
|
return html`
|
|
43
43
|
<span class="icon__container">
|
|
44
|
-
<nile-icon method="var(--nile-svg-method-stroke, var(--ng-svg-method-
|
|
44
|
+
<nile-icon method="var(--nile-svg-method-stroke, var(--ng-svg-method-fill))" size="16" name="${this.icon}"></nile-icon>
|
|
45
45
|
</span>
|
|
46
46
|
<span class="hero__text">${this.heroText}</span>
|
|
47
47
|
`;
|
|
@@ -201,6 +201,76 @@ nile-rich-text-editor[disabled] .editor a {
|
|
|
201
201
|
pointer-events: none;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
.editor figure.rte-image,
|
|
205
|
+
nile-rte-preview figure.rte-image {
|
|
206
|
+
margin: 1em 0;
|
|
207
|
+
width: fit-content;
|
|
208
|
+
max-width: 100%;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.editor > figure.rte-image:first-child,
|
|
212
|
+
nile-rte-preview > figure.rte-image:first-child {
|
|
213
|
+
margin-top: 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.editor figure.rte-image[data-align='center'],
|
|
217
|
+
nile-rte-preview figure.rte-image[data-align='center'] {
|
|
218
|
+
margin-left: auto;
|
|
219
|
+
margin-right: auto;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.editor figure.rte-image[data-align='right'],
|
|
223
|
+
nile-rte-preview figure.rte-image[data-align='right'] {
|
|
224
|
+
margin-left: auto;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.editor figure.rte-image[data-align='justify'],
|
|
228
|
+
nile-rte-preview figure.rte-image[data-align='justify'] {
|
|
229
|
+
width: 100%;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.editor figure.rte-image[data-align='justify'] img,
|
|
233
|
+
nile-rte-preview figure.rte-image[data-align='justify'] img {
|
|
234
|
+
width: 100%;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.editor figure.rte-image img,
|
|
238
|
+
nile-rte-preview figure.rte-image img {
|
|
239
|
+
max-width: 100%;
|
|
240
|
+
height: auto;
|
|
241
|
+
display: block;
|
|
242
|
+
border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.editor figure.rte-image figcaption,
|
|
246
|
+
nile-rte-preview figure.rte-image figcaption {
|
|
247
|
+
margin-top: 6px;
|
|
248
|
+
font-size: 0.875em;
|
|
249
|
+
color: var(--nile-colors-neutral-600, var(--ng-colors-text-secondary));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.editor figure.rte-image {
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.editor figure.rte-image:hover img {
|
|
257
|
+
outline: 2px solid var(--nile-colors-primary-400, var(--ng-componentcolors-utility-blue-400));
|
|
258
|
+
outline-offset: 2px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
nile-rte-image nile-button.rte-image-button[data-active]::part(base) {
|
|
262
|
+
background-color: var(--nile-colors-primary-400, var(--ng-componentcolors-utility-blue-400));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
nile-rte-image nile-button.rte-image-button[data-active]::part(base):hover {
|
|
266
|
+
background-color: var(--nile-colors-primary-500, var(--ng-componentcolors-utility-blue-500));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
nile-rich-text-editor[disabled] .editor figure.rte-image {
|
|
270
|
+
cursor: not-allowed;
|
|
271
|
+
pointer-events: none;
|
|
272
|
+
}
|
|
273
|
+
|
|
204
274
|
.editor.empty::before {
|
|
205
275
|
content: attr(data-placeholder);
|
|
206
276
|
color: var(--nile-colors-neutral-500, var(--ng-colors-text-secondary));
|
|
@@ -9,6 +9,7 @@ import './nile-rte-divider';
|
|
|
9
9
|
import './nile-rte-preview';
|
|
10
10
|
import './nile-rte-mentions';
|
|
11
11
|
import './nile-rte-link';
|
|
12
|
+
import './nile-rte-image';
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
closestBlock,
|
|
@@ -135,6 +136,7 @@ export class NileRichTextEditor extends LitElement {
|
|
|
135
136
|
private bgSwatchEl: HTMLElement | null = null;
|
|
136
137
|
private containerEl: HTMLElement | null = null;
|
|
137
138
|
private linkEl: HTMLElement | null = null;
|
|
139
|
+
private imageEl: HTMLElement | null = null;
|
|
138
140
|
|
|
139
141
|
private mentionsEl: HTMLElement | null = null;
|
|
140
142
|
|
|
@@ -265,6 +267,9 @@ export class NileRichTextEditor extends LitElement {
|
|
|
265
267
|
if (this.linkEl) {
|
|
266
268
|
(this.linkEl as any).disabled = this.disabled;
|
|
267
269
|
}
|
|
270
|
+
if (this.imageEl) {
|
|
271
|
+
(this.imageEl as any).disabled = this.disabled;
|
|
272
|
+
}
|
|
268
273
|
}
|
|
269
274
|
if (changed.has('placeholder') && this.editorEl) {
|
|
270
275
|
if (this.placeholder) {
|
|
@@ -418,6 +423,13 @@ export class NileRichTextEditor extends LitElement {
|
|
|
418
423
|
this.updateToolbarState();
|
|
419
424
|
}
|
|
420
425
|
|
|
426
|
+
if (
|
|
427
|
+
(e.key === 'Backspace' || e.key === 'Delete') &&
|
|
428
|
+
this.handleFigureDeletion(e)
|
|
429
|
+
) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
421
433
|
if (this.singleLineEditor && e.key === 'Enter') {
|
|
422
434
|
e.preventDefault();
|
|
423
435
|
return;
|
|
@@ -465,6 +477,61 @@ export class NileRichTextEditor extends LitElement {
|
|
|
465
477
|
this.updateContent();
|
|
466
478
|
this.updateToolbarState();
|
|
467
479
|
};
|
|
480
|
+
private handleFigureDeletion(e: KeyboardEvent): boolean {
|
|
481
|
+
const sel = window.getSelection();
|
|
482
|
+
if (!sel || sel.rangeCount === 0) return false;
|
|
483
|
+
const range = sel.getRangeAt(0);
|
|
484
|
+
if (!this.editorEl.contains(range.commonAncestorContainer)) return false;
|
|
485
|
+
|
|
486
|
+
if (!range.collapsed) {
|
|
487
|
+
const figures = Array.from(
|
|
488
|
+
this.editorEl.querySelectorAll('figure.rte-image')
|
|
489
|
+
);
|
|
490
|
+
const touched = figures.filter(f => range.intersectsNode(f));
|
|
491
|
+
if (!touched.length) return false;
|
|
492
|
+
|
|
493
|
+
e.preventDefault();
|
|
494
|
+
range.deleteContents();
|
|
495
|
+
touched.forEach(f => f.isConnected && f.remove());
|
|
496
|
+
this.ensureAtLeastOneParagraph();
|
|
497
|
+
this.updateContent();
|
|
498
|
+
this.updateToolbarState();
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
const block =
|
|
503
|
+
closestBlock(range.startContainer, this.editorEl) || this.editorEl;
|
|
504
|
+
|
|
505
|
+
if (e.key === 'Backspace') {
|
|
506
|
+
const before = document.createRange();
|
|
507
|
+
before.setStart(block, 0);
|
|
508
|
+
before.setEnd(range.startContainer, range.startOffset);
|
|
509
|
+
const atStart = before.toString().replace(/\u200B/g, '') === '';
|
|
510
|
+
const prev = block.previousElementSibling;
|
|
511
|
+
if (atStart && prev?.matches?.('figure.rte-image')) {
|
|
512
|
+
e.preventDefault();
|
|
513
|
+
prev.remove();
|
|
514
|
+
this.updateContent();
|
|
515
|
+
this.updateToolbarState();
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
} else {
|
|
519
|
+
const after = document.createRange();
|
|
520
|
+
after.setStart(range.endContainer, range.endOffset);
|
|
521
|
+
after.setEnd(block, block.childNodes.length);
|
|
522
|
+
const atEnd = after.toString().replace(/\u200B/g, '') === '';
|
|
523
|
+
const next = block.nextElementSibling;
|
|
524
|
+
if (atEnd && next?.matches?.('figure.rte-image')) {
|
|
525
|
+
e.preventDefault();
|
|
526
|
+
next.remove();
|
|
527
|
+
this.updateContent();
|
|
528
|
+
this.updateToolbarState();
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
468
535
|
|
|
469
536
|
private wireAuthoredToolbar(tb: HTMLElement) {
|
|
470
537
|
this.buttonMap.clear();
|
|
@@ -496,6 +563,16 @@ export class NileRichTextEditor extends LitElement {
|
|
|
496
563
|
});
|
|
497
564
|
return;
|
|
498
565
|
}
|
|
566
|
+
if (tag === 'nile-rte-image') {
|
|
567
|
+
(child as any).editorEl = this.editorEl;
|
|
568
|
+
(child as any).disabled = this.disabled;
|
|
569
|
+
this.imageEl = child as HTMLElement;
|
|
570
|
+
child.addEventListener('nile-image-changed', () => {
|
|
571
|
+
this.updateContent();
|
|
572
|
+
this.updateToolbarState();
|
|
573
|
+
});
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
499
576
|
|
|
500
577
|
if (tag === 'nile-rte-toolbar-item') {
|
|
501
578
|
let btn = child.querySelector(
|
|
@@ -666,7 +743,8 @@ export class NileRichTextEditor extends LitElement {
|
|
|
666
743
|
if (!el) return;
|
|
667
744
|
|
|
668
745
|
const onlyWhitespace =
|
|
669
|
-
(el.textContent ?? '').replace(/\u200B/g, '').trim() === ''
|
|
746
|
+
(el.textContent ?? '').replace(/\u200B/g, '').trim() === '' &&
|
|
747
|
+
!el.querySelector('img');
|
|
670
748
|
if (el.childNodes.length === 0 || onlyWhitespace) {
|
|
671
749
|
el.innerHTML = '<p><br></p>';
|
|
672
750
|
const p = el.querySelector('p');
|
|
@@ -684,7 +762,7 @@ export class NileRichTextEditor extends LitElement {
|
|
|
684
762
|
}
|
|
685
763
|
|
|
686
764
|
const hasBlock = el.querySelector(
|
|
687
|
-
'p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre'
|
|
765
|
+
'p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre,figure'
|
|
688
766
|
);
|
|
689
767
|
if (!hasBlock) {
|
|
690
768
|
const p = document.createElement('p');
|
|
@@ -849,6 +927,12 @@ export class NileRichTextEditor extends LitElement {
|
|
|
849
927
|
if (linkBtn) linkBtn.toggleAttribute('data-active', inLink);
|
|
850
928
|
}
|
|
851
929
|
|
|
930
|
+
if (this.imageEl) {
|
|
931
|
+
const inImage = !!startElm.closest('figure.rte-image');
|
|
932
|
+
const imageBtn = this.imageEl.querySelector('nile-button');
|
|
933
|
+
if (imageBtn) imageBtn.toggleAttribute('data-active', inImage);
|
|
934
|
+
}
|
|
935
|
+
|
|
852
936
|
this.setBtnActive(
|
|
853
937
|
'left',
|
|
854
938
|
alignNorm === 'left' &&
|
|
@@ -928,7 +1012,9 @@ export class NileRichTextEditor extends LitElement {
|
|
|
928
1012
|
private updateContent() {
|
|
929
1013
|
if (!this.editorEl) return;
|
|
930
1014
|
this.ensureAtLeastOneParagraph();
|
|
931
|
-
const isEmpty =
|
|
1015
|
+
const isEmpty =
|
|
1016
|
+
(this.editorEl.textContent ?? '').trim() === '' &&
|
|
1017
|
+
!this.editorEl.querySelector('img');
|
|
932
1018
|
this.editorEl.classList.toggle('empty', isEmpty);
|
|
933
1019
|
|
|
934
1020
|
const sel = window.getSelection();
|