@xplor-education/core-stencil-components 3.1.2 → 3.1.4
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/components/index.js +28 -3
- package/components/index.js.map +1 -1
- package/components/{p-B49oUO_9.js → p-AzuDJugb.js} +3 -3
- package/components/{p-B49oUO_9.js.map → p-AzuDJugb.js.map} +1 -1
- package/components/{p-D4jVa8dE.js → p-BQ6aLuGP.js} +4 -4
- package/components/{p-D4jVa8dE.js.map → p-BQ6aLuGP.js.map} +1 -1
- package/components/{p-VIJbFoA4.js → p-BZQ63ULK.js} +3 -3
- package/components/{p-VIJbFoA4.js.map → p-BZQ63ULK.js.map} +1 -1
- package/components/{p-BRWe4TXp.js → p-C-gHaxf1.js} +3 -3
- package/components/p-C-gHaxf1.js.map +1 -0
- package/components/{p-Bs_ocvfe.js → p-CyGsSa4H.js} +7 -4
- package/components/p-CyGsSa4H.js.map +1 -0
- package/components/{p-B3zR7peH.js → p-oanCZPh6.js} +4 -4
- package/components/{p-B3zR7peH.js.map → p-oanCZPh6.js.map} +1 -1
- package/components/xplor-alert-message.js +2 -2
- package/components/xplor-avatar-and-name.js +2 -2
- package/components/xplor-avatar.js +1 -1
- package/components/xplor-badge-active.js +1 -1
- package/components/xplor-badge-archived.js +1 -1
- package/components/xplor-badge-deleted.js +1 -1
- package/components/xplor-badge-expired.js +1 -1
- package/components/xplor-badge-inactive.js +1 -1
- package/components/xplor-badge-recalled.js +1 -1
- package/components/xplor-badge-upcoming.js +1 -1
- package/components/xplor-badge-waitlist.js +1 -1
- package/components/xplor-badge.js +1 -1
- package/components/xplor-btn-back-to-parent.js +1 -1
- package/components/xplor-btn-back.js +1 -1
- package/components/xplor-btn-icon.js +1 -1
- package/components/xplor-btn-toggle-group.js +1 -1
- package/components/xplor-btn-toggle-secondary.js +1 -1
- package/components/xplor-btn-toggle.js +1 -1
- package/components/xplor-btn-tooltip.js +3 -3
- package/components/xplor-button.js +1 -1
- package/components/xplor-canvas-editor.d.ts +11 -0
- package/components/xplor-canvas-editor.js +369 -0
- package/components/xplor-canvas-editor.js.map +1 -0
- package/components/xplor-chat-widget.js +3 -3
- package/components/xplor-checkbox.js +1 -1
- package/components/xplor-combobox.js +5 -5
- package/components/xplor-datatable.js +2 -2
- package/components/xplor-date-picker.js +5 -5
- package/components/xplor-drag-and-drop-input.js +26 -5
- package/components/xplor-drag-and-drop-input.js.map +1 -1
- package/components/xplor-dropdown.js +1 -1
- package/components/xplor-expansion-panel.js +4 -4
- package/components/xplor-expansion-panels.js +1 -1
- package/components/xplor-file-upload.js +2 -2
- package/components/xplor-inline-checkbox.js +2 -2
- package/components/xplor-inline-date-picker.js +1 -1
- package/components/xplor-inline-switch.js +1 -1
- package/components/xplor-input-file.js +1 -1
- package/components/xplor-input-search.js +2 -2
- package/components/xplor-input-select.js +2 -2
- package/components/xplor-input-send.js +3 -3
- package/components/xplor-input-text-area.js +2 -2
- package/components/xplor-input-text-secondary.js +2 -2
- package/components/xplor-input-text.js +2 -2
- package/components/xplor-input-title.js +1 -1
- package/components/xplor-links.js +1 -1
- package/components/xplor-modal-persistent.js +2 -2
- package/components/xplor-modal.js +1 -1
- package/components/xplor-nav-tabs.js +2 -2
- package/components/xplor-radio-btn.js +2 -2
- package/components/xplor-rich-text-editor.d.ts +11 -0
- package/components/xplor-rich-text-editor.js +23754 -0
- package/components/xplor-rich-text-editor.js.map +1 -0
- package/components/xplor-section-card.js +2 -2
- package/components/xplor-section-heading.js +2 -2
- package/components/xplor-table.js +5 -5
- package/components/xplor-text-bubble.js +2 -2
- package/components/xplor-text-field.js +2 -2
- package/components/xplor-time-picker.js +6 -6
- package/components/xplor-tooltip.js +1 -1
- package/dist/cjs/{index-BjAapk2n.js → index--_m3aUsf.js} +32 -7
- package/dist/cjs/index--_m3aUsf.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/xplor-alert-dialog_60.cjs.entry.js +29457 -0
- package/dist/cjs/xplor-alert-dialog_60.cjs.entry.js.map +1 -0
- package/dist/cjs/xplor-component-library.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/xplor-alert-message/xplor-alert-message.js +2 -2
- package/dist/collection/components/xplor-avatar/xplor-avatar.js +2 -2
- package/dist/collection/components/xplor-avatar-and-name/xplor-avatar-and-name.js +1 -1
- package/dist/collection/components/xplor-badge/xplor-badge.js +1 -1
- package/dist/collection/components/xplor-badge-active/xplor-badge-active.js +1 -1
- package/dist/collection/components/xplor-badge-archived/xplor-badge-archived.js +1 -1
- package/dist/collection/components/xplor-badge-deleted/xplor-badge-deleted.js +1 -1
- package/dist/collection/components/xplor-badge-expired/xplor-badge-expired.js +1 -1
- package/dist/collection/components/xplor-badge-inactive/xplor-badge-inactive.js +1 -1
- package/dist/collection/components/xplor-badge-recalled/xplor-badge-recalled.js +1 -1
- package/dist/collection/components/xplor-badge-upcoming/xplor-badge-upcoming.js +1 -1
- package/dist/collection/components/xplor-badge-waitlist/xplor-badge-waitlist.js +1 -1
- package/dist/collection/components/xplor-btn-back/xplor-btn-back.js +1 -1
- package/dist/collection/components/xplor-btn-back-to-parent/xplor-btn-back-to-parent.js +1 -1
- package/dist/collection/components/xplor-btn-icon/xplor-btn-icon.js +1 -1
- package/dist/collection/components/xplor-btn-toggle/xplor-btn-toggle.js +1 -1
- package/dist/collection/components/xplor-btn-toggle-group/xplor-btn-toggle-group.js +1 -1
- package/dist/collection/components/xplor-btn-toggle-secondary/xplor-btn-toggle-secondary.js +1 -1
- package/dist/collection/components/xplor-btn-tooltip/xplor-btn-tooltip.js +1 -1
- package/dist/collection/components/xplor-button/xplor-button.css +8 -3
- package/dist/collection/components/xplor-button/xplor-button.js +23 -1
- package/dist/collection/components/xplor-button/xplor-button.js.map +1 -1
- package/dist/collection/components/xplor-canvas-editor/xplor-canvas-editor.css +1224 -0
- package/dist/collection/components/xplor-canvas-editor/xplor-canvas-editor.js +520 -0
- package/dist/collection/components/xplor-canvas-editor/xplor-canvas-editor.js.map +1 -0
- package/dist/collection/components/xplor-canvas-editor/xplor-canvas-editor.stories.js +280 -0
- package/dist/collection/components/xplor-canvas-editor/xplor-canvas-editor.stories.js.map +1 -0
- package/dist/collection/components/xplor-chat-widget/xplor-chat-widget.js +1 -1
- package/dist/collection/components/xplor-checkbox/xplor-checkbox.js +1 -1
- package/dist/collection/components/xplor-combobox/xplor-combobox.js +5 -5
- package/dist/collection/components/xplor-datatable/xplor-datatable.js +2 -2
- package/dist/collection/components/xplor-date-picker/xplor-date-picker.js +4 -4
- package/dist/collection/components/xplor-drag-and-drop-input/xplor-drag-and-drop-input.css +62 -29
- package/dist/collection/components/xplor-drag-and-drop-input/xplor-drag-and-drop-input.js +25 -4
- package/dist/collection/components/xplor-drag-and-drop-input/xplor-drag-and-drop-input.js.map +1 -1
- package/dist/collection/components/xplor-dropdown/xplor-dropdown.js +1 -1
- package/dist/collection/components/xplor-expansion-panel/xplor-expansion-panel.js +4 -4
- package/dist/collection/components/xplor-expansion-panels/xplor-expansion-panels.js +1 -1
- package/dist/collection/components/xplor-file-upload/xplor-file-upload.js +2 -2
- package/dist/collection/components/xplor-inline-checkbox/xplor-inline-checkbox.js +2 -2
- package/dist/collection/components/xplor-inline-date-picker/xplor-inline-date-picker.js +1 -1
- package/dist/collection/components/xplor-inline-switch/xplor-inline-switch.js +1 -1
- package/dist/collection/components/xplor-input-file/xplor-input-file.js +1 -1
- package/dist/collection/components/xplor-input-search/xplor-input-search.js +2 -2
- package/dist/collection/components/xplor-input-select/xplor-input-select.js +2 -2
- package/dist/collection/components/xplor-input-send/xplor-input-send.js +2 -2
- package/dist/collection/components/xplor-input-text/xplor-input-text.js +2 -2
- package/dist/collection/components/xplor-input-text-area/xplor-input-text-area.js +2 -2
- package/dist/collection/components/xplor-input-text-secondary/xplor-input-text-secondary.js +2 -2
- package/dist/collection/components/xplor-input-title/xplor-input-title.js +1 -1
- package/dist/collection/components/xplor-links/xplor-links.js +1 -1
- package/dist/collection/components/xplor-modal/xplor-modal.css +10 -10
- package/dist/collection/components/xplor-modal-persistent/xplor-modal-persistent.js +1 -1
- package/dist/collection/components/xplor-nav-tabs/xplor-nav-tabs.js +2 -2
- package/dist/collection/components/xplor-radio-btn/xplor-radio-btn.js +2 -2
- package/dist/collection/components/xplor-rich-text-editor/xplor-rich-text-editor.css +1445 -0
- package/dist/collection/components/xplor-rich-text-editor/xplor-rich-text-editor.js +800 -0
- package/dist/collection/components/xplor-rich-text-editor/xplor-rich-text-editor.js.map +1 -0
- package/dist/collection/components/xplor-rich-text-editor/xplor-rich-text-editor.stories.js +260 -0
- package/dist/collection/components/xplor-rich-text-editor/xplor-rich-text-editor.stories.js.map +1 -0
- package/dist/collection/components/xplor-section-card/xplor-section-card.js +2 -2
- package/dist/collection/components/xplor-section-heading/xplor-section-heading.js +2 -2
- package/dist/collection/components/xplor-table/xplor-table.js +5 -5
- package/dist/collection/components/xplor-text-bubble/xplor-text-bubble.js +2 -2
- package/dist/collection/components/xplor-text-field/xplor-text-field.js +2 -2
- package/dist/collection/components/xplor-time-picker/xplor-time-picker.js +6 -6
- package/dist/collection/components/xplor-tooltip/xplor-tooltip.js +2 -2
- package/dist/collection/utils/slate-legacy-converter.js +223 -0
- package/dist/collection/utils/slate-legacy-converter.js.map +1 -0
- package/dist/components/index.js +28 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-04oMLTZR.js → p-B7FEf2_x.js} +3 -3
- package/dist/components/p-B7FEf2_x.js.map +1 -0
- package/dist/components/{p--zhT6rvJ.js → p-DGaHlr-k.js} +4 -4
- package/dist/components/{p--zhT6rvJ.js.map → p-DGaHlr-k.js.map} +1 -1
- package/dist/components/{p-B5rS_jjI.js → p-DWaTb2EJ.js} +7 -4
- package/dist/components/p-DWaTb2EJ.js.map +1 -0
- package/dist/components/{p-J41B2nOt.js → p-DroQBoSo.js} +3 -3
- package/dist/components/{p-J41B2nOt.js.map → p-DroQBoSo.js.map} +1 -1
- package/dist/components/{p-DQ8MCJFX.js → p-TfYzqGwr.js} +3 -3
- package/dist/components/{p-DQ8MCJFX.js.map → p-TfYzqGwr.js.map} +1 -1
- package/dist/components/{p-DbQ6ZNvh.js → p-vl-J3tKJ.js} +4 -4
- package/dist/components/{p-DbQ6ZNvh.js.map → p-vl-J3tKJ.js.map} +1 -1
- package/dist/components/xplor-alert-message.js +2 -2
- package/dist/components/xplor-avatar-and-name.js +2 -2
- package/dist/components/xplor-avatar.js +1 -1
- package/dist/components/xplor-badge-active.js +1 -1
- package/dist/components/xplor-badge-archived.js +1 -1
- package/dist/components/xplor-badge-deleted.js +1 -1
- package/dist/components/xplor-badge-expired.js +1 -1
- package/dist/components/xplor-badge-inactive.js +1 -1
- package/dist/components/xplor-badge-recalled.js +1 -1
- package/dist/components/xplor-badge-upcoming.js +1 -1
- package/dist/components/xplor-badge-waitlist.js +1 -1
- package/dist/components/xplor-badge.js +1 -1
- package/dist/components/xplor-btn-back-to-parent.js +1 -1
- package/dist/components/xplor-btn-back.js +1 -1
- package/dist/components/xplor-btn-icon.js +1 -1
- package/dist/components/xplor-btn-toggle-group.js +1 -1
- package/dist/components/xplor-btn-toggle-secondary.js +1 -1
- package/dist/components/xplor-btn-toggle.js +1 -1
- package/dist/components/xplor-btn-tooltip.js +3 -3
- package/dist/components/xplor-button.js +1 -1
- package/dist/components/xplor-canvas-editor.d.ts +11 -0
- package/dist/components/xplor-canvas-editor.js +370 -0
- package/dist/components/xplor-canvas-editor.js.map +1 -0
- package/dist/components/xplor-chat-widget.js +3 -3
- package/dist/components/xplor-checkbox.js +1 -1
- package/dist/components/xplor-combobox.js +5 -5
- package/dist/components/xplor-datatable.js +2 -2
- package/dist/components/xplor-date-picker.js +5 -5
- package/dist/components/xplor-drag-and-drop-input.js +26 -5
- package/dist/components/xplor-drag-and-drop-input.js.map +1 -1
- package/dist/components/xplor-dropdown.js +1 -1
- package/dist/components/xplor-expansion-panel.js +4 -4
- package/dist/components/xplor-expansion-panels.js +1 -1
- package/dist/components/xplor-file-upload.js +2 -2
- package/dist/components/xplor-inline-checkbox.js +2 -2
- package/dist/components/xplor-inline-date-picker.js +1 -1
- package/dist/components/xplor-inline-switch.js +1 -1
- package/dist/components/xplor-input-file.js +1 -1
- package/dist/components/xplor-input-search.js +2 -2
- package/dist/components/xplor-input-select.js +2 -2
- package/dist/components/xplor-input-send.js +3 -3
- package/dist/components/xplor-input-text-area.js +2 -2
- package/dist/components/xplor-input-text-secondary.js +2 -2
- package/dist/components/xplor-input-text.js +2 -2
- package/dist/components/xplor-input-title.js +1 -1
- package/dist/components/xplor-links.js +1 -1
- package/dist/components/xplor-modal-persistent.js +2 -2
- package/dist/components/xplor-modal.js +1 -1
- package/dist/components/xplor-nav-tabs.js +2 -2
- package/dist/components/xplor-radio-btn.js +2 -2
- package/dist/components/xplor-rich-text-editor.d.ts +11 -0
- package/dist/components/xplor-rich-text-editor.js +23755 -0
- package/dist/components/xplor-rich-text-editor.js.map +1 -0
- package/dist/components/xplor-section-card.js +2 -2
- package/dist/components/xplor-section-heading.js +2 -2
- package/dist/components/xplor-table.js +5 -5
- package/dist/components/xplor-text-bubble.js +2 -2
- package/dist/components/xplor-text-field.js +2 -2
- package/dist/components/xplor-time-picker.js +6 -6
- package/dist/components/xplor-tooltip.js +1 -1
- package/dist/esm/{index-KRfMjDC2.js → index-QwDfQUbw.js} +32 -7
- package/dist/esm/index-QwDfQUbw.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/xplor-alert-dialog_60.entry.js +29396 -0
- package/dist/esm/xplor-alert-dialog_60.entry.js.map +1 -0
- package/dist/esm/xplor-component-library.js +3 -3
- package/dist/hydrate/index.js +24231 -96
- package/dist/hydrate/index.mjs +24231 -96
- package/dist/types/components/xplor-button/xplor-button.d.ts +2 -0
- package/dist/types/components/xplor-canvas-editor/xplor-canvas-editor.d.ts +63 -0
- package/dist/types/components/xplor-canvas-editor/xplor-canvas-editor.stories.d.ts +84 -0
- package/dist/types/components/xplor-drag-and-drop-input/xplor-drag-and-drop-input.d.ts +6 -0
- package/dist/types/components/xplor-rich-text-editor/xplor-rich-text-editor.d.ts +129 -0
- package/dist/types/components/xplor-rich-text-editor/xplor-rich-text-editor.stories.d.ts +105 -0
- package/dist/types/components.d.ts +286 -0
- package/dist/types/utils/slate-legacy-converter.d.ts +83 -0
- package/dist/xplor-component-library/p-0d477ec2.entry.js +2 -0
- package/dist/xplor-component-library/p-0d477ec2.entry.js.map +1 -0
- package/dist/xplor-component-library/p-QwDfQUbw.js +3 -0
- package/dist/xplor-component-library/p-QwDfQUbw.js.map +1 -0
- package/dist/xplor-component-library/xplor-component-library.css +1 -1
- package/dist/xplor-component-library/xplor-component-library.esm.js +1 -1
- package/package.json +7 -1
- package/components/p-BRWe4TXp.js.map +0 -1
- package/components/p-Bs_ocvfe.js.map +0 -1
- package/dist/cjs/index-BjAapk2n.js.map +0 -1
- package/dist/cjs/xplor-alert-dialog_58.cjs.entry.js +0 -5395
- package/dist/cjs/xplor-alert-dialog_58.cjs.entry.js.map +0 -1
- package/dist/components/p-04oMLTZR.js.map +0 -1
- package/dist/components/p-B5rS_jjI.js.map +0 -1
- package/dist/esm/index-KRfMjDC2.js.map +0 -1
- package/dist/esm/xplor-alert-dialog_58.entry.js +0 -5336
- package/dist/esm/xplor-alert-dialog_58.entry.js.map +0 -1
- package/dist/xplor-component-library/p-7ecb45dd.entry.js +0 -2
- package/dist/xplor-component-library/p-7ecb45dd.entry.js.map +0 -1
- package/dist/xplor-component-library/p-KRfMjDC2.js +0 -3
- package/dist/xplor-component-library/p-KRfMjDC2.js.map +0 -1
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
4
|
+
import Underline from "@tiptap/extension-underline";
|
|
5
|
+
import Link from "@tiptap/extension-link";
|
|
6
|
+
import Placeholder from "@tiptap/extension-placeholder";
|
|
7
|
+
import CharacterCount from "@tiptap/extension-character-count";
|
|
8
|
+
import { convertLegacySlateJsonToHtml, } from "../../utils/slate-legacy-converter";
|
|
9
|
+
let rteIdCounter = 0;
|
|
10
|
+
export class XplorRichTextEditor {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.editor = null;
|
|
13
|
+
this.editorId = `xplor-rte-${++rteIdCounter}`;
|
|
14
|
+
this.toolbarId = `${this.editorId}-toolbar`;
|
|
15
|
+
this.charCountId = `${this.editorId}-char-count`;
|
|
16
|
+
this.labelId = `${this.editorId}-label`;
|
|
17
|
+
// -------------------------------------------------------------------------
|
|
18
|
+
// Props
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* HTML string content of the editor. Supports two-way binding via xplorChange.
|
|
22
|
+
*/
|
|
23
|
+
this.value = '';
|
|
24
|
+
/**
|
|
25
|
+
* Stringified Slate 0.42.x document JSON for backwards compatibility.
|
|
26
|
+
* When supplied, this takes precedence over `value` as the initial content.
|
|
27
|
+
*/
|
|
28
|
+
this.legacySlateDocument = '';
|
|
29
|
+
/**
|
|
30
|
+
* Placeholder text shown when the editor is empty.
|
|
31
|
+
*/
|
|
32
|
+
this.placeholder = 'Start typing…';
|
|
33
|
+
/**
|
|
34
|
+
* Visible label above the editor.
|
|
35
|
+
*/
|
|
36
|
+
this.label = '';
|
|
37
|
+
/**
|
|
38
|
+
* Marks the field as required. Adds an asterisk to the label.
|
|
39
|
+
*/
|
|
40
|
+
this.required = false;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the editor is in read-only mode. Content is visible but not editable.
|
|
43
|
+
* The toolbar is hidden in this mode.
|
|
44
|
+
*/
|
|
45
|
+
this.readonly = false;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the editor is disabled. Content cannot be edited or interacted with.
|
|
48
|
+
*/
|
|
49
|
+
this.disabled = false;
|
|
50
|
+
/**
|
|
51
|
+
* Accessible label for the editor region. Used when no `label` prop or
|
|
52
|
+
* `ariaLabelledBy` is provided.
|
|
53
|
+
*/
|
|
54
|
+
this.ariaLabel = '';
|
|
55
|
+
/**
|
|
56
|
+
* ID of an external element that labels this editor (aria-labelledby).
|
|
57
|
+
*/
|
|
58
|
+
this.ariaLabelledBy = '';
|
|
59
|
+
/**
|
|
60
|
+
* Controls which toolbar buttons are rendered.
|
|
61
|
+
* - `full` — All formatting options (default)
|
|
62
|
+
* - `minimal` — Text style buttons only (bold, italic, underline, strike, code)
|
|
63
|
+
* - `none` — No toolbar; editor acts as a plain rich-text input
|
|
64
|
+
*/
|
|
65
|
+
this.toolbar = 'full';
|
|
66
|
+
/**
|
|
67
|
+
* Maximum character count. When set, a character counter is shown below the editor.
|
|
68
|
+
*/
|
|
69
|
+
this.maxLength = undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Validation error message. Turns the editor border red and shows the message below.
|
|
72
|
+
*/
|
|
73
|
+
this.error = '';
|
|
74
|
+
/**
|
|
75
|
+
* Helper text shown below the editor when there is no error.
|
|
76
|
+
*/
|
|
77
|
+
this.helperText = '';
|
|
78
|
+
// -------------------------------------------------------------------------
|
|
79
|
+
// Internal state
|
|
80
|
+
// -------------------------------------------------------------------------
|
|
81
|
+
/** Incremented on every TipTap transaction to force toolbar re-render */
|
|
82
|
+
this.editorVersion = 0;
|
|
83
|
+
this.isFocused = false;
|
|
84
|
+
this.showLinkPopover = false;
|
|
85
|
+
this.linkUrl = '';
|
|
86
|
+
this.charCount = 0;
|
|
87
|
+
this.handleLinkButtonClick = (event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
if (!this.editor || this.disabled || this.readonly)
|
|
90
|
+
return;
|
|
91
|
+
if (this.editor.isActive('link')) {
|
|
92
|
+
// Remove existing link
|
|
93
|
+
this.editor.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Pre-populate URL input with existing href if cursor is on a link
|
|
97
|
+
this.linkUrl = this.editor.getAttributes('link').href || '';
|
|
98
|
+
this.showLinkPopover = !this.showLinkPopover;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
this.handleLinkSubmit = (event) => {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
if (!this.editor)
|
|
104
|
+
return;
|
|
105
|
+
const url = this.linkUrl.trim();
|
|
106
|
+
if (url) {
|
|
107
|
+
this.editor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.editor.chain().focus().extendMarkRange('link').unsetLink().run();
|
|
111
|
+
}
|
|
112
|
+
this.showLinkPopover = false;
|
|
113
|
+
this.linkUrl = '';
|
|
114
|
+
};
|
|
115
|
+
this.handleLinkCancel = () => {
|
|
116
|
+
this.showLinkPopover = false;
|
|
117
|
+
this.linkUrl = '';
|
|
118
|
+
};
|
|
119
|
+
this.handleLinkKeyDown = (event) => {
|
|
120
|
+
if (event.key === 'Escape') {
|
|
121
|
+
this.showLinkPopover = false;
|
|
122
|
+
this.linkUrl = '';
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// -------------------------------------------------------------------------
|
|
127
|
+
// Lifecycle
|
|
128
|
+
// -------------------------------------------------------------------------
|
|
129
|
+
componentDidLoad() {
|
|
130
|
+
this.initEditor();
|
|
131
|
+
}
|
|
132
|
+
disconnectedCallback() {
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
135
|
+
this.editor = null;
|
|
136
|
+
}
|
|
137
|
+
// -------------------------------------------------------------------------
|
|
138
|
+
// Watchers
|
|
139
|
+
// -------------------------------------------------------------------------
|
|
140
|
+
handleValueChange(newValue) {
|
|
141
|
+
if (!this.editor)
|
|
142
|
+
return;
|
|
143
|
+
// Avoid a feedback loop — only sync if externally changed
|
|
144
|
+
if (this.editor.getHTML() !== newValue) {
|
|
145
|
+
this.editor.commands.setContent(newValue || '', false);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
handleReadonlyChange() {
|
|
149
|
+
var _a;
|
|
150
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.setEditable(!this.readonly && !this.disabled);
|
|
151
|
+
}
|
|
152
|
+
handleDisabledChange() {
|
|
153
|
+
var _a;
|
|
154
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.setEditable(!this.readonly && !this.disabled);
|
|
155
|
+
}
|
|
156
|
+
handleLegacyDocChange(newValue) {
|
|
157
|
+
if (!newValue || !this.editor)
|
|
158
|
+
return;
|
|
159
|
+
const html = convertLegacySlateJsonToHtml(newValue);
|
|
160
|
+
this.editor.commands.setContent(html, false);
|
|
161
|
+
}
|
|
162
|
+
// -------------------------------------------------------------------------
|
|
163
|
+
// Public methods
|
|
164
|
+
// -------------------------------------------------------------------------
|
|
165
|
+
/**
|
|
166
|
+
* Returns the current content as an HTML string.
|
|
167
|
+
*/
|
|
168
|
+
async getHTMLContent() {
|
|
169
|
+
var _a, _b;
|
|
170
|
+
return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getHTML()) !== null && _b !== void 0 ? _b : '';
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Returns the current content as plain text (all markup stripped).
|
|
174
|
+
*/
|
|
175
|
+
async getText() {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getText()) !== null && _b !== void 0 ? _b : '';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Replaces the editor content with the provided HTML string.
|
|
181
|
+
*/
|
|
182
|
+
async setContent(html) {
|
|
183
|
+
var _a;
|
|
184
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.commands.setContent(html, false);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Clears all content from the editor.
|
|
188
|
+
*/
|
|
189
|
+
async clearContent() {
|
|
190
|
+
var _a;
|
|
191
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.commands.clearContent(true);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Programmatically focuses the editor.
|
|
195
|
+
*/
|
|
196
|
+
async focusEditor() {
|
|
197
|
+
var _a;
|
|
198
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.commands.focus();
|
|
199
|
+
}
|
|
200
|
+
// -------------------------------------------------------------------------
|
|
201
|
+
// Private: Editor initialisation
|
|
202
|
+
// -------------------------------------------------------------------------
|
|
203
|
+
initEditor() {
|
|
204
|
+
var _a, _b, _c;
|
|
205
|
+
// Resolve initial content — legacy doc takes precedence over value
|
|
206
|
+
let initialContent = '';
|
|
207
|
+
if (this.legacySlateDocument) {
|
|
208
|
+
initialContent = convertLegacySlateJsonToHtml(this.legacySlateDocument);
|
|
209
|
+
}
|
|
210
|
+
else if (this.value) {
|
|
211
|
+
initialContent = this.value;
|
|
212
|
+
}
|
|
213
|
+
const extensions = [
|
|
214
|
+
StarterKit,
|
|
215
|
+
Underline,
|
|
216
|
+
Link.configure({ openOnClick: false, autolink: true }),
|
|
217
|
+
Placeholder.configure({ placeholder: this.placeholder }),
|
|
218
|
+
];
|
|
219
|
+
if (this.maxLength != null) {
|
|
220
|
+
extensions.push(CharacterCount.configure({ limit: this.maxLength }));
|
|
221
|
+
}
|
|
222
|
+
this.editor = new Editor({
|
|
223
|
+
element: this.editorEl,
|
|
224
|
+
extensions,
|
|
225
|
+
content: initialContent,
|
|
226
|
+
editable: !this.readonly && !this.disabled,
|
|
227
|
+
onUpdate: ({ editor }) => {
|
|
228
|
+
var _a, _b, _c;
|
|
229
|
+
const html = editor.getHTML();
|
|
230
|
+
this.value = html;
|
|
231
|
+
if (this.maxLength != null) {
|
|
232
|
+
this.charCount = (_c = (_b = (_a = editor.storage) === null || _a === void 0 ? void 0 : _a.characterCount) === null || _b === void 0 ? void 0 : _b.characters()) !== null && _c !== void 0 ? _c : 0;
|
|
233
|
+
}
|
|
234
|
+
this.xplorChange.emit({
|
|
235
|
+
html,
|
|
236
|
+
text: editor.getText(),
|
|
237
|
+
isEmpty: editor.isEmpty,
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
onFocus: () => {
|
|
241
|
+
this.isFocused = true;
|
|
242
|
+
this.xplorFocus.emit();
|
|
243
|
+
},
|
|
244
|
+
onBlur: () => {
|
|
245
|
+
this.isFocused = false;
|
|
246
|
+
this.showLinkPopover = false;
|
|
247
|
+
this.xplorBlur.emit();
|
|
248
|
+
},
|
|
249
|
+
// Increment editorVersion on every transaction + selection change so the
|
|
250
|
+
// toolbar re-renders with up-to-date isActive() states.
|
|
251
|
+
onTransaction: () => {
|
|
252
|
+
this.editorVersion += 1;
|
|
253
|
+
},
|
|
254
|
+
onSelectionUpdate: () => {
|
|
255
|
+
this.editorVersion += 1;
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
// Set initial char count
|
|
259
|
+
if (this.maxLength != null) {
|
|
260
|
+
this.charCount = (_c = (_b = (_a = this.editor.storage) === null || _a === void 0 ? void 0 : _a.characterCount) === null || _b === void 0 ? void 0 : _b.characters()) !== null && _c !== void 0 ? _c : 0;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// -------------------------------------------------------------------------
|
|
264
|
+
// Private: Toolbar command helpers
|
|
265
|
+
// -------------------------------------------------------------------------
|
|
266
|
+
execCommand(command, event) {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
if (!this.editor || this.disabled || this.readonly)
|
|
269
|
+
return;
|
|
270
|
+
command();
|
|
271
|
+
}
|
|
272
|
+
// -------------------------------------------------------------------------
|
|
273
|
+
// Private: Render helpers
|
|
274
|
+
// -------------------------------------------------------------------------
|
|
275
|
+
renderToolbarButton(label, isActive, onClick, iconContent) {
|
|
276
|
+
return (h("button", { type: "button", class: {
|
|
277
|
+
'xplor-rte__toolbar-btn': true,
|
|
278
|
+
'xplor-rte__toolbar-btn--active': isActive,
|
|
279
|
+
}, "aria-label": label, "aria-pressed": String(isActive), title: label, disabled: this.disabled || this.readonly, onClick: onClick }, iconContent));
|
|
280
|
+
}
|
|
281
|
+
renderLinkPopover() {
|
|
282
|
+
return (h("div", { class: "xplor-rte__link-popover", role: "dialog", "aria-label": "Insert link", "aria-modal": "false" }, h("form", { onSubmit: this.handleLinkSubmit, class: "xplor-rte__link-form" }, h("label", { class: "xplor-rte__link-label", htmlFor: `${this.editorId}-link-input` }, "URL"), h("input", { id: `${this.editorId}-link-input`, class: "xplor-rte__link-input", type: "url", placeholder: "https://example.com", value: this.linkUrl, onInput: (e) => {
|
|
283
|
+
this.linkUrl = e.target.value;
|
|
284
|
+
}, onKeyDown: this.handleLinkKeyDown, autoFocus: true }), h("div", { class: "xplor-rte__link-actions" }, h("button", { type: "submit", class: "xplor-rte__link-apply" }, "Apply"), h("button", { type: "button", class: "xplor-rte__link-cancel", onClick: this.handleLinkCancel }, "Cancel")))));
|
|
285
|
+
}
|
|
286
|
+
renderToolbar() {
|
|
287
|
+
if (this.toolbar === 'none' || !this.editor)
|
|
288
|
+
return null;
|
|
289
|
+
const e = this.editor;
|
|
290
|
+
const isMinimal = this.toolbar === 'minimal';
|
|
291
|
+
// --- Text style buttons (shared between full and minimal) ---
|
|
292
|
+
const textStyleGroup = (h("div", { class: "xplor-rte__toolbar-group", role: "group", "aria-label": "Text style" }, this.renderToolbarButton('Bold (Ctrl+B)', e.isActive('bold'), (ev) => this.execCommand(() => e.chain().focus().toggleBold().run(), ev),
|
|
293
|
+
// Bold icon
|
|
294
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M15.6 11.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5S13.83 9.5 13 9.5h-3V6.5zm3.5 9H10V13h3.5c.83 0 1.5.67 1.5 1.5S14.33 15.5 13.5 15.5z" }))), this.renderToolbarButton('Italic (Ctrl+I)', e.isActive('italic'), (ev) => this.execCommand(() => e.chain().focus().toggleItalic().run(), ev),
|
|
295
|
+
// Italic icon
|
|
296
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z" }))), this.renderToolbarButton('Underline (Ctrl+U)', e.isActive('underline'), (ev) => this.execCommand(() => e.chain().focus().toggleUnderline().run(), ev),
|
|
297
|
+
// Underline icon
|
|
298
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z" }))), this.renderToolbarButton('Strikethrough', e.isActive('strike'), (ev) => this.execCommand(() => e.chain().focus().toggleStrike().run(), ev),
|
|
299
|
+
// Strikethrough icon
|
|
300
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34.92-2.34 1.69 0 .48.25.88.74 1.21L13.25 9H7.39c-.21-.28-.54-.71-.54-1.92zM21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H7.4c0 1.97.93 5.15 5.85 5.15 3.47 0 5.37-1.96 5.37-4.15 0-.87-.23-1.58-.62-2.13z" }))), this.renderToolbarButton('Inline code', e.isActive('code'), (ev) => this.execCommand(() => e.chain().focus().toggleCode().run(), ev),
|
|
301
|
+
// Code icon
|
|
302
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z" })))));
|
|
303
|
+
if (isMinimal) {
|
|
304
|
+
return (h("div", { id: this.toolbarId, class: "xplor-rte__toolbar", role: "toolbar", "aria-label": "Text formatting", "aria-controls": this.editorId }, textStyleGroup));
|
|
305
|
+
}
|
|
306
|
+
return (h("div", { id: this.toolbarId, class: "xplor-rte__toolbar", role: "toolbar", "aria-label": "Text formatting", "aria-controls": this.editorId }, textStyleGroup, h("div", { class: "xplor-rte__toolbar-divider", "aria-hidden": "true" }), h("div", { class: "xplor-rte__toolbar-group", role: "group", "aria-label": "Headings" }, [1, 2, 3].map((level) => this.renderToolbarButton(`Heading ${level}`, e.isActive('heading', { level }), (ev) => this.execCommand(() => e.chain().focus().toggleHeading({ level }).run(), ev), h("span", { class: "xplor-rte__toolbar-text", "aria-hidden": "true" }, "H", level)))), h("div", { class: "xplor-rte__toolbar-divider", "aria-hidden": "true" }), h("div", { class: "xplor-rte__toolbar-group", role: "group", "aria-label": "Lists" }, this.renderToolbarButton('Bullet list', e.isActive('bulletList'), (ev) => this.execCommand(() => e.chain().focus().toggleBulletList().run(), ev),
|
|
307
|
+
// Bullet list icon
|
|
308
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z" }))), this.renderToolbarButton('Numbered list', e.isActive('orderedList'), (ev) => this.execCommand(() => e.chain().focus().toggleOrderedList().run(), ev),
|
|
309
|
+
// Ordered list icon
|
|
310
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" })))), h("div", { class: "xplor-rte__toolbar-divider", "aria-hidden": "true" }), h("div", { class: "xplor-rte__toolbar-group", role: "group", "aria-label": "Block elements" }, this.renderToolbarButton('Blockquote', e.isActive('blockquote'), (ev) => this.execCommand(() => e.chain().focus().toggleBlockquote().run(), ev),
|
|
311
|
+
// Blockquote icon
|
|
312
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }))), this.renderToolbarButton('Code block', e.isActive('codeBlock'), (ev) => this.execCommand(() => e.chain().focus().toggleCodeBlock().run(), ev),
|
|
313
|
+
// Code block icon
|
|
314
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z" })))), h("div", { class: "xplor-rte__toolbar-divider", "aria-hidden": "true" }), h("div", { class: "xplor-rte__toolbar-group", role: "group", "aria-label": "Insert and utilities" }, h("div", { class: "xplor-rte__link-wrapper" }, this.renderToolbarButton(e.isActive('link') ? 'Remove link' : 'Insert link', e.isActive('link'), this.handleLinkButtonClick,
|
|
315
|
+
// Link icon
|
|
316
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z" }))), this.showLinkPopover && this.renderLinkPopover()), this.renderToolbarButton('Clear formatting', false, (ev) => this.execCommand(() => e.chain().focus().clearNodes().unsetAllMarks().run(), ev),
|
|
317
|
+
// Clear formatting icon
|
|
318
|
+
h("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, h("path", { d: "M6 19h4v-2H6v2zM3 5v2h18V5H3zm3 9h7v-2H6v2zm10.88-3.36L18.3 9.2l1.41 1.41-1.42 1.43 1.42 1.41-1.41 1.41-1.42-1.41-1.41 1.41-1.41-1.41 1.41-1.41-1.41-1.43 1.41-1.41 1.41 1.43z" }))))));
|
|
319
|
+
}
|
|
320
|
+
// -------------------------------------------------------------------------
|
|
321
|
+
// Render
|
|
322
|
+
// -------------------------------------------------------------------------
|
|
323
|
+
render() {
|
|
324
|
+
const hasError = !!this.error;
|
|
325
|
+
const showCharCount = this.maxLength != null;
|
|
326
|
+
const charCountDescribedBy = showCharCount ? this.charCountId : undefined;
|
|
327
|
+
const describedBy = charCountDescribedBy || undefined;
|
|
328
|
+
// Resolve aria-label / aria-labelledby precedence:
|
|
329
|
+
// 1. External ariaLabelledBy prop
|
|
330
|
+
// 2. Internal label element (rendered via labelId)
|
|
331
|
+
// 3. ariaLabel prop (falls back to default)
|
|
332
|
+
const effectiveLabelledBy = this.ariaLabelledBy || (this.label ? this.labelId : undefined);
|
|
333
|
+
const effectiveAriaLabel = !effectiveLabelledBy
|
|
334
|
+
? this.ariaLabel || 'Rich text editor'
|
|
335
|
+
: undefined;
|
|
336
|
+
const containerClasses = {
|
|
337
|
+
'xplor-rte': true,
|
|
338
|
+
'xplor-rte--focused': this.isFocused,
|
|
339
|
+
'xplor-rte--disabled': this.disabled,
|
|
340
|
+
'xplor-rte--readonly': this.readonly,
|
|
341
|
+
'xplor-rte--error': hasError,
|
|
342
|
+
'xplor-rte--has-toolbar': this.toolbar !== 'none',
|
|
343
|
+
};
|
|
344
|
+
return (h(Host, { key: 'd15876a85220e846333352ee11c52960a17341be' }, this.label && (h("label", { key: 'ecc7035c2cb8543b4c7447b2aa6665f53260959a', class: "xplor-rte__label", id: this.labelId, htmlFor: this.editorId }, this.label, this.required && (h("span", { key: '8c5e9b8eb1efe34faa289748e8393a3261099489', class: "xplor-rte__required", "aria-hidden": "true" }, ' ', "*")))), h("div", { key: 'bd0b1c75612f26d7f7ee13cfcec584ebf6349f3a', class: containerClasses }, this.renderToolbar(), h("div", { key: 'ec047a31509004185b3be5abaa939a0278e86243', class: "xplor-rte__content", id: this.editorId, ref: (el) => {
|
|
345
|
+
this.editorEl = el;
|
|
346
|
+
}, "aria-label": effectiveAriaLabel, "aria-labelledby": effectiveLabelledBy, "aria-multiline": "true", "aria-readonly": this.readonly ? 'true' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, "aria-required": this.required ? 'true' : undefined, "aria-describedby": describedBy, "aria-invalid": hasError ? 'true' : undefined }), showCharCount && (h("div", { key: '4b7806ebfe4356fcfbf71192385875897dbba4fa', id: this.charCountId, class: {
|
|
347
|
+
'xplor-rte__char-count': true,
|
|
348
|
+
'xplor-rte__char-count--limit': this.charCount >= this.maxLength,
|
|
349
|
+
}, role: "status", "aria-live": "polite", "aria-atomic": "true" }, this.charCount, " / ", this.maxLength))), hasError && (h("div", { key: 'b2892869df2c26f02158d30d8bf6ee239e503de3', class: "xplor-rte__error", role: "alert", "aria-live": "assertive" }, this.error)), !hasError && this.helperText && (h("div", { key: 'ca2eb4562b4d514f6602b915ef76e85dc8dc6b02', class: "xplor-rte__helper" }, this.helperText))));
|
|
350
|
+
}
|
|
351
|
+
static get is() { return "xplor-rich-text-editor"; }
|
|
352
|
+
static get encapsulation() { return "scoped"; }
|
|
353
|
+
static get originalStyleUrls() {
|
|
354
|
+
return {
|
|
355
|
+
"$": ["xplor-rich-text-editor.scss"]
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
static get styleUrls() {
|
|
359
|
+
return {
|
|
360
|
+
"$": ["xplor-rich-text-editor.css"]
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
static get properties() {
|
|
364
|
+
return {
|
|
365
|
+
"value": {
|
|
366
|
+
"type": "string",
|
|
367
|
+
"attribute": "value",
|
|
368
|
+
"mutable": true,
|
|
369
|
+
"complexType": {
|
|
370
|
+
"original": "string",
|
|
371
|
+
"resolved": "string",
|
|
372
|
+
"references": {}
|
|
373
|
+
},
|
|
374
|
+
"required": false,
|
|
375
|
+
"optional": false,
|
|
376
|
+
"docs": {
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": "HTML string content of the editor. Supports two-way binding via xplorChange."
|
|
379
|
+
},
|
|
380
|
+
"getter": false,
|
|
381
|
+
"setter": false,
|
|
382
|
+
"reflect": false,
|
|
383
|
+
"defaultValue": "''"
|
|
384
|
+
},
|
|
385
|
+
"legacySlateDocument": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"attribute": "legacy-slate-document",
|
|
388
|
+
"mutable": false,
|
|
389
|
+
"complexType": {
|
|
390
|
+
"original": "string",
|
|
391
|
+
"resolved": "string",
|
|
392
|
+
"references": {}
|
|
393
|
+
},
|
|
394
|
+
"required": false,
|
|
395
|
+
"optional": false,
|
|
396
|
+
"docs": {
|
|
397
|
+
"tags": [],
|
|
398
|
+
"text": "Stringified Slate 0.42.x document JSON for backwards compatibility.\nWhen supplied, this takes precedence over `value` as the initial content."
|
|
399
|
+
},
|
|
400
|
+
"getter": false,
|
|
401
|
+
"setter": false,
|
|
402
|
+
"reflect": false,
|
|
403
|
+
"defaultValue": "''"
|
|
404
|
+
},
|
|
405
|
+
"placeholder": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"attribute": "placeholder",
|
|
408
|
+
"mutable": false,
|
|
409
|
+
"complexType": {
|
|
410
|
+
"original": "string",
|
|
411
|
+
"resolved": "string",
|
|
412
|
+
"references": {}
|
|
413
|
+
},
|
|
414
|
+
"required": false,
|
|
415
|
+
"optional": false,
|
|
416
|
+
"docs": {
|
|
417
|
+
"tags": [],
|
|
418
|
+
"text": "Placeholder text shown when the editor is empty."
|
|
419
|
+
},
|
|
420
|
+
"getter": false,
|
|
421
|
+
"setter": false,
|
|
422
|
+
"reflect": false,
|
|
423
|
+
"defaultValue": "'Start typing\u2026'"
|
|
424
|
+
},
|
|
425
|
+
"label": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"attribute": "label",
|
|
428
|
+
"mutable": false,
|
|
429
|
+
"complexType": {
|
|
430
|
+
"original": "string",
|
|
431
|
+
"resolved": "string",
|
|
432
|
+
"references": {}
|
|
433
|
+
},
|
|
434
|
+
"required": false,
|
|
435
|
+
"optional": false,
|
|
436
|
+
"docs": {
|
|
437
|
+
"tags": [],
|
|
438
|
+
"text": "Visible label above the editor."
|
|
439
|
+
},
|
|
440
|
+
"getter": false,
|
|
441
|
+
"setter": false,
|
|
442
|
+
"reflect": false,
|
|
443
|
+
"defaultValue": "''"
|
|
444
|
+
},
|
|
445
|
+
"required": {
|
|
446
|
+
"type": "boolean",
|
|
447
|
+
"attribute": "required",
|
|
448
|
+
"mutable": false,
|
|
449
|
+
"complexType": {
|
|
450
|
+
"original": "boolean",
|
|
451
|
+
"resolved": "boolean",
|
|
452
|
+
"references": {}
|
|
453
|
+
},
|
|
454
|
+
"required": false,
|
|
455
|
+
"optional": false,
|
|
456
|
+
"docs": {
|
|
457
|
+
"tags": [],
|
|
458
|
+
"text": "Marks the field as required. Adds an asterisk to the label."
|
|
459
|
+
},
|
|
460
|
+
"getter": false,
|
|
461
|
+
"setter": false,
|
|
462
|
+
"reflect": false,
|
|
463
|
+
"defaultValue": "false"
|
|
464
|
+
},
|
|
465
|
+
"readonly": {
|
|
466
|
+
"type": "boolean",
|
|
467
|
+
"attribute": "readonly",
|
|
468
|
+
"mutable": false,
|
|
469
|
+
"complexType": {
|
|
470
|
+
"original": "boolean",
|
|
471
|
+
"resolved": "boolean",
|
|
472
|
+
"references": {}
|
|
473
|
+
},
|
|
474
|
+
"required": false,
|
|
475
|
+
"optional": false,
|
|
476
|
+
"docs": {
|
|
477
|
+
"tags": [],
|
|
478
|
+
"text": "Whether the editor is in read-only mode. Content is visible but not editable.\nThe toolbar is hidden in this mode."
|
|
479
|
+
},
|
|
480
|
+
"getter": false,
|
|
481
|
+
"setter": false,
|
|
482
|
+
"reflect": false,
|
|
483
|
+
"defaultValue": "false"
|
|
484
|
+
},
|
|
485
|
+
"disabled": {
|
|
486
|
+
"type": "boolean",
|
|
487
|
+
"attribute": "disabled",
|
|
488
|
+
"mutable": false,
|
|
489
|
+
"complexType": {
|
|
490
|
+
"original": "boolean",
|
|
491
|
+
"resolved": "boolean",
|
|
492
|
+
"references": {}
|
|
493
|
+
},
|
|
494
|
+
"required": false,
|
|
495
|
+
"optional": false,
|
|
496
|
+
"docs": {
|
|
497
|
+
"tags": [],
|
|
498
|
+
"text": "Whether the editor is disabled. Content cannot be edited or interacted with."
|
|
499
|
+
},
|
|
500
|
+
"getter": false,
|
|
501
|
+
"setter": false,
|
|
502
|
+
"reflect": false,
|
|
503
|
+
"defaultValue": "false"
|
|
504
|
+
},
|
|
505
|
+
"ariaLabel": {
|
|
506
|
+
"type": "string",
|
|
507
|
+
"attribute": "aria-label",
|
|
508
|
+
"mutable": false,
|
|
509
|
+
"complexType": {
|
|
510
|
+
"original": "string",
|
|
511
|
+
"resolved": "string",
|
|
512
|
+
"references": {}
|
|
513
|
+
},
|
|
514
|
+
"required": false,
|
|
515
|
+
"optional": false,
|
|
516
|
+
"docs": {
|
|
517
|
+
"tags": [],
|
|
518
|
+
"text": "Accessible label for the editor region. Used when no `label` prop or\n`ariaLabelledBy` is provided."
|
|
519
|
+
},
|
|
520
|
+
"getter": false,
|
|
521
|
+
"setter": false,
|
|
522
|
+
"reflect": false,
|
|
523
|
+
"defaultValue": "''"
|
|
524
|
+
},
|
|
525
|
+
"ariaLabelledBy": {
|
|
526
|
+
"type": "string",
|
|
527
|
+
"attribute": "aria-labelled-by",
|
|
528
|
+
"mutable": false,
|
|
529
|
+
"complexType": {
|
|
530
|
+
"original": "string",
|
|
531
|
+
"resolved": "string",
|
|
532
|
+
"references": {}
|
|
533
|
+
},
|
|
534
|
+
"required": false,
|
|
535
|
+
"optional": false,
|
|
536
|
+
"docs": {
|
|
537
|
+
"tags": [],
|
|
538
|
+
"text": "ID of an external element that labels this editor (aria-labelledby)."
|
|
539
|
+
},
|
|
540
|
+
"getter": false,
|
|
541
|
+
"setter": false,
|
|
542
|
+
"reflect": false,
|
|
543
|
+
"defaultValue": "''"
|
|
544
|
+
},
|
|
545
|
+
"toolbar": {
|
|
546
|
+
"type": "string",
|
|
547
|
+
"attribute": "toolbar",
|
|
548
|
+
"mutable": false,
|
|
549
|
+
"complexType": {
|
|
550
|
+
"original": "'full' | 'minimal' | 'none'",
|
|
551
|
+
"resolved": "\"full\" | \"minimal\" | \"none\"",
|
|
552
|
+
"references": {}
|
|
553
|
+
},
|
|
554
|
+
"required": false,
|
|
555
|
+
"optional": false,
|
|
556
|
+
"docs": {
|
|
557
|
+
"tags": [],
|
|
558
|
+
"text": "Controls which toolbar buttons are rendered.\n- `full` \u2014 All formatting options (default)\n- `minimal` \u2014 Text style buttons only (bold, italic, underline, strike, code)\n- `none` \u2014 No toolbar; editor acts as a plain rich-text input"
|
|
559
|
+
},
|
|
560
|
+
"getter": false,
|
|
561
|
+
"setter": false,
|
|
562
|
+
"reflect": false,
|
|
563
|
+
"defaultValue": "'full'"
|
|
564
|
+
},
|
|
565
|
+
"maxLength": {
|
|
566
|
+
"type": "number",
|
|
567
|
+
"attribute": "max-length",
|
|
568
|
+
"mutable": false,
|
|
569
|
+
"complexType": {
|
|
570
|
+
"original": "number | undefined",
|
|
571
|
+
"resolved": "number",
|
|
572
|
+
"references": {}
|
|
573
|
+
},
|
|
574
|
+
"required": false,
|
|
575
|
+
"optional": false,
|
|
576
|
+
"docs": {
|
|
577
|
+
"tags": [],
|
|
578
|
+
"text": "Maximum character count. When set, a character counter is shown below the editor."
|
|
579
|
+
},
|
|
580
|
+
"getter": false,
|
|
581
|
+
"setter": false,
|
|
582
|
+
"reflect": false,
|
|
583
|
+
"defaultValue": "undefined"
|
|
584
|
+
},
|
|
585
|
+
"error": {
|
|
586
|
+
"type": "string",
|
|
587
|
+
"attribute": "error",
|
|
588
|
+
"mutable": false,
|
|
589
|
+
"complexType": {
|
|
590
|
+
"original": "string",
|
|
591
|
+
"resolved": "string",
|
|
592
|
+
"references": {}
|
|
593
|
+
},
|
|
594
|
+
"required": false,
|
|
595
|
+
"optional": false,
|
|
596
|
+
"docs": {
|
|
597
|
+
"tags": [],
|
|
598
|
+
"text": "Validation error message. Turns the editor border red and shows the message below."
|
|
599
|
+
},
|
|
600
|
+
"getter": false,
|
|
601
|
+
"setter": false,
|
|
602
|
+
"reflect": false,
|
|
603
|
+
"defaultValue": "''"
|
|
604
|
+
},
|
|
605
|
+
"helperText": {
|
|
606
|
+
"type": "string",
|
|
607
|
+
"attribute": "helper-text",
|
|
608
|
+
"mutable": false,
|
|
609
|
+
"complexType": {
|
|
610
|
+
"original": "string",
|
|
611
|
+
"resolved": "string",
|
|
612
|
+
"references": {}
|
|
613
|
+
},
|
|
614
|
+
"required": false,
|
|
615
|
+
"optional": false,
|
|
616
|
+
"docs": {
|
|
617
|
+
"tags": [],
|
|
618
|
+
"text": "Helper text shown below the editor when there is no error."
|
|
619
|
+
},
|
|
620
|
+
"getter": false,
|
|
621
|
+
"setter": false,
|
|
622
|
+
"reflect": false,
|
|
623
|
+
"defaultValue": "''"
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
static get states() {
|
|
628
|
+
return {
|
|
629
|
+
"editorVersion": {},
|
|
630
|
+
"isFocused": {},
|
|
631
|
+
"showLinkPopover": {},
|
|
632
|
+
"linkUrl": {},
|
|
633
|
+
"charCount": {}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
static get events() {
|
|
637
|
+
return [{
|
|
638
|
+
"method": "xplorChange",
|
|
639
|
+
"name": "xplorChange",
|
|
640
|
+
"bubbles": true,
|
|
641
|
+
"cancelable": true,
|
|
642
|
+
"composed": true,
|
|
643
|
+
"docs": {
|
|
644
|
+
"tags": [],
|
|
645
|
+
"text": "Emitted whenever the content changes.\nPayload: `{ html: string; text: string; isEmpty: boolean }`"
|
|
646
|
+
},
|
|
647
|
+
"complexType": {
|
|
648
|
+
"original": "RteChangePayload",
|
|
649
|
+
"resolved": "RteChangePayload",
|
|
650
|
+
"references": {
|
|
651
|
+
"RteChangePayload": {
|
|
652
|
+
"location": "local",
|
|
653
|
+
"path": "/Users/darryn.lee-warden/Documents/DEV/xplor_design_system/apps/core-stencil-components/src/components/xplor-rich-text-editor/xplor-rich-text-editor.tsx",
|
|
654
|
+
"id": "src/components/xplor-rich-text-editor/xplor-rich-text-editor.tsx::RteChangePayload"
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}, {
|
|
659
|
+
"method": "xplorFocus",
|
|
660
|
+
"name": "xplorFocus",
|
|
661
|
+
"bubbles": true,
|
|
662
|
+
"cancelable": true,
|
|
663
|
+
"composed": true,
|
|
664
|
+
"docs": {
|
|
665
|
+
"tags": [],
|
|
666
|
+
"text": "Emitted when the editor gains focus."
|
|
667
|
+
},
|
|
668
|
+
"complexType": {
|
|
669
|
+
"original": "void",
|
|
670
|
+
"resolved": "void",
|
|
671
|
+
"references": {}
|
|
672
|
+
}
|
|
673
|
+
}, {
|
|
674
|
+
"method": "xplorBlur",
|
|
675
|
+
"name": "xplorBlur",
|
|
676
|
+
"bubbles": true,
|
|
677
|
+
"cancelable": true,
|
|
678
|
+
"composed": true,
|
|
679
|
+
"docs": {
|
|
680
|
+
"tags": [],
|
|
681
|
+
"text": "Emitted when the editor loses focus."
|
|
682
|
+
},
|
|
683
|
+
"complexType": {
|
|
684
|
+
"original": "void",
|
|
685
|
+
"resolved": "void",
|
|
686
|
+
"references": {}
|
|
687
|
+
}
|
|
688
|
+
}];
|
|
689
|
+
}
|
|
690
|
+
static get methods() {
|
|
691
|
+
return {
|
|
692
|
+
"getHTMLContent": {
|
|
693
|
+
"complexType": {
|
|
694
|
+
"signature": "() => Promise<string>",
|
|
695
|
+
"parameters": [],
|
|
696
|
+
"references": {
|
|
697
|
+
"Promise": {
|
|
698
|
+
"location": "global",
|
|
699
|
+
"id": "global::Promise"
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
"return": "Promise<string>"
|
|
703
|
+
},
|
|
704
|
+
"docs": {
|
|
705
|
+
"text": "Returns the current content as an HTML string.",
|
|
706
|
+
"tags": []
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
"getText": {
|
|
710
|
+
"complexType": {
|
|
711
|
+
"signature": "() => Promise<string>",
|
|
712
|
+
"parameters": [],
|
|
713
|
+
"references": {
|
|
714
|
+
"Promise": {
|
|
715
|
+
"location": "global",
|
|
716
|
+
"id": "global::Promise"
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
"return": "Promise<string>"
|
|
720
|
+
},
|
|
721
|
+
"docs": {
|
|
722
|
+
"text": "Returns the current content as plain text (all markup stripped).",
|
|
723
|
+
"tags": []
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
"setContent": {
|
|
727
|
+
"complexType": {
|
|
728
|
+
"signature": "(html: string) => Promise<void>",
|
|
729
|
+
"parameters": [{
|
|
730
|
+
"name": "html",
|
|
731
|
+
"type": "string",
|
|
732
|
+
"docs": ""
|
|
733
|
+
}],
|
|
734
|
+
"references": {
|
|
735
|
+
"Promise": {
|
|
736
|
+
"location": "global",
|
|
737
|
+
"id": "global::Promise"
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
"return": "Promise<void>"
|
|
741
|
+
},
|
|
742
|
+
"docs": {
|
|
743
|
+
"text": "Replaces the editor content with the provided HTML string.",
|
|
744
|
+
"tags": []
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
"clearContent": {
|
|
748
|
+
"complexType": {
|
|
749
|
+
"signature": "() => Promise<void>",
|
|
750
|
+
"parameters": [],
|
|
751
|
+
"references": {
|
|
752
|
+
"Promise": {
|
|
753
|
+
"location": "global",
|
|
754
|
+
"id": "global::Promise"
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
"return": "Promise<void>"
|
|
758
|
+
},
|
|
759
|
+
"docs": {
|
|
760
|
+
"text": "Clears all content from the editor.",
|
|
761
|
+
"tags": []
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
"focusEditor": {
|
|
765
|
+
"complexType": {
|
|
766
|
+
"signature": "() => Promise<void>",
|
|
767
|
+
"parameters": [],
|
|
768
|
+
"references": {
|
|
769
|
+
"Promise": {
|
|
770
|
+
"location": "global",
|
|
771
|
+
"id": "global::Promise"
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
"return": "Promise<void>"
|
|
775
|
+
},
|
|
776
|
+
"docs": {
|
|
777
|
+
"text": "Programmatically focuses the editor.",
|
|
778
|
+
"tags": []
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
static get elementRef() { return "el"; }
|
|
784
|
+
static get watchers() {
|
|
785
|
+
return [{
|
|
786
|
+
"propName": "value",
|
|
787
|
+
"methodName": "handleValueChange"
|
|
788
|
+
}, {
|
|
789
|
+
"propName": "readonly",
|
|
790
|
+
"methodName": "handleReadonlyChange"
|
|
791
|
+
}, {
|
|
792
|
+
"propName": "disabled",
|
|
793
|
+
"methodName": "handleDisabledChange"
|
|
794
|
+
}, {
|
|
795
|
+
"propName": "legacySlateDocument",
|
|
796
|
+
"methodName": "handleLegacyDocChange"
|
|
797
|
+
}];
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
//# sourceMappingURL=xplor-rich-text-editor.js.map
|