@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
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const shared_tailwindElement_index = require('../../index-
|
|
6
|
-
const property = require('../../property-
|
|
7
|
-
const state = require('../../state-
|
|
5
|
+
const shared_tailwindElement_index = require('../../index-BFqOU6o6.cjs');
|
|
6
|
+
const property = require('../../property-Cs8qVdri.cjs');
|
|
7
|
+
const state = require('../../state-Bh6EXopE.cjs');
|
|
8
8
|
const query = require('../../query-EFiHeHdi.cjs');
|
|
9
9
|
const index = require('../../index-CaJky2qL.cjs');
|
|
10
10
|
require('../../tailwind-config.cjs');
|
|
@@ -14,7 +14,7 @@ require('../lukso-markdown/index.cjs');
|
|
|
14
14
|
require('../lukso-switch/index.cjs');
|
|
15
15
|
require('../lukso-button/index.cjs');
|
|
16
16
|
require('../lukso-icon/index.cjs');
|
|
17
|
-
require('
|
|
17
|
+
require('../../index-Chl2HHJ6.cjs');
|
|
18
18
|
require('../lukso-dropdown/index.cjs');
|
|
19
19
|
require('../lukso-dropdown-option/index.cjs');
|
|
20
20
|
require('../lukso-tooltip/index.cjs');
|
|
@@ -205,6 +205,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
205
205
|
};
|
|
206
206
|
const DEFAULT_PREVIEW_BACKGROUND_COLOR = "#f9f9f9";
|
|
207
207
|
const DEFAULT_PREVIEW_TEXT_COLOR = "#374151";
|
|
208
|
+
const ACCESSIBILITY_CHECK_DELAY = 1e3;
|
|
208
209
|
exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindElement_index.TailwindStyledElement(style) {
|
|
209
210
|
constructor() {
|
|
210
211
|
super(...arguments);
|
|
@@ -224,6 +225,18 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
224
225
|
this.placeholder = "";
|
|
225
226
|
this.previewBackgroundColor = DEFAULT_PREVIEW_BACKGROUND_COLOR;
|
|
226
227
|
this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
|
|
228
|
+
this.stripHtmlTags = false;
|
|
229
|
+
this.tools = void 0;
|
|
230
|
+
this.toolsState = [];
|
|
231
|
+
this.defaultTools = [
|
|
232
|
+
"heading",
|
|
233
|
+
"bold",
|
|
234
|
+
"italic",
|
|
235
|
+
"list",
|
|
236
|
+
"link",
|
|
237
|
+
"alignment",
|
|
238
|
+
"color"
|
|
239
|
+
];
|
|
227
240
|
this.savedSelectionForPreview = null;
|
|
228
241
|
this.isHeadingDropdownOpen = false;
|
|
229
242
|
this.isColorDropdownOpen = false;
|
|
@@ -260,7 +273,6 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
260
273
|
this.accessibilityViolations = [];
|
|
261
274
|
this.hasAccessibilityViolations = false;
|
|
262
275
|
this.accessibilityCheckTimeout = null;
|
|
263
|
-
this.ACCESSIBILITY_CHECK_DELAY = 1e3;
|
|
264
276
|
this.handleOutsideClick = (event) => {
|
|
265
277
|
const target = event.target;
|
|
266
278
|
const isInsideThisComponent = this.contains(target) || this.shadowRoot?.contains(target);
|
|
@@ -532,7 +544,25 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
532
544
|
this.accessibilityCheckTimeout = window.setTimeout(() => {
|
|
533
545
|
this.performAccessibilityCheck();
|
|
534
546
|
this.accessibilityCheckTimeout = null;
|
|
535
|
-
},
|
|
547
|
+
}, ACCESSIBILITY_CHECK_DELAY);
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Clean up empty color spans from the value.
|
|
551
|
+
* This removes spans like <span style="color: #xxx"></span> with no content.
|
|
552
|
+
*/
|
|
553
|
+
cleanupEmptyColorSpans() {
|
|
554
|
+
const emptyColorSpanRegex = /<span style="color: [^"]+"><\/span>/g;
|
|
555
|
+
const cleanedValue = this.value.replace(emptyColorSpanRegex, "");
|
|
556
|
+
if (cleanedValue !== this.value) {
|
|
557
|
+
this.value = cleanedValue;
|
|
558
|
+
const textarea = this.textareaEl?.shadowRoot?.querySelector("textarea");
|
|
559
|
+
if (textarea) {
|
|
560
|
+
const currentPos = textarea.selectionStart ?? 0;
|
|
561
|
+
textarea.value = cleanedValue;
|
|
562
|
+
const newPos = Math.min(currentPos, cleanedValue.length);
|
|
563
|
+
textarea.setSelectionRange(newPos, newPos);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
536
566
|
}
|
|
537
567
|
/**
|
|
538
568
|
* Unified helper that ensures both active format state and change events are properly
|
|
@@ -542,6 +572,7 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
542
572
|
* @param event - Optional event that triggered the change
|
|
543
573
|
*/
|
|
544
574
|
emitChangeAndRefresh(event) {
|
|
575
|
+
this.cleanupEmptyColorSpans();
|
|
545
576
|
this.updateActiveFormats();
|
|
546
577
|
this.dispatchChange(event);
|
|
547
578
|
this.scheduleAccessibilityCheck();
|
|
@@ -831,9 +862,27 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
831
862
|
}
|
|
832
863
|
this.value = before + transformed + after;
|
|
833
864
|
textarea.value = before + transformed + after;
|
|
834
|
-
|
|
865
|
+
let selStart;
|
|
866
|
+
let selEnd;
|
|
867
|
+
if (alignment === "left" || existingMatch && existingMatch[1] === alignment || this.getNestedAlignment(selected) === alignment) {
|
|
868
|
+
selStart = before.length;
|
|
869
|
+
selEnd = before.length + transformed.length;
|
|
870
|
+
} else {
|
|
871
|
+
const openTagMatch = transformed.match(
|
|
872
|
+
/<div style="text-align: (center|right);">([^<]*)<\/div>/
|
|
873
|
+
);
|
|
874
|
+
if (openTagMatch) {
|
|
875
|
+
const innerContent = openTagMatch[2];
|
|
876
|
+
const tagStart = transformed.indexOf(">") + 1;
|
|
877
|
+
selStart = before.length + tagStart;
|
|
878
|
+
selEnd = selStart + innerContent.length;
|
|
879
|
+
} else {
|
|
880
|
+
selStart = before.length;
|
|
881
|
+
selEnd = before.length + transformed.length;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
835
884
|
requestAnimationFrame(() => {
|
|
836
|
-
textarea.setSelectionRange(
|
|
885
|
+
textarea.setSelectionRange(selStart, selEnd);
|
|
837
886
|
this.emitChangeAndRefresh();
|
|
838
887
|
});
|
|
839
888
|
});
|
|
@@ -1331,7 +1380,7 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
|
|
|
1331
1380
|
this.value = before + wrapped + after;
|
|
1332
1381
|
textarea.value = before + wrapped + after;
|
|
1333
1382
|
const selStart = before.length + newColorTagOpen.length;
|
|
1334
|
-
const selEnd = selStart + (selected ? selected.length :
|
|
1383
|
+
const selEnd = selStart + (selected ? selected.length : 0);
|
|
1335
1384
|
requestAnimationFrame(() => {
|
|
1336
1385
|
textarea.setSelectionRange(selStart, selEnd);
|
|
1337
1386
|
this.emitChangeAndRefresh();
|
|
@@ -2136,126 +2185,127 @@ ${indent}${nextNumber}. `;
|
|
|
2136
2185
|
toolbarTemplate() {
|
|
2137
2186
|
return shared_tailwindElement_index.x`
|
|
2138
2187
|
<div class="flex items-center gap-1">
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2188
|
+
<!-- Heading -->
|
|
2189
|
+
${this.toolsState.includes("heading") ? shared_tailwindElement_index.x`<div class=${axe.cn(this.styles().headingMenu())}>
|
|
2190
|
+
<lukso-tooltip text="Heading options" placement="top">
|
|
2191
|
+
<lukso-button
|
|
2192
|
+
id=${this.headingTriggerId}
|
|
2193
|
+
@click=${(e) => {
|
|
2145
2194
|
e.stopPropagation();
|
|
2146
2195
|
this.isColorDropdownOpen = false;
|
|
2147
2196
|
this.isListDropdownOpen = false;
|
|
2148
2197
|
this.isAlignmentDropdownOpen = false;
|
|
2149
2198
|
this.isHeadingDropdownOpen = !this.isHeadingDropdownOpen;
|
|
2150
2199
|
}}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2200
|
+
aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
|
|
2201
|
+
aria-label="Heading options"
|
|
2202
|
+
variant="secondary"
|
|
2203
|
+
size="small"
|
|
2204
|
+
custom-class=${this.toolbarButton({
|
|
2156
2205
|
active: this.getActiveHeadingLevel() > 0
|
|
2157
2206
|
})}
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2207
|
+
is-icon
|
|
2208
|
+
>
|
|
2209
|
+
<lukso-icon
|
|
2210
|
+
name="smallcaps"
|
|
2211
|
+
size="small"
|
|
2212
|
+
pack="vuesax"
|
|
2213
|
+
variant="linear"
|
|
2214
|
+
></lukso-icon>
|
|
2215
|
+
</lukso-button>
|
|
2216
|
+
</lukso-tooltip>
|
|
2217
|
+
<lukso-dropdown
|
|
2218
|
+
id="headingDropdown"
|
|
2219
|
+
trigger-id=""
|
|
2220
|
+
size="medium"
|
|
2221
|
+
?is-open=${this.isHeadingDropdownOpen}
|
|
2222
|
+
>
|
|
2223
|
+
<lukso-dropdown-option
|
|
2224
|
+
?is-selected=${this.getActiveHeadingLevel() === 0}
|
|
2225
|
+
@click=${(e) => {
|
|
2177
2226
|
e.stopPropagation();
|
|
2178
2227
|
this.restoreFocusAndSelection();
|
|
2179
2228
|
this.applyHeading(0);
|
|
2180
2229
|
this.isHeadingDropdownOpen = false;
|
|
2181
2230
|
}}
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2231
|
+
size="medium"
|
|
2232
|
+
>
|
|
2233
|
+
Normal text
|
|
2234
|
+
</lukso-dropdown-option>
|
|
2235
|
+
<lukso-dropdown-option
|
|
2236
|
+
?is-selected=${this.getActiveHeadingLevel() === 1}
|
|
2237
|
+
@click=${(e) => {
|
|
2189
2238
|
e.stopPropagation();
|
|
2190
2239
|
this.restoreFocusAndSelection();
|
|
2191
2240
|
this.applyHeading(1);
|
|
2192
2241
|
this.isHeadingDropdownOpen = false;
|
|
2193
2242
|
}}
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2243
|
+
size="medium"
|
|
2244
|
+
>
|
|
2245
|
+
Heading 1
|
|
2246
|
+
</lukso-dropdown-option>
|
|
2247
|
+
<lukso-dropdown-option
|
|
2248
|
+
?is-selected=${this.getActiveHeadingLevel() === 2}
|
|
2249
|
+
@click=${(e) => {
|
|
2201
2250
|
e.stopPropagation();
|
|
2202
2251
|
this.restoreFocusAndSelection();
|
|
2203
2252
|
this.applyHeading(2);
|
|
2204
2253
|
this.isHeadingDropdownOpen = false;
|
|
2205
2254
|
}}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2255
|
+
size="medium"
|
|
2256
|
+
>
|
|
2257
|
+
Heading 2
|
|
2258
|
+
</lukso-dropdown-option>
|
|
2259
|
+
<lukso-dropdown-option
|
|
2260
|
+
?is-selected=${this.getActiveHeadingLevel() === 3}
|
|
2261
|
+
@click=${(e) => {
|
|
2213
2262
|
e.stopPropagation();
|
|
2214
2263
|
this.restoreFocusAndSelection();
|
|
2215
2264
|
this.applyHeading(3);
|
|
2216
2265
|
this.isHeadingDropdownOpen = false;
|
|
2217
2266
|
}}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2267
|
+
size="medium"
|
|
2268
|
+
>
|
|
2269
|
+
Heading 3
|
|
2270
|
+
</lukso-dropdown-option>
|
|
2271
|
+
<lukso-dropdown-option
|
|
2272
|
+
?is-selected=${this.getActiveHeadingLevel() === 4}
|
|
2273
|
+
@click=${(e) => {
|
|
2225
2274
|
e.stopPropagation();
|
|
2226
2275
|
this.restoreFocusAndSelection();
|
|
2227
2276
|
this.applyHeading(4);
|
|
2228
2277
|
this.isHeadingDropdownOpen = false;
|
|
2229
2278
|
}}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2279
|
+
size="medium"
|
|
2280
|
+
>
|
|
2281
|
+
Heading 4
|
|
2282
|
+
</lukso-dropdown-option>
|
|
2283
|
+
</lukso-dropdown>
|
|
2284
|
+
</div>` : shared_tailwindElement_index.E}
|
|
2236
2285
|
|
|
2237
2286
|
<!-- Bold -->
|
|
2238
|
-
${this.buttonTemplate(
|
|
2287
|
+
${this.toolsState.includes("bold") ? this.buttonTemplate(
|
|
2239
2288
|
"text-bold",
|
|
2240
2289
|
() => this.toggleWrap("**"),
|
|
2241
2290
|
"Bold",
|
|
2242
2291
|
this.activeFormats.bold
|
|
2243
|
-
)}
|
|
2292
|
+
) : shared_tailwindElement_index.E}
|
|
2244
2293
|
|
|
2245
2294
|
<!-- Italic -->
|
|
2246
|
-
${this.buttonTemplate(
|
|
2295
|
+
${this.toolsState.includes("italic") ? this.buttonTemplate(
|
|
2247
2296
|
"text-italic",
|
|
2248
2297
|
() => this.toggleWrap("*"),
|
|
2249
2298
|
"Italic",
|
|
2250
2299
|
this.activeFormats.italic
|
|
2251
|
-
)}
|
|
2300
|
+
) : shared_tailwindElement_index.E}
|
|
2252
2301
|
|
|
2253
2302
|
<!-- List -->
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2303
|
+
${this.toolsState.includes("list") ? shared_tailwindElement_index.x`
|
|
2304
|
+
<div class=${this.styles().listMenu()}>
|
|
2305
|
+
<lukso-tooltip text="List options" placement="top">
|
|
2306
|
+
<lukso-button
|
|
2307
|
+
id=${this.listTriggerId}
|
|
2308
|
+
@click=${(e) => {
|
|
2259
2309
|
e.stopPropagation();
|
|
2260
2310
|
this.restoreFocusAndSelection();
|
|
2261
2311
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2263,82 +2313,84 @@ ${indent}${nextNumber}. `;
|
|
|
2263
2313
|
this.isAlignmentDropdownOpen = false;
|
|
2264
2314
|
this.isListDropdownOpen = !this.isListDropdownOpen;
|
|
2265
2315
|
}}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2316
|
+
aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
|
|
2317
|
+
aria-label="List options"
|
|
2318
|
+
variant="secondary"
|
|
2319
|
+
size="small"
|
|
2320
|
+
custom-class=${this.toolbarButton({
|
|
2271
2321
|
active: this.activeFormats.unorderedList || this.activeFormats.orderedList
|
|
2272
2322
|
})}
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2323
|
+
is-icon
|
|
2324
|
+
>
|
|
2325
|
+
<lukso-icon
|
|
2326
|
+
name="task"
|
|
2327
|
+
size="small"
|
|
2328
|
+
pack="vuesax"
|
|
2329
|
+
variant="linear"
|
|
2330
|
+
></lukso-icon>
|
|
2331
|
+
</lukso-button>
|
|
2332
|
+
</lukso-tooltip>
|
|
2333
|
+
<lukso-dropdown
|
|
2334
|
+
id="listDropdown"
|
|
2335
|
+
trigger-id=""
|
|
2336
|
+
size="medium"
|
|
2337
|
+
?is-open=${this.isListDropdownOpen}
|
|
2338
|
+
>
|
|
2339
|
+
<lukso-dropdown-option
|
|
2340
|
+
?is-selected=${this.getActiveListType() === "none"}
|
|
2341
|
+
@click=${(e) => {
|
|
2292
2342
|
e.stopPropagation();
|
|
2293
2343
|
this.restoreFocusAndSelection();
|
|
2294
2344
|
this.applyList("none");
|
|
2295
2345
|
this.isListDropdownOpen = false;
|
|
2296
2346
|
}}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2347
|
+
size="medium"
|
|
2348
|
+
>
|
|
2349
|
+
No list
|
|
2350
|
+
</lukso-dropdown-option>
|
|
2351
|
+
<lukso-dropdown-option
|
|
2352
|
+
?is-selected=${this.getActiveListType() === "unordered"}
|
|
2353
|
+
@click=${(e) => {
|
|
2304
2354
|
e.stopPropagation();
|
|
2305
2355
|
this.restoreFocusAndSelection();
|
|
2306
2356
|
this.applyList("unordered");
|
|
2307
2357
|
this.isListDropdownOpen = false;
|
|
2308
2358
|
}}
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2359
|
+
size="medium"
|
|
2360
|
+
>
|
|
2361
|
+
Unordered
|
|
2362
|
+
</lukso-dropdown-option>
|
|
2363
|
+
<lukso-dropdown-option
|
|
2364
|
+
?is-selected=${this.getActiveListType() === "ordered"}
|
|
2365
|
+
@click=${(e) => {
|
|
2316
2366
|
e.stopPropagation();
|
|
2317
2367
|
this.restoreFocusAndSelection();
|
|
2318
2368
|
this.applyList("ordered");
|
|
2319
2369
|
this.isListDropdownOpen = false;
|
|
2320
2370
|
}}
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2371
|
+
size="medium"
|
|
2372
|
+
>
|
|
2373
|
+
Ordered
|
|
2374
|
+
</lukso-dropdown-option>
|
|
2375
|
+
</lukso-dropdown>
|
|
2376
|
+
</div>
|
|
2377
|
+
` : shared_tailwindElement_index.E}
|
|
2327
2378
|
|
|
2328
2379
|
<!-- Link -->
|
|
2329
|
-
${this.buttonTemplate(
|
|
2380
|
+
${this.toolsState.includes("link") ? this.buttonTemplate(
|
|
2330
2381
|
"link",
|
|
2331
2382
|
() => this.insertLink(),
|
|
2332
2383
|
"Link",
|
|
2333
2384
|
this.activeFormats.link
|
|
2334
|
-
)}
|
|
2385
|
+
) : shared_tailwindElement_index.E}
|
|
2335
2386
|
|
|
2336
2387
|
<!-- Text Alignment -->
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2388
|
+
${this.toolsState.includes("alignment") ? shared_tailwindElement_index.x`
|
|
2389
|
+
<div class=${this.styles().alignmentMenu()}>
|
|
2390
|
+
<lukso-tooltip text="Text alignment" placement="top">
|
|
2391
|
+
<lukso-button
|
|
2392
|
+
id=${this.alignmentTriggerId}
|
|
2393
|
+
@click=${(e) => {
|
|
2342
2394
|
e.stopPropagation();
|
|
2343
2395
|
this.restoreFocusAndSelection();
|
|
2344
2396
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2346,101 +2398,103 @@ ${indent}${nextNumber}. `;
|
|
|
2346
2398
|
this.isListDropdownOpen = false;
|
|
2347
2399
|
this.isAlignmentDropdownOpen = !this.isAlignmentDropdownOpen;
|
|
2348
2400
|
}}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2401
|
+
aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
|
|
2402
|
+
aria-label="Text alignment"
|
|
2403
|
+
variant="secondary"
|
|
2404
|
+
size="small"
|
|
2405
|
+
custom-class=${this.toolbarButton({
|
|
2354
2406
|
active: this.activeFormats.alignment !== "left"
|
|
2355
2407
|
})}
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2408
|
+
is-icon
|
|
2409
|
+
>
|
|
2410
|
+
<lukso-icon
|
|
2411
|
+
name=${this.getAlignmentIcon()}
|
|
2412
|
+
size="small"
|
|
2413
|
+
pack="vuesax"
|
|
2414
|
+
variant="linear"
|
|
2415
|
+
></lukso-icon>
|
|
2416
|
+
</lukso-button>
|
|
2417
|
+
</lukso-tooltip>
|
|
2418
|
+
<lukso-dropdown
|
|
2419
|
+
id="alignmentDropdown"
|
|
2420
|
+
trigger-id=""
|
|
2421
|
+
size="medium"
|
|
2422
|
+
?is-open=${this.isAlignmentDropdownOpen}
|
|
2423
|
+
>
|
|
2424
|
+
<lukso-dropdown-option
|
|
2425
|
+
?is-selected=${this.activeFormats.alignment === "left"}
|
|
2426
|
+
@click=${(e) => {
|
|
2375
2427
|
e.stopPropagation();
|
|
2376
2428
|
this.restoreFocusAndSelection();
|
|
2377
2429
|
this.applyAlignment("left");
|
|
2378
2430
|
this.isAlignmentDropdownOpen = false;
|
|
2379
2431
|
}}
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2432
|
+
size="medium"
|
|
2433
|
+
aria-label="Align left"
|
|
2434
|
+
>
|
|
2435
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2436
|
+
<lukso-icon
|
|
2437
|
+
name="textalign-left"
|
|
2438
|
+
size="small"
|
|
2439
|
+
pack="vuesax"
|
|
2440
|
+
variant="linear"
|
|
2441
|
+
></lukso-icon>
|
|
2442
|
+
Left
|
|
2443
|
+
</div>
|
|
2444
|
+
</lukso-dropdown-option>
|
|
2445
|
+
<lukso-dropdown-option
|
|
2446
|
+
?is-selected=${this.activeFormats.alignment === "center"}
|
|
2447
|
+
@click=${(e) => {
|
|
2396
2448
|
e.stopPropagation();
|
|
2397
2449
|
this.restoreFocusAndSelection();
|
|
2398
2450
|
this.applyAlignment("center");
|
|
2399
2451
|
this.isAlignmentDropdownOpen = false;
|
|
2400
2452
|
}}
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2453
|
+
size="medium"
|
|
2454
|
+
aria-label="Align center"
|
|
2455
|
+
>
|
|
2456
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2457
|
+
<lukso-icon
|
|
2458
|
+
name="textalign-center"
|
|
2459
|
+
size="small"
|
|
2460
|
+
pack="vuesax"
|
|
2461
|
+
variant="linear"
|
|
2462
|
+
></lukso-icon>
|
|
2463
|
+
Center
|
|
2464
|
+
</div>
|
|
2465
|
+
</lukso-dropdown-option>
|
|
2466
|
+
<lukso-dropdown-option
|
|
2467
|
+
?is-selected=${this.activeFormats.alignment === "right"}
|
|
2468
|
+
@click=${(e) => {
|
|
2417
2469
|
e.stopPropagation();
|
|
2418
2470
|
this.restoreFocusAndSelection();
|
|
2419
2471
|
this.applyAlignment("right");
|
|
2420
2472
|
this.isAlignmentDropdownOpen = false;
|
|
2421
2473
|
}}
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2474
|
+
size="medium"
|
|
2475
|
+
aria-label="Align right"
|
|
2476
|
+
>
|
|
2477
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
2478
|
+
<lukso-icon
|
|
2479
|
+
name="textalign-right"
|
|
2480
|
+
size="small"
|
|
2481
|
+
pack="vuesax"
|
|
2482
|
+
variant="linear"
|
|
2483
|
+
></lukso-icon>
|
|
2484
|
+
Right
|
|
2485
|
+
</div>
|
|
2486
|
+
</lukso-dropdown-option>
|
|
2487
|
+
</lukso-dropdown>
|
|
2433
2488
|
</div>
|
|
2434
|
-
|
|
2435
|
-
</lukso-dropdown>
|
|
2436
|
-
</div>
|
|
2489
|
+
` : shared_tailwindElement_index.E}
|
|
2437
2490
|
|
|
2438
2491
|
<!-- Color -->
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2492
|
+
${this.toolsState.includes("color") ? shared_tailwindElement_index.x`
|
|
2493
|
+
<div class=${this.styles().colorMenu()}>
|
|
2494
|
+
<lukso-tooltip text="Text color" placement="top">
|
|
2495
|
+
<lukso-button
|
|
2496
|
+
id=${this.colorTriggerId}
|
|
2497
|
+
@click=${(e) => {
|
|
2444
2498
|
e.stopPropagation();
|
|
2445
2499
|
this.restoreFocusAndSelection();
|
|
2446
2500
|
this.isHeadingDropdownOpen = false;
|
|
@@ -2457,66 +2511,70 @@ ${indent}${nextNumber}. `;
|
|
|
2457
2511
|
}
|
|
2458
2512
|
this.isColorDropdownOpen = !this.isColorDropdownOpen;
|
|
2459
2513
|
}}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2514
|
+
aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
|
|
2515
|
+
aria-pressed=${this.activeFormats.color ? "true" : "false"}
|
|
2516
|
+
aria-label="Text color"
|
|
2517
|
+
variant="secondary"
|
|
2518
|
+
size="small"
|
|
2519
|
+
custom-class=${this.toolbarButton({
|
|
2466
2520
|
active: this.activeFormats.color
|
|
2467
2521
|
})}
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
class="text-xs text-neutral-60
|
|
2488
|
-
|
|
2522
|
+
is-icon
|
|
2523
|
+
>
|
|
2524
|
+
<div
|
|
2525
|
+
class="size-4 rounded-full"
|
|
2526
|
+
style="background-color: ${this.activeFormats.activeColor};"
|
|
2527
|
+
></div>
|
|
2528
|
+
</lukso-button>
|
|
2529
|
+
</lukso-tooltip>
|
|
2530
|
+
<lukso-dropdown
|
|
2531
|
+
id="colorDropdown"
|
|
2532
|
+
trigger-id=""
|
|
2533
|
+
size="medium"
|
|
2534
|
+
max-height="300"
|
|
2535
|
+
?is-open=${this.isColorDropdownOpen}
|
|
2536
|
+
>
|
|
2537
|
+
<div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
|
|
2538
|
+
<div
|
|
2539
|
+
class="col-span-8 mb-2 flex items-center justify-between"
|
|
2540
|
+
>
|
|
2541
|
+
<span class="text-xs text-neutral-60">Text Color</span>
|
|
2542
|
+
${this.activeFormats.color ? shared_tailwindElement_index.x`<button
|
|
2543
|
+
class="text-xs text-neutral-60 hover:text-neutral-20 underline"
|
|
2544
|
+
@click=${(e) => {
|
|
2489
2545
|
e.stopPropagation();
|
|
2490
2546
|
this.clearColor();
|
|
2491
2547
|
this.isColorDropdownOpen = false;
|
|
2492
2548
|
}}
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2549
|
+
type="button"
|
|
2550
|
+
aria-label="Clear color"
|
|
2551
|
+
>
|
|
2552
|
+
Clear
|
|
2553
|
+
</button>` : shared_tailwindElement_index.E}
|
|
2554
|
+
</div>
|
|
2555
|
+
${this.colorSamples.map(
|
|
2500
2556
|
(color) => shared_tailwindElement_index.x`
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2557
|
+
<button
|
|
2558
|
+
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"}"
|
|
2559
|
+
style="background-color: ${color}"
|
|
2560
|
+
title=${color}
|
|
2561
|
+
aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
|
|
2562
|
+
aria-label="Color ${color}"
|
|
2563
|
+
@click=${(e) => {
|
|
2508
2564
|
e.stopPropagation();
|
|
2509
2565
|
this.selectColor(color);
|
|
2510
2566
|
this.isColorDropdownOpen = false;
|
|
2511
2567
|
}}
|
|
2512
|
-
|
|
2513
|
-
|
|
2568
|
+
></button>
|
|
2569
|
+
`
|
|
2514
2570
|
)}
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2571
|
+
</div>
|
|
2572
|
+
</lukso-dropdown>
|
|
2573
|
+
</div>
|
|
2574
|
+
` : shared_tailwindElement_index.E}
|
|
2518
2575
|
|
|
2519
|
-
|
|
2576
|
+
<!-- Divider -->
|
|
2577
|
+
${this.toolsState.length > 0 ? shared_tailwindElement_index.x`<div class=${this.styles().divider()}></div>` : shared_tailwindElement_index.E}
|
|
2520
2578
|
</div>
|
|
2521
2579
|
`;
|
|
2522
2580
|
}
|
|
@@ -2561,6 +2619,17 @@ ${indent}${nextNumber}. `;
|
|
|
2561
2619
|
if (!this.previewTextColor) {
|
|
2562
2620
|
this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
|
|
2563
2621
|
}
|
|
2622
|
+
this.toolsState = this.defaultTools;
|
|
2623
|
+
try {
|
|
2624
|
+
if (this.tools) {
|
|
2625
|
+
this.toolsState = JSON.parse(this.tools);
|
|
2626
|
+
}
|
|
2627
|
+
} catch (error) {
|
|
2628
|
+
console.warn(
|
|
2629
|
+
"Invalid JSON for tools property in lukso-markdown-editor. Using default tools.",
|
|
2630
|
+
error
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2564
2633
|
return shared_tailwindElement_index.x`
|
|
2565
2634
|
<div class=${wrapper()}>
|
|
2566
2635
|
${this.labelTemplate()} ${this.descriptionTemplate()}
|
|
@@ -2600,6 +2669,7 @@ ${indent}${nextNumber}. `;
|
|
|
2600
2669
|
>
|
|
2601
2670
|
<lukso-markdown
|
|
2602
2671
|
value=${this.value}
|
|
2672
|
+
?strip-html-tags=${this.stripHtmlTags}
|
|
2603
2673
|
custom-style=${`color: ${this.previewTextColor};`}
|
|
2604
2674
|
></lukso-markdown>
|
|
2605
2675
|
${this.accessibilityIndicatorTemplate()}
|
|
@@ -2662,6 +2732,15 @@ __decorateClass([
|
|
|
2662
2732
|
__decorateClass([
|
|
2663
2733
|
property.n({ type: String, attribute: "preview-text-color", reflect: true })
|
|
2664
2734
|
], exports.LuksoMarkdownEditor.prototype, "previewTextColor", 2);
|
|
2735
|
+
__decorateClass([
|
|
2736
|
+
property.n({ type: Boolean, attribute: "strip-html-tags" })
|
|
2737
|
+
], exports.LuksoMarkdownEditor.prototype, "stripHtmlTags", 2);
|
|
2738
|
+
__decorateClass([
|
|
2739
|
+
property.n({ type: String })
|
|
2740
|
+
], exports.LuksoMarkdownEditor.prototype, "tools", 2);
|
|
2741
|
+
__decorateClass([
|
|
2742
|
+
state.r()
|
|
2743
|
+
], exports.LuksoMarkdownEditor.prototype, "toolsState", 2);
|
|
2665
2744
|
__decorateClass([
|
|
2666
2745
|
state.r()
|
|
2667
2746
|
], exports.LuksoMarkdownEditor.prototype, "savedSelectionForPreview", 2);
|