@lukso/web-components 1.160.4 → 1.161.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +7 -5
- package/dist/components/index.js +5 -5
- package/dist/components/lukso-button/index.cjs +3 -3
- package/dist/components/lukso-button/index.js +3 -3
- package/dist/components/lukso-card/index.cjs +6 -6
- package/dist/components/lukso-card/index.js +6 -6
- package/dist/components/lukso-checkbox/index.cjs +3 -3
- package/dist/components/lukso-checkbox/index.js +3 -3
- package/dist/components/lukso-collapse/index.cjs +3 -3
- package/dist/components/lukso-collapse/index.js +3 -3
- package/dist/components/lukso-color-picker/index.cjs +5 -5
- package/dist/components/lukso-color-picker/index.js +5 -5
- package/dist/components/lukso-dropdown/index.cjs +4 -4
- package/dist/components/lukso-dropdown/index.js +4 -4
- package/dist/components/lukso-dropdown-option/index.cjs +2 -2
- package/dist/components/lukso-dropdown-option/index.js +2 -2
- package/dist/components/lukso-footer/index.cjs +3 -2
- package/dist/components/lukso-footer/index.d.ts.map +1 -1
- package/dist/components/lukso-footer/index.js +3 -2
- package/dist/components/lukso-icon/index.cjs +4 -4
- package/dist/components/lukso-icon/index.js +4 -4
- package/dist/components/lukso-image/index.cjs +4 -4
- package/dist/components/lukso-image/index.js +4 -4
- package/dist/components/lukso-input/index.cjs +4 -4
- package/dist/components/lukso-input/index.js +4 -4
- package/dist/components/lukso-markdown/index.cjs +13 -5
- package/dist/components/lukso-markdown/index.d.ts +1 -0
- package/dist/components/lukso-markdown/index.d.ts.map +1 -1
- package/dist/components/lukso-markdown/index.js +13 -5
- package/dist/components/lukso-markdown/lukso-markdown.stories.d.ts +2 -0
- package/dist/components/lukso-markdown/lukso-markdown.stories.d.ts.map +1 -1
- package/dist/components/lukso-markdown-editor/index.cjs +334 -255
- package/dist/components/lukso-markdown-editor/index.d.ts +9 -1
- package/dist/components/lukso-markdown-editor/index.d.ts.map +1 -1
- package/dist/components/lukso-markdown-editor/index.js +334 -255
- package/dist/components/lukso-markdown-editor/lukso-markdown-editor.stories.d.ts +6 -0
- package/dist/components/lukso-markdown-editor/lukso-markdown-editor.stories.d.ts.map +1 -1
- package/dist/components/lukso-modal/index.cjs +2 -2
- package/dist/components/lukso-modal/index.js +2 -2
- package/dist/components/lukso-navbar/index.cjs +3 -3
- package/dist/components/lukso-navbar/index.js +3 -3
- package/dist/components/lukso-pagination/index.cjs +3 -3
- package/dist/components/lukso-pagination/index.js +3 -3
- package/dist/components/lukso-profile/index.cjs +3 -3
- package/dist/components/lukso-profile/index.js +3 -3
- package/dist/components/lukso-progress/index.cjs +3 -3
- package/dist/components/lukso-progress/index.js +3 -3
- package/dist/components/lukso-radio/index.cjs +3 -3
- package/dist/components/lukso-radio/index.js +3 -3
- package/dist/components/lukso-radio-group/index.cjs +3 -3
- package/dist/components/lukso-radio-group/index.js +3 -3
- package/dist/components/lukso-sanitize/index.cjs +9 -1390
- package/dist/components/lukso-sanitize/index.d.ts +17 -1
- package/dist/components/lukso-sanitize/index.d.ts.map +1 -1
- package/dist/components/lukso-sanitize/index.js +4 -1396
- package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts +17 -1
- package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts.map +1 -1
- package/dist/components/lukso-search/index.cjs +6 -6
- package/dist/components/lukso-search/index.js +6 -6
- package/dist/components/lukso-select/index.cjs +6 -6
- package/dist/components/lukso-select/index.js +6 -6
- package/dist/components/lukso-share/index.cjs +2 -2
- package/dist/components/lukso-share/index.js +2 -2
- package/dist/components/lukso-switch/index.cjs +4 -4
- package/dist/components/lukso-switch/index.js +4 -4
- package/dist/components/lukso-tag/index.cjs +3 -3
- package/dist/components/lukso-tag/index.js +3 -3
- package/dist/components/lukso-terms/index.cjs +4 -4
- package/dist/components/lukso-terms/index.js +4 -4
- package/dist/components/lukso-textarea/index.cjs +4 -4
- package/dist/components/lukso-textarea/index.js +4 -4
- package/dist/components/lukso-tooltip/index.cjs +4 -4
- package/dist/components/lukso-tooltip/index.js +4 -4
- package/dist/components/lukso-username/index.cjs +4 -4
- package/dist/components/lukso-username/index.js +4 -4
- package/dist/components/lukso-wizard/index.cjs +2 -2
- package/dist/components/lukso-wizard/index.js +2 -2
- package/dist/{index-DNhzT2hA.cjs → index-BDC9pVk6.cjs} +2 -2
- package/dist/index-BFqOU6o6.cjs +50 -0
- package/dist/{index-NKnet_Ow.js → index-BJwLob67.js} +2 -2
- package/dist/{index-CKlH1beR.js → index-BOWftFAY.js} +1 -1
- package/dist/{index-CKjNXRek.cjs → index-C2uvRzO4.cjs} +3 -3
- package/dist/{index-C1JF-hTl.cjs → index-CEnG_x_7.cjs} +5 -5
- package/dist/index-CQq_Eyeu.js +41 -0
- package/dist/index-Chl2HHJ6.cjs +1408 -0
- package/dist/index-JvkSiEeQ.js +1404 -0
- package/dist/{index-C9Ins46B.cjs → index-Zriuvita.cjs} +1 -1
- package/dist/{index-BSwFyDEC.js → index-f-xajtU2.js} +3 -3
- package/dist/{index-CDUQ0-Uh.js → index-oQecUOlb.js} +5 -5
- package/dist/index.cjs +7 -5
- package/dist/index.js +5 -5
- package/dist/{property-Da9lvmME.js → property-CPkYmAYi.js} +1 -1
- package/dist/{property-dUn0JQiG.cjs → property-Cs8qVdri.cjs} +1 -1
- package/dist/shared/tailwind-element/index.cjs +1 -1
- package/dist/shared/tailwind-element/index.js +1 -1
- package/dist/{state-CD8hXUlY.cjs → state-Bh6EXopE.cjs} +1 -1
- package/dist/{state-CtpsBPdH.js → state-CtrTo6cC.js} +1 -1
- package/dist/{style-map-CDCcO0mt.js → style-map-BBz25umN.js} +1 -1
- package/dist/{style-map-nBexjTCa.cjs → style-map-DhbNG03r.cjs} +1 -1
- package/dist/tailwind-config.cjs +65 -0
- package/dist/tailwind-config.d.ts +85 -0
- package/dist/tailwind-config.d.ts.map +1 -1
- package/dist/tailwind-config.js +64 -1
- package/dist/{unsafe-html-DHNeIs-4.cjs → unsafe-html-Cb1yjpJn.cjs} +1 -1
- package/dist/{unsafe-html-Ci4jmi7b.js → unsafe-html-DTE5r2A7.js} +1 -1
- package/package.json +1 -1
- package/tailwind.config.cjs +208 -178
- package/tools/cn.cjs +1 -1
- package/tools/cn.js +1 -1
- package/tools/copy-assets.cjs +16 -16
- package/tools/copy-assets.js +2 -2
- package/tools/index.cjs +1 -1
- package/tools/index.js +1 -1
- package/tools/{tailwind-config-Ch2-b3Be.js → tailwind-config-DVTyRd7x.js} +64 -1
- package/tools/{tailwind-config-BIErjaAT.cjs → tailwind-config-DoMZEvsr.cjs} +65 -0
- package/tools/tailwind-config.cjs +3 -1
- package/tools/tailwind-config.d.ts +85 -0
- package/tools/tailwind-config.d.ts.map +1 -1
- package/tools/tailwind-config.js +1 -1
- package/dist/index-B5CXCi6j.js +0 -41
- package/dist/index-D4DEFira.cjs +0 -50
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as TailwindStyledElement, E, x } from '../../index-
|
|
2
|
-
import { n, t } from '../../property-
|
|
3
|
-
import { r } from '../../state-
|
|
1
|
+
import { T as TailwindStyledElement, E, x } from '../../index-CQq_Eyeu.js';
|
|
2
|
+
import { n, t } from '../../property-CPkYmAYi.js';
|
|
3
|
+
import { r } from '../../state-CtrTo6cC.js';
|
|
4
4
|
import { e } from '../../query-CHb9Ft_d.js';
|
|
5
5
|
import { c as ce } from '../../index-B9iart53.js';
|
|
6
6
|
import '../../tailwind-config.js';
|
|
@@ -10,7 +10,7 @@ import '../lukso-markdown/index.js';
|
|
|
10
10
|
import '../lukso-switch/index.js';
|
|
11
11
|
import '../lukso-button/index.js';
|
|
12
12
|
import '../lukso-icon/index.js';
|
|
13
|
-
import '
|
|
13
|
+
import '../../index-JvkSiEeQ.js';
|
|
14
14
|
import '../lukso-dropdown/index.js';
|
|
15
15
|
import '../lukso-dropdown-option/index.js';
|
|
16
16
|
import '../lukso-tooltip/index.js';
|
|
@@ -201,6 +201,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
201
201
|
};
|
|
202
202
|
const DEFAULT_PREVIEW_BACKGROUND_COLOR = "#f9f9f9";
|
|
203
203
|
const DEFAULT_PREVIEW_TEXT_COLOR = "#374151";
|
|
204
|
+
const ACCESSIBILITY_CHECK_DELAY = 1e3;
|
|
204
205
|
let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
205
206
|
constructor() {
|
|
206
207
|
super(...arguments);
|
|
@@ -220,6 +221,18 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
220
221
|
this.placeholder = "";
|
|
221
222
|
this.previewBackgroundColor = DEFAULT_PREVIEW_BACKGROUND_COLOR;
|
|
222
223
|
this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
|
|
224
|
+
this.stripHtmlTags = false;
|
|
225
|
+
this.tools = void 0;
|
|
226
|
+
this.toolsState = [];
|
|
227
|
+
this.defaultTools = [
|
|
228
|
+
"heading",
|
|
229
|
+
"bold",
|
|
230
|
+
"italic",
|
|
231
|
+
"list",
|
|
232
|
+
"link",
|
|
233
|
+
"alignment",
|
|
234
|
+
"color"
|
|
235
|
+
];
|
|
223
236
|
this.savedSelectionForPreview = null;
|
|
224
237
|
this.isHeadingDropdownOpen = false;
|
|
225
238
|
this.isColorDropdownOpen = false;
|
|
@@ -256,7 +269,6 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
256
269
|
this.accessibilityViolations = [];
|
|
257
270
|
this.hasAccessibilityViolations = false;
|
|
258
271
|
this.accessibilityCheckTimeout = null;
|
|
259
|
-
this.ACCESSIBILITY_CHECK_DELAY = 1e3;
|
|
260
272
|
this.handleOutsideClick = (event) => {
|
|
261
273
|
const target = event.target;
|
|
262
274
|
const isInsideThisComponent = this.contains(target) || this.shadowRoot?.contains(target);
|
|
@@ -528,7 +540,25 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
528
540
|
this.accessibilityCheckTimeout = window.setTimeout(() => {
|
|
529
541
|
this.performAccessibilityCheck();
|
|
530
542
|
this.accessibilityCheckTimeout = null;
|
|
531
|
-
},
|
|
543
|
+
}, ACCESSIBILITY_CHECK_DELAY);
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Clean up empty color spans from the value.
|
|
547
|
+
* This removes spans like <span style="color: #xxx"></span> with no content.
|
|
548
|
+
*/
|
|
549
|
+
cleanupEmptyColorSpans() {
|
|
550
|
+
const emptyColorSpanRegex = /<span style="color: [^"]+"><\/span>/g;
|
|
551
|
+
const cleanedValue = this.value.replace(emptyColorSpanRegex, "");
|
|
552
|
+
if (cleanedValue !== this.value) {
|
|
553
|
+
this.value = cleanedValue;
|
|
554
|
+
const textarea = this.textareaEl?.shadowRoot?.querySelector("textarea");
|
|
555
|
+
if (textarea) {
|
|
556
|
+
const currentPos = textarea.selectionStart ?? 0;
|
|
557
|
+
textarea.value = cleanedValue;
|
|
558
|
+
const newPos = Math.min(currentPos, cleanedValue.length);
|
|
559
|
+
textarea.setSelectionRange(newPos, newPos);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
532
562
|
}
|
|
533
563
|
/**
|
|
534
564
|
* Unified helper that ensures both active format state and change events are properly
|
|
@@ -538,6 +568,7 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
538
568
|
* @param event - Optional event that triggered the change
|
|
539
569
|
*/
|
|
540
570
|
emitChangeAndRefresh(event) {
|
|
571
|
+
this.cleanupEmptyColorSpans();
|
|
541
572
|
this.updateActiveFormats();
|
|
542
573
|
this.dispatchChange(event);
|
|
543
574
|
this.scheduleAccessibilityCheck();
|
|
@@ -827,9 +858,27 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
827
858
|
}
|
|
828
859
|
this.value = before + transformed + after;
|
|
829
860
|
textarea.value = before + transformed + after;
|
|
830
|
-
|
|
861
|
+
let selStart;
|
|
862
|
+
let selEnd;
|
|
863
|
+
if (alignment === "left" || existingMatch && existingMatch[1] === alignment || this.getNestedAlignment(selected) === alignment) {
|
|
864
|
+
selStart = before.length;
|
|
865
|
+
selEnd = before.length + transformed.length;
|
|
866
|
+
} else {
|
|
867
|
+
const openTagMatch = transformed.match(
|
|
868
|
+
/<div style="text-align: (center|right);">([^<]*)<\/div>/
|
|
869
|
+
);
|
|
870
|
+
if (openTagMatch) {
|
|
871
|
+
const innerContent = openTagMatch[2];
|
|
872
|
+
const tagStart = transformed.indexOf(">") + 1;
|
|
873
|
+
selStart = before.length + tagStart;
|
|
874
|
+
selEnd = selStart + innerContent.length;
|
|
875
|
+
} else {
|
|
876
|
+
selStart = before.length;
|
|
877
|
+
selEnd = before.length + transformed.length;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
831
880
|
requestAnimationFrame(() => {
|
|
832
|
-
textarea.setSelectionRange(
|
|
881
|
+
textarea.setSelectionRange(selStart, selEnd);
|
|
833
882
|
this.emitChangeAndRefresh();
|
|
834
883
|
});
|
|
835
884
|
});
|
|
@@ -1327,7 +1376,7 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
|
|
|
1327
1376
|
this.value = before + wrapped + after;
|
|
1328
1377
|
textarea.value = before + wrapped + after;
|
|
1329
1378
|
const selStart = before.length + newColorTagOpen.length;
|
|
1330
|
-
const selEnd = selStart + (selected ? selected.length :
|
|
1379
|
+
const selEnd = selStart + (selected ? selected.length : 0);
|
|
1331
1380
|
requestAnimationFrame(() => {
|
|
1332
1381
|
textarea.setSelectionRange(selStart, selEnd);
|
|
1333
1382
|
this.emitChangeAndRefresh();
|
|
@@ -2132,126 +2181,127 @@ ${indent}${nextNumber}. `;
|
|
|
2132
2181
|
toolbarTemplate() {
|
|
2133
2182
|
return x`
|
|
2134
2183
|
<div class="flex items-center gap-1">
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2184
|
+
<!-- Heading -->
|
|
2185
|
+
${this.toolsState.includes("heading") ? x`<div class=${cn(this.styles().headingMenu())}>
|
|
2186
|
+
<lukso-tooltip text="Heading options" placement="top">
|
|
2187
|
+
<lukso-button
|
|
2188
|
+
id=${this.headingTriggerId}
|
|
2189
|
+
@click=${(e) => {
|
|
2141
2190
|
e.stopPropagation();
|
|
2142
2191
|
this.isColorDropdownOpen = false;
|
|
2143
2192
|
this.isListDropdownOpen = false;
|
|
2144
2193
|
this.isAlignmentDropdownOpen = false;
|
|
2145
2194
|
this.isHeadingDropdownOpen = !this.isHeadingDropdownOpen;
|
|
2146
2195
|
}}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2196
|
+
aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
|
|
2197
|
+
aria-label="Heading options"
|
|
2198
|
+
variant="secondary"
|
|
2199
|
+
size="small"
|
|
2200
|
+
custom-class=${this.toolbarButton({
|
|
2152
2201
|
active: this.getActiveHeadingLevel() > 0
|
|
2153
2202
|
})}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2203
|
+
is-icon
|
|
2204
|
+
>
|
|
2205
|
+
<lukso-icon
|
|
2206
|
+
name="smallcaps"
|
|
2207
|
+
size="small"
|
|
2208
|
+
pack="vuesax"
|
|
2209
|
+
variant="linear"
|
|
2210
|
+
></lukso-icon>
|
|
2211
|
+
</lukso-button>
|
|
2212
|
+
</lukso-tooltip>
|
|
2213
|
+
<lukso-dropdown
|
|
2214
|
+
id="headingDropdown"
|
|
2215
|
+
trigger-id=""
|
|
2216
|
+
size="medium"
|
|
2217
|
+
?is-open=${this.isHeadingDropdownOpen}
|
|
2218
|
+
>
|
|
2219
|
+
<lukso-dropdown-option
|
|
2220
|
+
?is-selected=${this.getActiveHeadingLevel() === 0}
|
|
2221
|
+
@click=${(e) => {
|
|
2173
2222
|
e.stopPropagation();
|
|
2174
2223
|
this.restoreFocusAndSelection();
|
|
2175
2224
|
this.applyHeading(0);
|
|
2176
2225
|
this.isHeadingDropdownOpen = false;
|
|
2177
2226
|
}}
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2227
|
+
size="medium"
|
|
2228
|
+
>
|
|
2229
|
+
Normal text
|
|
2230
|
+
</lukso-dropdown-option>
|
|
2231
|
+
<lukso-dropdown-option
|
|
2232
|
+
?is-selected=${this.getActiveHeadingLevel() === 1}
|
|
2233
|
+
@click=${(e) => {
|
|
2185
2234
|
e.stopPropagation();
|
|
2186
2235
|
this.restoreFocusAndSelection();
|
|
2187
2236
|
this.applyHeading(1);
|
|
2188
2237
|
this.isHeadingDropdownOpen = false;
|
|
2189
2238
|
}}
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2239
|
+
size="medium"
|
|
2240
|
+
>
|
|
2241
|
+
Heading 1
|
|
2242
|
+
</lukso-dropdown-option>
|
|
2243
|
+
<lukso-dropdown-option
|
|
2244
|
+
?is-selected=${this.getActiveHeadingLevel() === 2}
|
|
2245
|
+
@click=${(e) => {
|
|
2197
2246
|
e.stopPropagation();
|
|
2198
2247
|
this.restoreFocusAndSelection();
|
|
2199
2248
|
this.applyHeading(2);
|
|
2200
2249
|
this.isHeadingDropdownOpen = false;
|
|
2201
2250
|
}}
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2251
|
+
size="medium"
|
|
2252
|
+
>
|
|
2253
|
+
Heading 2
|
|
2254
|
+
</lukso-dropdown-option>
|
|
2255
|
+
<lukso-dropdown-option
|
|
2256
|
+
?is-selected=${this.getActiveHeadingLevel() === 3}
|
|
2257
|
+
@click=${(e) => {
|
|
2209
2258
|
e.stopPropagation();
|
|
2210
2259
|
this.restoreFocusAndSelection();
|
|
2211
2260
|
this.applyHeading(3);
|
|
2212
2261
|
this.isHeadingDropdownOpen = false;
|
|
2213
2262
|
}}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2263
|
+
size="medium"
|
|
2264
|
+
>
|
|
2265
|
+
Heading 3
|
|
2266
|
+
</lukso-dropdown-option>
|
|
2267
|
+
<lukso-dropdown-option
|
|
2268
|
+
?is-selected=${this.getActiveHeadingLevel() === 4}
|
|
2269
|
+
@click=${(e) => {
|
|
2221
2270
|
e.stopPropagation();
|
|
2222
2271
|
this.restoreFocusAndSelection();
|
|
2223
2272
|
this.applyHeading(4);
|
|
2224
2273
|
this.isHeadingDropdownOpen = false;
|
|
2225
2274
|
}}
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2275
|
+
size="medium"
|
|
2276
|
+
>
|
|
2277
|
+
Heading 4
|
|
2278
|
+
</lukso-dropdown-option>
|
|
2279
|
+
</lukso-dropdown>
|
|
2280
|
+
</div>` : E}
|
|
2232
2281
|
|
|
2233
2282
|
<!-- Bold -->
|
|
2234
|
-
${this.buttonTemplate(
|
|
2283
|
+
${this.toolsState.includes("bold") ? this.buttonTemplate(
|
|
2235
2284
|
"text-bold",
|
|
2236
2285
|
() => this.toggleWrap("**"),
|
|
2237
2286
|
"Bold",
|
|
2238
2287
|
this.activeFormats.bold
|
|
2239
|
-
)}
|
|
2288
|
+
) : E}
|
|
2240
2289
|
|
|
2241
2290
|
<!-- Italic -->
|
|
2242
|
-
${this.buttonTemplate(
|
|
2291
|
+
${this.toolsState.includes("italic") ? this.buttonTemplate(
|
|
2243
2292
|
"text-italic",
|
|
2244
2293
|
() => this.toggleWrap("*"),
|
|
2245
2294
|
"Italic",
|
|
2246
2295
|
this.activeFormats.italic
|
|
2247
|
-
)}
|
|
2296
|
+
) : E}
|
|
2248
2297
|
|
|
2249
2298
|
<!-- List -->
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2299
|
+
${this.toolsState.includes("list") ? x`
|
|
2300
|
+
<div class=${this.styles().listMenu()}>
|
|
2301
|
+
<lukso-tooltip text="List options" placement="top">
|
|
2302
|
+
<lukso-button
|
|
2303
|
+
id=${this.listTriggerId}
|
|
2304
|
+
@click=${(e) => {
|
|
2255
2305
|
e.stopPropagation();
|
|
2256
2306
|
this.restoreFocusAndSelection();
|
|
2257
2307
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2259,82 +2309,84 @@ ${indent}${nextNumber}. `;
|
|
|
2259
2309
|
this.isAlignmentDropdownOpen = false;
|
|
2260
2310
|
this.isListDropdownOpen = !this.isListDropdownOpen;
|
|
2261
2311
|
}}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2312
|
+
aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
|
|
2313
|
+
aria-label="List options"
|
|
2314
|
+
variant="secondary"
|
|
2315
|
+
size="small"
|
|
2316
|
+
custom-class=${this.toolbarButton({
|
|
2267
2317
|
active: this.activeFormats.unorderedList || this.activeFormats.orderedList
|
|
2268
2318
|
})}
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2319
|
+
is-icon
|
|
2320
|
+
>
|
|
2321
|
+
<lukso-icon
|
|
2322
|
+
name="task"
|
|
2323
|
+
size="small"
|
|
2324
|
+
pack="vuesax"
|
|
2325
|
+
variant="linear"
|
|
2326
|
+
></lukso-icon>
|
|
2327
|
+
</lukso-button>
|
|
2328
|
+
</lukso-tooltip>
|
|
2329
|
+
<lukso-dropdown
|
|
2330
|
+
id="listDropdown"
|
|
2331
|
+
trigger-id=""
|
|
2332
|
+
size="medium"
|
|
2333
|
+
?is-open=${this.isListDropdownOpen}
|
|
2334
|
+
>
|
|
2335
|
+
<lukso-dropdown-option
|
|
2336
|
+
?is-selected=${this.getActiveListType() === "none"}
|
|
2337
|
+
@click=${(e) => {
|
|
2288
2338
|
e.stopPropagation();
|
|
2289
2339
|
this.restoreFocusAndSelection();
|
|
2290
2340
|
this.applyList("none");
|
|
2291
2341
|
this.isListDropdownOpen = false;
|
|
2292
2342
|
}}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2343
|
+
size="medium"
|
|
2344
|
+
>
|
|
2345
|
+
No list
|
|
2346
|
+
</lukso-dropdown-option>
|
|
2347
|
+
<lukso-dropdown-option
|
|
2348
|
+
?is-selected=${this.getActiveListType() === "unordered"}
|
|
2349
|
+
@click=${(e) => {
|
|
2300
2350
|
e.stopPropagation();
|
|
2301
2351
|
this.restoreFocusAndSelection();
|
|
2302
2352
|
this.applyList("unordered");
|
|
2303
2353
|
this.isListDropdownOpen = false;
|
|
2304
2354
|
}}
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2355
|
+
size="medium"
|
|
2356
|
+
>
|
|
2357
|
+
Unordered
|
|
2358
|
+
</lukso-dropdown-option>
|
|
2359
|
+
<lukso-dropdown-option
|
|
2360
|
+
?is-selected=${this.getActiveListType() === "ordered"}
|
|
2361
|
+
@click=${(e) => {
|
|
2312
2362
|
e.stopPropagation();
|
|
2313
2363
|
this.restoreFocusAndSelection();
|
|
2314
2364
|
this.applyList("ordered");
|
|
2315
2365
|
this.isListDropdownOpen = false;
|
|
2316
2366
|
}}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2367
|
+
size="medium"
|
|
2368
|
+
>
|
|
2369
|
+
Ordered
|
|
2370
|
+
</lukso-dropdown-option>
|
|
2371
|
+
</lukso-dropdown>
|
|
2372
|
+
</div>
|
|
2373
|
+
` : E}
|
|
2323
2374
|
|
|
2324
2375
|
<!-- Link -->
|
|
2325
|
-
${this.buttonTemplate(
|
|
2376
|
+
${this.toolsState.includes("link") ? this.buttonTemplate(
|
|
2326
2377
|
"link",
|
|
2327
2378
|
() => this.insertLink(),
|
|
2328
2379
|
"Link",
|
|
2329
2380
|
this.activeFormats.link
|
|
2330
|
-
)}
|
|
2381
|
+
) : E}
|
|
2331
2382
|
|
|
2332
2383
|
<!-- Text Alignment -->
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2384
|
+
${this.toolsState.includes("alignment") ? x`
|
|
2385
|
+
<div class=${this.styles().alignmentMenu()}>
|
|
2386
|
+
<lukso-tooltip text="Text alignment" placement="top">
|
|
2387
|
+
<lukso-button
|
|
2388
|
+
id=${this.alignmentTriggerId}
|
|
2389
|
+
@click=${(e) => {
|
|
2338
2390
|
e.stopPropagation();
|
|
2339
2391
|
this.restoreFocusAndSelection();
|
|
2340
2392
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2342,101 +2394,103 @@ ${indent}${nextNumber}. `;
|
|
|
2342
2394
|
this.isListDropdownOpen = false;
|
|
2343
2395
|
this.isAlignmentDropdownOpen = !this.isAlignmentDropdownOpen;
|
|
2344
2396
|
}}
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2397
|
+
aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
|
|
2398
|
+
aria-label="Text alignment"
|
|
2399
|
+
variant="secondary"
|
|
2400
|
+
size="small"
|
|
2401
|
+
custom-class=${this.toolbarButton({
|
|
2350
2402
|
active: this.activeFormats.alignment !== "left"
|
|
2351
2403
|
})}
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2404
|
+
is-icon
|
|
2405
|
+
>
|
|
2406
|
+
<lukso-icon
|
|
2407
|
+
name=${this.getAlignmentIcon()}
|
|
2408
|
+
size="small"
|
|
2409
|
+
pack="vuesax"
|
|
2410
|
+
variant="linear"
|
|
2411
|
+
></lukso-icon>
|
|
2412
|
+
</lukso-button>
|
|
2413
|
+
</lukso-tooltip>
|
|
2414
|
+
<lukso-dropdown
|
|
2415
|
+
id="alignmentDropdown"
|
|
2416
|
+
trigger-id=""
|
|
2417
|
+
size="medium"
|
|
2418
|
+
?is-open=${this.isAlignmentDropdownOpen}
|
|
2419
|
+
>
|
|
2420
|
+
<lukso-dropdown-option
|
|
2421
|
+
?is-selected=${this.activeFormats.alignment === "left"}
|
|
2422
|
+
@click=${(e) => {
|
|
2371
2423
|
e.stopPropagation();
|
|
2372
2424
|
this.restoreFocusAndSelection();
|
|
2373
2425
|
this.applyAlignment("left");
|
|
2374
2426
|
this.isAlignmentDropdownOpen = false;
|
|
2375
2427
|
}}
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2428
|
+
size="medium"
|
|
2429
|
+
aria-label="Align left"
|
|
2430
|
+
>
|
|
2431
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2432
|
+
<lukso-icon
|
|
2433
|
+
name="textalign-left"
|
|
2434
|
+
size="small"
|
|
2435
|
+
pack="vuesax"
|
|
2436
|
+
variant="linear"
|
|
2437
|
+
></lukso-icon>
|
|
2438
|
+
Left
|
|
2439
|
+
</div>
|
|
2440
|
+
</lukso-dropdown-option>
|
|
2441
|
+
<lukso-dropdown-option
|
|
2442
|
+
?is-selected=${this.activeFormats.alignment === "center"}
|
|
2443
|
+
@click=${(e) => {
|
|
2392
2444
|
e.stopPropagation();
|
|
2393
2445
|
this.restoreFocusAndSelection();
|
|
2394
2446
|
this.applyAlignment("center");
|
|
2395
2447
|
this.isAlignmentDropdownOpen = false;
|
|
2396
2448
|
}}
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2449
|
+
size="medium"
|
|
2450
|
+
aria-label="Align center"
|
|
2451
|
+
>
|
|
2452
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2453
|
+
<lukso-icon
|
|
2454
|
+
name="textalign-center"
|
|
2455
|
+
size="small"
|
|
2456
|
+
pack="vuesax"
|
|
2457
|
+
variant="linear"
|
|
2458
|
+
></lukso-icon>
|
|
2459
|
+
Center
|
|
2460
|
+
</div>
|
|
2461
|
+
</lukso-dropdown-option>
|
|
2462
|
+
<lukso-dropdown-option
|
|
2463
|
+
?is-selected=${this.activeFormats.alignment === "right"}
|
|
2464
|
+
@click=${(e) => {
|
|
2413
2465
|
e.stopPropagation();
|
|
2414
2466
|
this.restoreFocusAndSelection();
|
|
2415
2467
|
this.applyAlignment("right");
|
|
2416
2468
|
this.isAlignmentDropdownOpen = false;
|
|
2417
2469
|
}}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2470
|
+
size="medium"
|
|
2471
|
+
aria-label="Align right"
|
|
2472
|
+
>
|
|
2473
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2474
|
+
<lukso-icon
|
|
2475
|
+
name="textalign-right"
|
|
2476
|
+
size="small"
|
|
2477
|
+
pack="vuesax"
|
|
2478
|
+
variant="linear"
|
|
2479
|
+
></lukso-icon>
|
|
2480
|
+
Right
|
|
2481
|
+
</div>
|
|
2482
|
+
</lukso-dropdown-option>
|
|
2483
|
+
</lukso-dropdown>
|
|
2429
2484
|
</div>
|
|
2430
|
-
|
|
2431
|
-
</lukso-dropdown>
|
|
2432
|
-
</div>
|
|
2485
|
+
` : E}
|
|
2433
2486
|
|
|
2434
2487
|
<!-- Color -->
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2488
|
+
${this.toolsState.includes("color") ? x`
|
|
2489
|
+
<div class=${this.styles().colorMenu()}>
|
|
2490
|
+
<lukso-tooltip text="Text color" placement="top">
|
|
2491
|
+
<lukso-button
|
|
2492
|
+
id=${this.colorTriggerId}
|
|
2493
|
+
@click=${(e) => {
|
|
2440
2494
|
e.stopPropagation();
|
|
2441
2495
|
this.restoreFocusAndSelection();
|
|
2442
2496
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2453,66 +2507,70 @@ ${indent}${nextNumber}. `;
|
|
|
2453
2507
|
}
|
|
2454
2508
|
this.isColorDropdownOpen = !this.isColorDropdownOpen;
|
|
2455
2509
|
}}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2510
|
+
aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
|
|
2511
|
+
aria-pressed=${this.activeFormats.color ? "true" : "false"}
|
|
2512
|
+
aria-label="Text color"
|
|
2513
|
+
variant="secondary"
|
|
2514
|
+
size="small"
|
|
2515
|
+
custom-class=${this.toolbarButton({
|
|
2462
2516
|
active: this.activeFormats.color
|
|
2463
2517
|
})}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
class="text-xs text-neutral-60
|
|
2484
|
-
|
|
2518
|
+
is-icon
|
|
2519
|
+
>
|
|
2520
|
+
<div
|
|
2521
|
+
class="size-4 rounded-full"
|
|
2522
|
+
style="background-color: ${this.activeFormats.activeColor};"
|
|
2523
|
+
></div>
|
|
2524
|
+
</lukso-button>
|
|
2525
|
+
</lukso-tooltip>
|
|
2526
|
+
<lukso-dropdown
|
|
2527
|
+
id="colorDropdown"
|
|
2528
|
+
trigger-id=""
|
|
2529
|
+
size="medium"
|
|
2530
|
+
max-height="300"
|
|
2531
|
+
?is-open=${this.isColorDropdownOpen}
|
|
2532
|
+
>
|
|
2533
|
+
<div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
|
|
2534
|
+
<div
|
|
2535
|
+
class="col-span-8 mb-2 flex items-center justify-between"
|
|
2536
|
+
>
|
|
2537
|
+
<span class="text-xs text-neutral-60">Text Color</span>
|
|
2538
|
+
${this.activeFormats.color ? x`<button
|
|
2539
|
+
class="text-xs text-neutral-60 hover:text-neutral-20 underline"
|
|
2540
|
+
@click=${(e) => {
|
|
2485
2541
|
e.stopPropagation();
|
|
2486
2542
|
this.clearColor();
|
|
2487
2543
|
this.isColorDropdownOpen = false;
|
|
2488
2544
|
}}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2545
|
+
type="button"
|
|
2546
|
+
aria-label="Clear color"
|
|
2547
|
+
>
|
|
2548
|
+
Clear
|
|
2549
|
+
</button>` : E}
|
|
2550
|
+
</div>
|
|
2551
|
+
${this.colorSamples.map(
|
|
2496
2552
|
(color) => x`
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2553
|
+
<button
|
|
2554
|
+
class="w-6 h-6 rounded-4 border transition-all ${this.activeFormats.activeColor === color ? "border-neutral-20 ring-2 ring-purple-51" : "border-neutral-90 hover:border-neutral-60"}"
|
|
2555
|
+
style="background-color: ${color}"
|
|
2556
|
+
title=${color}
|
|
2557
|
+
aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
|
|
2558
|
+
aria-label="Color ${color}"
|
|
2559
|
+
@click=${(e) => {
|
|
2504
2560
|
e.stopPropagation();
|
|
2505
2561
|
this.selectColor(color);
|
|
2506
2562
|
this.isColorDropdownOpen = false;
|
|
2507
2563
|
}}
|
|
2508
|
-
|
|
2509
|
-
|
|
2564
|
+
></button>
|
|
2565
|
+
`
|
|
2510
2566
|
)}
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2567
|
+
</div>
|
|
2568
|
+
</lukso-dropdown>
|
|
2569
|
+
</div>
|
|
2570
|
+
` : E}
|
|
2514
2571
|
|
|
2515
|
-
|
|
2572
|
+
<!-- Divider -->
|
|
2573
|
+
${this.toolsState.length > 0 ? x`<div class=${this.styles().divider()}></div>` : E}
|
|
2516
2574
|
</div>
|
|
2517
2575
|
`;
|
|
2518
2576
|
}
|
|
@@ -2557,6 +2615,17 @@ ${indent}${nextNumber}. `;
|
|
|
2557
2615
|
if (!this.previewTextColor) {
|
|
2558
2616
|
this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
|
|
2559
2617
|
}
|
|
2618
|
+
this.toolsState = this.defaultTools;
|
|
2619
|
+
try {
|
|
2620
|
+
if (this.tools) {
|
|
2621
|
+
this.toolsState = JSON.parse(this.tools);
|
|
2622
|
+
}
|
|
2623
|
+
} catch (error) {
|
|
2624
|
+
console.warn(
|
|
2625
|
+
"Invalid JSON for tools property in lukso-markdown-editor. Using default tools.",
|
|
2626
|
+
error
|
|
2627
|
+
);
|
|
2628
|
+
}
|
|
2560
2629
|
return x`
|
|
2561
2630
|
<div class=${wrapper()}>
|
|
2562
2631
|
${this.labelTemplate()} ${this.descriptionTemplate()}
|
|
@@ -2596,6 +2665,7 @@ ${indent}${nextNumber}. `;
|
|
|
2596
2665
|
>
|
|
2597
2666
|
<lukso-markdown
|
|
2598
2667
|
value=${this.value}
|
|
2668
|
+
?strip-html-tags=${this.stripHtmlTags}
|
|
2599
2669
|
custom-style=${`color: ${this.previewTextColor};`}
|
|
2600
2670
|
></lukso-markdown>
|
|
2601
2671
|
${this.accessibilityIndicatorTemplate()}
|
|
@@ -2658,6 +2728,15 @@ __decorateClass([
|
|
|
2658
2728
|
__decorateClass([
|
|
2659
2729
|
n({ type: String, attribute: "preview-text-color", reflect: true })
|
|
2660
2730
|
], LuksoMarkdownEditor.prototype, "previewTextColor", 2);
|
|
2731
|
+
__decorateClass([
|
|
2732
|
+
n({ type: Boolean, attribute: "strip-html-tags" })
|
|
2733
|
+
], LuksoMarkdownEditor.prototype, "stripHtmlTags", 2);
|
|
2734
|
+
__decorateClass([
|
|
2735
|
+
n({ type: String })
|
|
2736
|
+
], LuksoMarkdownEditor.prototype, "tools", 2);
|
|
2737
|
+
__decorateClass([
|
|
2738
|
+
r()
|
|
2739
|
+
], LuksoMarkdownEditor.prototype, "toolsState", 2);
|
|
2661
2740
|
__decorateClass([
|
|
2662
2741
|
r()
|
|
2663
2742
|
], LuksoMarkdownEditor.prototype, "savedSelectionForPreview", 2);
|