@orbitcommerce/constellation-docs 1.0.0 → 1.2.0

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.
Files changed (235) hide show
  1. package/dist/docs.css +14764 -2237
  2. package/dist/index.js +2 -2
  3. package/dist/pages/{Playground-CNbBbErC.js → Playground-Mk1yIWXb.js} +2 -2
  4. package/dist/pages/_address-data-L9BR499w.js +161 -0
  5. package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
  6. package/dist/pages/_card-art-0be5ncyV.js +18 -0
  7. package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
  8. package/dist/pages/{_figures-data-BDmScEny.js → _figures-data-DaDvB7Nm.js} +5 -5
  9. package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
  10. package/dist/pages/{_overlays-specimens-Dpn6oiyH.js → _overlays-specimens-bawR331Z.js} +33 -23
  11. package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
  12. package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
  13. package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
  14. package/dist/pages/address-block-BZOOOPA9.js +368 -0
  15. package/dist/pages/address-fields-CwSqro3W.js +277 -0
  16. package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
  17. package/dist/pages/{alert-BD4e6QTh.js → alert-D3i7xZTU.js} +195 -50
  18. package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
  19. package/dist/pages/{app-shell-KbA-nRqZ.js → app-shell-D4hdlHps.js} +133 -54
  20. package/dist/pages/{area-chart-B91dLcGo.js → area-chart-BEWFwiB2.js} +183 -27
  21. package/dist/pages/{avatar-DPPHXJAu.js → avatar-BFEqQViw.js} +194 -12
  22. package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
  23. package/dist/pages/{badge-C9JR0thI.js → badge-0-PyMrih.js} +441 -135
  24. package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
  25. package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
  26. package/dist/pages/board-card-D2tZY_mU.js +415 -0
  27. package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
  28. package/dist/pages/{button-D3V912P4.js → button-DAyfssDY.js} +276 -79
  29. package/dist/pages/{calendar-DSDZ9nRH.js → calendar-Ds7KsgSI.js} +69 -17
  30. package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
  31. package/dist/pages/card-CQEM1_wc.js +1567 -0
  32. package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
  33. package/dist/pages/chart-legend-B20AbakD.js +724 -0
  34. package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
  35. package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
  36. package/dist/pages/checklist-card-DEyykVFS.js +783 -0
  37. package/dist/pages/chip-Ck-o3Ui6.js +839 -0
  38. package/dist/pages/chip-list-k1LxXuCi.js +414 -0
  39. package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
  40. package/dist/pages/coachmark-Be2ghobT.js +366 -0
  41. package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
  42. package/dist/pages/collab-field-CfqqK7d2.js +696 -0
  43. package/dist/pages/color-field-CZpfcA-A.js +1127 -0
  44. package/dist/pages/{colour-BwuO8xAv.js → colour-q2ntvI0w.js} +496 -20
  45. package/dist/pages/column-mapper-TsTG39cl.js +502 -0
  46. package/dist/pages/combobox-DvK2j5tI.js +1334 -0
  47. package/dist/pages/{command-palette-xAD7fOg6.js → command-palette-CJ7uBA04.js} +201 -58
  48. package/dist/pages/comment-box-CDSGYhr5.js +346 -0
  49. package/dist/pages/composer-D4B0NgpA.js +689 -0
  50. package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
  51. package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
  52. package/dist/pages/context-menu-F9DV30ia.js +487 -0
  53. package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
  54. package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
  55. package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
  56. package/dist/pages/date-input-GOW067EB.js +956 -0
  57. package/dist/pages/{date-picker-BYSa816m.js → date-picker-GdBciR99.js} +186 -38
  58. package/dist/pages/date-time-BLKCXtVZ.js +678 -0
  59. package/dist/pages/{delta-CtAo0eIM.js → delta-CNAGv8JY.js} +266 -61
  60. package/dist/pages/description-list-BPeXn1eW.js +1268 -0
  61. package/dist/pages/device-switcher-BCaN99c1.js +554 -0
  62. package/dist/pages/dialog-CRpkRC98.js +3164 -0
  63. package/dist/pages/{docs-BNOb7AqR.js → docs-lM2UBSir.js} +20 -15
  64. package/dist/pages/doodle-nzkqi2UI.js +201 -0
  65. package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
  66. package/dist/pages/drill-menu-cskH5mol.js +490 -0
  67. package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
  68. package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
  69. package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
  70. package/dist/pages/empty-state-4U2txFpI.js +1113 -0
  71. package/dist/pages/facet-filters-McbBeY9e.js +353 -0
  72. package/dist/pages/figure-D-HF5vCj.js +563 -0
  73. package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
  74. package/dist/pages/{figure-tabs-CoPFzzKz.js → figure-tabs-QOeQMY6N.js} +153 -35
  75. package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
  76. package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
  77. package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
  78. package/dist/pages/form-grid-BfWCVlie.js +692 -0
  79. package/dist/pages/gallery-BBk2EOri.js +453 -0
  80. package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
  81. package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
  82. package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
  83. package/dist/pages/heatmap-BohgIcNk.js +507 -0
  84. package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
  85. package/dist/pages/{home-dashboard-CFQwDtC9.js → home-dashboard-CxPmvduE.js} +21 -18
  86. package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
  87. package/dist/pages/hosted-field-BLh-53AE.js +208 -0
  88. package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
  89. package/dist/pages/{icon-button-C9eSVPPW.js → icon-button-Bu4Gj5sy.js} +370 -31
  90. package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
  91. package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
  92. package/dist/pages/{icons-sxkTs5Ob.js → icons-CJ9Aar3d.js} +315 -52
  93. package/dist/pages/image-cropper-NyougqLH.js +466 -0
  94. package/dist/pages/image-field-7knBv4mJ.js +567 -0
  95. package/dist/pages/import-result-CmTtGXW_.js +486 -0
  96. package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
  97. package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
  98. package/dist/pages/input-CzLCzfyx.js +2372 -0
  99. package/dist/pages/{installation-DpsX8G_n.js → installation-C3UcpQJT.js} +112 -29
  100. package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
  101. package/dist/pages/kanban-Dy9sPAI0.js +740 -0
  102. package/dist/pages/{kbd-cNfDoikz.js → kbd-UNj4zqxn.js} +15 -14
  103. package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
  104. package/dist/pages/line-chart-CntWxeMF.js +1117 -0
  105. package/dist/pages/link-CXqvAg9z.js +689 -0
  106. package/dist/pages/link-picker-BMFGCC67.js +478 -0
  107. package/dist/pages/link-row-x8yaUuWc.js +595 -0
  108. package/dist/pages/{live-globe-ClvLn9Lb.js → live-globe-95ROMhGQ.js} +191 -47
  109. package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
  110. package/dist/pages/loading-state-BNbCo51C.js +556 -0
  111. package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
  112. package/dist/pages/{logo-BfGF1Pq9.js → logo-B38rnzoq.js} +13 -13
  113. package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
  114. package/dist/pages/markdown-Ied72vMT.js +237 -0
  115. package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
  116. package/dist/pages/media-banner-DkStCia0.js +233 -0
  117. package/dist/pages/{menu-by2sgQ09.js → menu-NrLYKqKp.js} +623 -109
  118. package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
  119. package/dist/pages/meta-line-D5p2TycR.js +371 -0
  120. package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
  121. package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
  122. package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
  123. package/dist/pages/{motion-BvTGc2Dk.js → motion-CrXtiBvA.js} +20 -10
  124. package/dist/pages/number-input-CuyMZg18.js +968 -0
  125. package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
  126. package/dist/pages/{orbit-spinner-Dil1Z3Oy.js → orbit-spinner-Dxv5qAhr.js} +30 -14
  127. package/dist/pages/otp-input-CVRoX1mw.js +591 -0
  128. package/dist/pages/{overview-BPEbZQ6g.js → overview-LA9XRhZc.js} +4 -4
  129. package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
  130. package/dist/pages/{pagination-BBUnGvv5.js → pagination-C1EgVtW4.js} +74 -29
  131. package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
  132. package/dist/pages/password-field-DHEQKyUC.js +912 -0
  133. package/dist/pages/person-cell-BmjbADBz.js +564 -0
  134. package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
  135. package/dist/pages/plan-card-DRaA6RuB.js +621 -0
  136. package/dist/pages/plan-card-DtloWvMh.js +258 -0
  137. package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
  138. package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
  139. package/dist/pages/point-list-BbPmZjsm.js +222 -0
  140. package/dist/pages/{popover-Db1gLDpb.js → popover-C3Oar9D5.js} +76 -14
  141. package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
  142. package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
  143. package/dist/pages/price-CRBLoa9h.js +604 -0
  144. package/dist/pages/{principles-CeAIOIdt.js → principles-pnDyfHpK.js} +9 -9
  145. package/dist/pages/print-page-BkLv6bW8.js +513 -0
  146. package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
  147. package/dist/pages/progress-CP_awmo4.js +904 -0
  148. package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
  149. package/dist/pages/{radio-group-CkdBWWfG.js → radio-group-C-4tg6FS.js} +580 -18
  150. package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
  151. package/dist/pages/rating-CweKN2SX.js +471 -0
  152. package/dist/pages/record-layout-DUP_X0RL.js +719 -0
  153. package/dist/pages/record-pager-y9D7JFgb.js +278 -0
  154. package/dist/pages/registry-BZg-xAbi.js +594 -0
  155. package/dist/pages/{release-Dvo684UJ.js → release-Cs6tl16C.js} +4 -1
  156. package/dist/pages/repeater-BRZYKRQa.js +1351 -0
  157. package/dist/pages/reply-feedback-BDnHprla.js +192 -0
  158. package/dist/pages/reveal-BygENBbL.js +460 -0
  159. package/dist/pages/rich-text-DOFQZEpT.js +156 -0
  160. package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
  161. package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
  162. package/dist/pages/{rolling-number-qmvH84Mq.js → rolling-number-GR3Cyfpz.js} +12 -12
  163. package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
  164. package/dist/pages/rule-list-DTCmIMpT.js +648 -0
  165. package/dist/pages/save-status-B5KkyMZP.js +378 -0
  166. package/dist/pages/schedule-YycI95O1.js +243 -0
  167. package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
  168. package/dist/pages/{search-field-BN7MWGQ4.js → search-field-D1uG7R6A.js} +15 -15
  169. package/dist/pages/search-menu-DMuXyUUW.js +580 -0
  170. package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
  171. package/dist/pages/section-rail-BtTCETS5.js +637 -0
  172. package/dist/pages/section-v2Pubup9.js +639 -0
  173. package/dist/pages/{segmented-control-CTbIpRBW.js → segmented-control-D-FB1K1T.js} +450 -37
  174. package/dist/pages/{select-DguELoRR.js → select-DZ43NpOm.js} +22 -17
  175. package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
  176. package/dist/pages/{separator-CPZub9pv.js → separator-CFwqRvfO.js} +99 -22
  177. package/dist/pages/serp-preview-BGwORjmo.js +346 -0
  178. package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
  179. package/dist/pages/{shape-DKvA0YKr.js → shape-DzniHAVT.js} +10 -10
  180. package/dist/pages/share-list-D4wgBxKN.js +926 -0
  181. package/dist/pages/side-panel-CCtkrZjs.js +811 -0
  182. package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
  183. package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
  184. package/dist/pages/skip-link-BxznhSkz.js +252 -0
  185. package/dist/pages/slider-CAoPURKD.js +774 -0
  186. package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
  187. package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
  188. package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
  189. package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
  190. package/dist/pages/{sparkline-DMMYGbHn.js → sparkline-D3aavCly.js} +301 -22
  191. package/dist/pages/split-bar-DYgZnFID.js +414 -0
  192. package/dist/pages/split-button-Be08-VI-.js +335 -0
  193. package/dist/pages/split-pane-lSNZgTKt.js +523 -0
  194. package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
  195. package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
  196. package/dist/pages/status-dot-D99gAGsV.js +567 -0
  197. package/dist/pages/stepper-CxKTbEA-.js +1093 -0
  198. package/dist/pages/success-mark-CqFTOBEu.js +142 -0
  199. package/dist/pages/swatch-H_kNvHuC.js +565 -0
  200. package/dist/pages/{switch-B-Qe4kcT.js → switch-C93K6j9h.js} +151 -51
  201. package/dist/pages/table-CL0vomno.js +3225 -0
  202. package/dist/pages/{tabs-B4M-usCV.js → tabs-Dh0mUsLw.js} +256 -21
  203. package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
  204. package/dist/pages/task-card-Dv0sR1-w.js +295 -0
  205. package/dist/pages/{textarea-fTuUZRQb.js → textarea-CCM-SnGN.js} +271 -15
  206. package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
  207. package/dist/pages/time-input-CA9-uZAa.js +442 -0
  208. package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
  209. package/dist/pages/timeline-BsMUTlpR.js +1798 -0
  210. package/dist/pages/{toast-CKP03zjy.js → toast-zXLRiMRT.js} +240 -25
  211. package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
  212. package/dist/pages/toolbar-B9l_fHKy.js +754 -0
  213. package/dist/pages/{tooltip-CBYil3kt.js → tooltip-LHtCUkF-.js} +162 -33
  214. package/dist/pages/translation-field-CTRXiF2N.js +251 -0
  215. package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
  216. package/dist/pages/tree-select-DU1qXHy_.js +492 -0
  217. package/dist/pages/tree-view-g_RjLtAb.js +739 -0
  218. package/dist/pages/{typography-PCbg8Bhg.js → typography-BSijtiRl.js} +153 -12
  219. package/dist/pages/unit-input-Dml4fjmK.js +659 -0
  220. package/dist/pages/upload-rules-yozEzSah.js +419 -0
  221. package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
  222. package/dist/pages/value-change-CnubDKyO.js +489 -0
  223. package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
  224. package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
  225. package/dist/pages/working-status-CENemSsw.js +389 -0
  226. package/manifest.json +10984 -1108
  227. package/package.json +2 -2
  228. package/dist/pages/card-DUggbis3.js +0 -659
  229. package/dist/pages/checkbox-DwimQaK3.js +0 -365
  230. package/dist/pages/dialog-BRAf4LMh.js +0 -1451
  231. package/dist/pages/empty-state-C-mLrXW2.js +0 -417
  232. package/dist/pages/input-KF9Gkawf.js +0 -1093
  233. package/dist/pages/registry-CroHzK9I.js +0 -244
  234. package/dist/pages/skeleton-DLuBhP46.js +0 -561
  235. package/dist/pages/table-AMoODng4.js +0 -607
@@ -0,0 +1,1265 @@
1
+ "use client";
2
+ import { t as DocLink } from "./host-B6znjEgQ.js";
3
+ import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, n as CodeBlock$1, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Button, Field, RichTextEditor, Textarea, storefrontLinkTypes } from "@orbitcommerce/constellation";
7
+ //#region src/pages/components/rich-text-editor.tsx
8
+ var MARKS = {
9
+ bold: "bold",
10
+ italic: "italic",
11
+ underline: "underline",
12
+ strike: "strikeThrough",
13
+ subscript: "subscript",
14
+ superscript: "superscript",
15
+ bulletList: "insertUnorderedList",
16
+ orderedList: "insertOrderedList"
17
+ };
18
+ var ALIGN = {
19
+ left: "justifyLeft",
20
+ center: "justifyCenter",
21
+ right: "justifyRight",
22
+ justify: "justifyFull"
23
+ };
24
+ var COMMANDS = [
25
+ "focus",
26
+ "undo",
27
+ "redo",
28
+ "setParagraph",
29
+ "setHeading",
30
+ "toggleBold",
31
+ "toggleItalic",
32
+ "toggleUnderline",
33
+ "toggleStrike",
34
+ "toggleCode",
35
+ "toggleSubscript",
36
+ "toggleSuperscript",
37
+ "toggleBulletList",
38
+ "toggleOrderedList",
39
+ "toggleBlockquote",
40
+ "setTextAlign",
41
+ "extendMarkRange",
42
+ "setLink",
43
+ "unsetLink",
44
+ "insertContent",
45
+ "unsetMark",
46
+ "setColor",
47
+ "unsetColor",
48
+ "setHighlight",
49
+ "unsetHighlight",
50
+ "updateAttributes"
51
+ ];
52
+ function useStandInEditor(initialText) {
53
+ const ref = useRef(null);
54
+ const editable = useRef(true);
55
+ const fallback = useRef(initialText);
56
+ const listeners = useRef({
57
+ transaction: [],
58
+ focus: [],
59
+ blur: []
60
+ });
61
+ const saved = useRef(null);
62
+ const image = useRef(null);
63
+ const editor = useMemo(() => {
64
+ const emit = (event) => listeners.current[event].forEach((listener) => listener());
65
+ const exec = (command, value) => {
66
+ if (typeof document === "undefined") return;
67
+ document.execCommand(command, false, value);
68
+ };
69
+ const perform = (command, value) => {
70
+ exec(command, value);
71
+ emit("transaction");
72
+ };
73
+ /** Whether the live selection is in this editor's content. */
74
+ const inContent = () => {
75
+ const node = typeof document === "undefined" ? null : document.getSelection()?.anchorNode;
76
+ return !!node && !!ref.current?.contains(node);
77
+ };
78
+ /** The link the selection is in: the live one in the content, or the one kept while focus is elsewhere. */
79
+ const linkAt = () => {
80
+ if (typeof document === "undefined") return null;
81
+ const node = inContent() ? document.getSelection()?.anchorNode : saved.current?.startContainer;
82
+ const anchor = (node instanceof Element ? node : node?.parentElement ?? null)?.closest("a") ?? null;
83
+ return anchor && ref.current?.contains(anchor) ? anchor : null;
84
+ };
85
+ const chain = () => {
86
+ const next = {};
87
+ next.focus = () => {
88
+ const root = ref.current;
89
+ root?.focus();
90
+ const selection = document.getSelection();
91
+ if (root && saved.current && selection && !root.contains(selection.anchorNode)) {
92
+ selection.removeAllRanges();
93
+ selection.addRange(saved.current);
94
+ }
95
+ return next;
96
+ };
97
+ next.undo = () => {
98
+ perform("undo");
99
+ return next;
100
+ };
101
+ next.redo = () => {
102
+ perform("redo");
103
+ return next;
104
+ };
105
+ next.setParagraph = () => {
106
+ perform("formatBlock", "p");
107
+ return next;
108
+ };
109
+ next.setHeading = ({ level }) => {
110
+ perform("formatBlock", `h${level}`);
111
+ return next;
112
+ };
113
+ next.toggleBold = () => {
114
+ perform("bold");
115
+ return next;
116
+ };
117
+ next.toggleItalic = () => {
118
+ perform("italic");
119
+ return next;
120
+ };
121
+ next.toggleUnderline = () => {
122
+ perform("underline");
123
+ return next;
124
+ };
125
+ next.toggleStrike = () => {
126
+ perform("strikeThrough");
127
+ return next;
128
+ };
129
+ next.toggleSubscript = () => {
130
+ perform("subscript");
131
+ return next;
132
+ };
133
+ next.toggleSuperscript = () => {
134
+ perform("superscript");
135
+ return next;
136
+ };
137
+ next.toggleCode = () => {
138
+ const selection = document.getSelection();
139
+ if (!selection?.rangeCount) return next;
140
+ const range = selection.getRangeAt(0);
141
+ const node = range.startContainer;
142
+ const at = (node instanceof Element ? node : node.parentElement)?.closest("code");
143
+ if (at && ref.current?.contains(at)) at.replaceWith(...Array.from(at.childNodes));
144
+ else if (!range.collapsed) {
145
+ const code = document.createElement("code");
146
+ code.append(range.extractContents());
147
+ range.insertNode(code);
148
+ }
149
+ emit("transaction");
150
+ return next;
151
+ };
152
+ next.insertContent = (content) => {
153
+ const href = content.marks?.[0]?.attrs?.href ?? "#";
154
+ const target = content.marks?.[0]?.attrs?.target;
155
+ const anchor = document.createElement("a");
156
+ anchor.href = href;
157
+ if (target) anchor.target = target;
158
+ anchor.textContent = content.text ?? href;
159
+ exec("insertHTML", anchor.outerHTML);
160
+ emit("transaction");
161
+ return next;
162
+ };
163
+ next.unsetMark = () => next;
164
+ const onKept = (command, value) => {
165
+ const root = ref.current;
166
+ const selection = document.getSelection();
167
+ if (!root || !selection || !saved.current) return;
168
+ const before = document.activeElement;
169
+ root.focus({ preventScroll: true });
170
+ selection.removeAllRanges();
171
+ selection.addRange(saved.current);
172
+ document.execCommand("styleWithCSS", false, "true");
173
+ exec(command, value);
174
+ if (before && before !== root) before.focus({ preventScroll: true });
175
+ emit("transaction");
176
+ };
177
+ next.setColor = (colour) => {
178
+ onKept("foreColor", colour);
179
+ return next;
180
+ };
181
+ next.unsetColor = () => {
182
+ onKept("foreColor", "inherit");
183
+ return next;
184
+ };
185
+ next.setHighlight = ({ color }) => {
186
+ onKept("hiliteColor", color);
187
+ return next;
188
+ };
189
+ next.unsetHighlight = () => {
190
+ onKept("hiliteColor", "transparent");
191
+ return next;
192
+ };
193
+ next.toggleBulletList = () => {
194
+ perform("insertUnorderedList");
195
+ return next;
196
+ };
197
+ next.toggleOrderedList = () => {
198
+ perform("insertOrderedList");
199
+ return next;
200
+ };
201
+ next.toggleBlockquote = () => {
202
+ perform("formatBlock", "blockquote");
203
+ return next;
204
+ };
205
+ next.setTextAlign = (align) => {
206
+ const picture = image.current?.querySelector("img");
207
+ if (picture) {
208
+ picture.style.textAlign = align;
209
+ emit("transaction");
210
+ } else perform(ALIGN[align] ?? "justifyLeft");
211
+ return next;
212
+ };
213
+ next.updateAttributes = (_type, attributes) => {
214
+ const picture = image.current?.querySelector("img");
215
+ if (picture && attributes.width) {
216
+ picture.style.width = `${attributes.width}px`;
217
+ picture.style.height = attributes.height ? `${attributes.height}px` : "";
218
+ }
219
+ emit("transaction");
220
+ return next;
221
+ };
222
+ next.extendMarkRange = () => {
223
+ const anchor = linkAt();
224
+ const selection = document.getSelection();
225
+ if (anchor && selection?.isCollapsed) {
226
+ const range = document.createRange();
227
+ range.selectNodeContents(anchor);
228
+ selection.removeAllRanges();
229
+ selection.addRange(range);
230
+ }
231
+ return next;
232
+ };
233
+ next.setLink = ({ href, target }) => {
234
+ exec("createLink", href);
235
+ const anchor = linkAt();
236
+ if (anchor) {
237
+ if (target) anchor.setAttribute("target", target);
238
+ else anchor.removeAttribute("target");
239
+ }
240
+ emit("transaction");
241
+ return next;
242
+ };
243
+ next.unsetLink = () => {
244
+ perform("unlink");
245
+ return next;
246
+ };
247
+ next.run = () => true;
248
+ return next;
249
+ };
250
+ const can = () => {
251
+ const next = {};
252
+ let last = "";
253
+ for (const name of COMMANDS) next[name] = () => {
254
+ last = name;
255
+ return next;
256
+ };
257
+ next.run = () => last === "undo" || last === "redo" ? typeof document !== "undefined" && document.queryCommandEnabled(last) : true;
258
+ return next;
259
+ };
260
+ return {
261
+ isActive(input, attributes) {
262
+ if (typeof document === "undefined") return false;
263
+ if (typeof input !== "string") {
264
+ const picture = image.current?.querySelector("img");
265
+ if (picture) return (picture.style.textAlign || "left") === input.textAlign;
266
+ const command = typeof input.textAlign === "string" ? ALIGN[input.textAlign] : void 0;
267
+ return !!command && inContent() && document.queryCommandState(command);
268
+ }
269
+ if (input === "heading") return inContent() && document.queryCommandValue("formatBlock").toLowerCase() === `h${attributes?.level}`;
270
+ if (input === "image") return image.current !== null;
271
+ if (input === "link") return linkAt() !== null;
272
+ if (input === "code") {
273
+ const node = inContent() ? document.getSelection()?.anchorNode : null;
274
+ return !!(node instanceof Element ? node : node?.parentElement)?.closest("code");
275
+ }
276
+ const name = MARKS[input];
277
+ return name ? document.queryCommandState(name) : false;
278
+ },
279
+ chain,
280
+ can: () => ({ chain: can }),
281
+ get state() {
282
+ const selection = typeof document === "undefined" ? null : document.getSelection();
283
+ return { selection: {
284
+ empty: image.current ? false : !selection || selection.isCollapsed,
285
+ from: image.current ? 1 : 0
286
+ } };
287
+ },
288
+ getHTML: () => ref.current?.innerHTML ?? "",
289
+ commands: { setContent: (html) => {
290
+ if (ref.current) ref.current.innerHTML = html;
291
+ emit("transaction");
292
+ return true;
293
+ } },
294
+ get view() {
295
+ return ref.current ? {
296
+ dom: ref.current,
297
+ nodeDOM: (position) => position === 1 ? image.current : null
298
+ } : void 0;
299
+ },
300
+ getAttributes: (name) => {
301
+ if (name === "image") {
302
+ const width = parseInt(image.current?.querySelector("img")?.style.width ?? "", 10);
303
+ return Number.isFinite(width) ? { width } : {};
304
+ }
305
+ if ((name === "textStyle" || name === "highlight") && typeof document !== "undefined") {
306
+ const node = inContent() ? document.getSelection()?.anchorNode : saved.current?.startContainer;
307
+ for (let el = node instanceof Element ? node : node?.parentElement ?? null; el && el !== ref.current; el = el.parentElement) {
308
+ const value = name === "textStyle" ? el.style.color : el.style.backgroundColor;
309
+ if (value && value !== "inherit" && value !== "transparent") return { color: value };
310
+ }
311
+ return {};
312
+ }
313
+ const anchor = name === "link" ? linkAt() : null;
314
+ return anchor ? {
315
+ href: anchor.getAttribute("href") ?? void 0,
316
+ target: anchor.getAttribute("target")
317
+ } : {};
318
+ },
319
+ setEditable(next) {
320
+ editable.current = next;
321
+ if (ref.current) ref.current.contentEditable = next ? "true" : "false";
322
+ },
323
+ get isEditable() {
324
+ return editable.current;
325
+ },
326
+ getText: () => ref.current?.textContent ?? fallback.current,
327
+ on(event, callback) {
328
+ listeners.current[event].push(callback);
329
+ },
330
+ off(event, callback) {
331
+ const list = listeners.current[event];
332
+ const at = list.indexOf(callback);
333
+ if (at >= 0) list.splice(at, 1);
334
+ }
335
+ };
336
+ }, []);
337
+ useEffect(() => {
338
+ const onSelectionChange = () => {
339
+ const selection = document.getSelection();
340
+ if (!selection?.rangeCount || !ref.current?.contains(selection.anchorNode)) return;
341
+ saved.current = selection.getRangeAt(0).cloneRange();
342
+ listeners.current.transaction.forEach((listener) => listener());
343
+ };
344
+ document.addEventListener("selectionchange", onSelectionChange);
345
+ return () => document.removeEventListener("selectionchange", onSelectionChange);
346
+ }, []);
347
+ return {
348
+ editor,
349
+ ref,
350
+ onInput: useCallback(() => {
351
+ listeners.current.transaction.forEach((listener) => listener());
352
+ }, []),
353
+ onClick: useCallback((event) => {
354
+ const container = event.target instanceof Element ? event.target.closest("[data-resize-container]") : null;
355
+ if (image.current && image.current !== container) image.current.classList.remove("ProseMirror-selectednode");
356
+ image.current = container;
357
+ container?.classList.add("ProseMirror-selectednode");
358
+ listeners.current.transaction.forEach((listener) => listener());
359
+ }, [])
360
+ };
361
+ }
362
+ /** The editor's frame over the stand-in: the same RichTextEditor, driven by a contentEditable div. */
363
+ function StandIn({ html, ...props }) {
364
+ const { editor, ref, onInput, onClick } = useStandInEditor(useMemo(() => html.replace(/<[^>]*>/g, ""), [html]));
365
+ return /* @__PURE__ */ jsx(RichTextEditor, {
366
+ editor,
367
+ ...props,
368
+ children: /* @__PURE__ */ jsx("div", {
369
+ ref,
370
+ contentEditable: true,
371
+ suppressContentEditableWarning: true,
372
+ dangerouslySetInnerHTML: { __html: html },
373
+ onInput,
374
+ onClick
375
+ })
376
+ });
377
+ }
378
+ var DESCRIPTION = "<h2>Arden ergonomic chair</h2><p>Built for long days at a desk: a breathable mesh back, adjustable lumbar support, 4D arms and a five-year warranty. Free UK delivery on orders over £50, from our warehouse in Leeds.</p>";
379
+ var POLICY = "<h2>Returns</h2><p>Return anything within 30 days of delivery, as long as it is unused and in its original packaging.</p><ul><li>Start a return from your account.</li><li>We send a prepaid label for orders over £50.</li><li>Large items are collected by our courier.</li></ul>";
380
+ var ARTICLE = /* @__PURE__ */ jsxs("div", {
381
+ className: "o-prose",
382
+ children: [
383
+ /* @__PURE__ */ jsx("h2", { children: "Delivery and returns" }),
384
+ /* @__PURE__ */ jsx("p", { children: "Orders placed before 2pm leave the warehouse the same day, in recyclable packaging. Tracked delivery is included on every UK order." }),
385
+ /* @__PURE__ */ jsxs("ul", { children: [
386
+ /* @__PURE__ */ jsx("li", { children: "Standard delivery, 2 to 3 working days." }),
387
+ /* @__PURE__ */ jsx("li", { children: "Next day, ordered before 2pm." }),
388
+ /* @__PURE__ */ jsx("li", { children: "Collection from the Leeds warehouse." })
389
+ ] }),
390
+ /* @__PURE__ */ jsx("blockquote", { children: "If a chair arrives damaged, tell us within 14 days and we will collect it and send another." }),
391
+ /* @__PURE__ */ jsxs("p", { children: [
392
+ "The delivery fee is ",
393
+ /* @__PURE__ */ jsx("strong", { children: "£4.95" }),
394
+ " on orders under £50, and free above that. Returns are free within 30 days. Our stock codes look like ",
395
+ /* @__PURE__ */ jsx("code", { children: "ARD-CH-BLK" }),
396
+ "."
397
+ ] }),
398
+ /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: "order.shipping = \"tracked\"" }) }),
399
+ /* @__PURE__ */ jsxs("p", { children: [
400
+ "Read the full ",
401
+ /* @__PURE__ */ jsx("a", {
402
+ href: "https://orbit.example/returns",
403
+ children: "returns policy"
404
+ }),
405
+ "."
406
+ ] })
407
+ ]
408
+ });
409
+ function Preview() {
410
+ return /* @__PURE__ */ jsx("div", {
411
+ className: "rich-text-editor-preview",
412
+ children: /* @__PURE__ */ jsx(StandIn, {
413
+ html: "<p>The Arden chair, built for long days at a desk.</p>",
414
+ "aria-label": "Product description",
415
+ minHeight: "72px"
416
+ })
417
+ });
418
+ }
419
+ function Basic() {
420
+ return /* @__PURE__ */ jsx("div", {
421
+ className: "rich-text-editor-stage",
422
+ children: /* @__PURE__ */ jsx(StandIn, {
423
+ html: DESCRIPTION,
424
+ "aria-label": "Product description"
425
+ })
426
+ });
427
+ }
428
+ function Counted() {
429
+ return /* @__PURE__ */ jsxs("div", {
430
+ className: "rich-text-editor-stack",
431
+ children: [/* @__PURE__ */ jsx(StandIn, {
432
+ html: DESCRIPTION,
433
+ "aria-label": "Product description, under the limit",
434
+ showCount: true,
435
+ characterLimit: 220
436
+ }), /* @__PURE__ */ jsx(StandIn, {
437
+ html: DESCRIPTION,
438
+ "aria-label": "Product description, over the limit",
439
+ showCount: true,
440
+ characterLimit: 100
441
+ })]
442
+ });
443
+ }
444
+ function Invalid() {
445
+ return /* @__PURE__ */ jsx("div", {
446
+ className: "rich-text-editor-stage",
447
+ children: /* @__PURE__ */ jsx(Field, {
448
+ label: "Returns policy",
449
+ error: "Say how long a return takes, and who pays the postage.",
450
+ children: /* @__PURE__ */ jsx(StandIn, { html: POLICY })
451
+ })
452
+ });
453
+ }
454
+ function Off() {
455
+ return /* @__PURE__ */ jsxs("div", {
456
+ className: "rich-text-editor-stack",
457
+ children: [/* @__PURE__ */ jsx(StandIn, {
458
+ html: DESCRIPTION,
459
+ "aria-label": "Product description, read-only",
460
+ readOnly: true
461
+ }), /* @__PURE__ */ jsx(StandIn, {
462
+ html: DESCRIPTION,
463
+ "aria-label": "Product description, disabled",
464
+ disabled: true
465
+ })]
466
+ });
467
+ }
468
+ function ExtraControls() {
469
+ return /* @__PURE__ */ jsx("div", {
470
+ className: "rich-text-editor-stage",
471
+ children: /* @__PURE__ */ jsx(StandIn, {
472
+ html: DESCRIPTION,
473
+ "aria-label": "Product description",
474
+ toolbarEnd: /* @__PURE__ */ jsx(Button, {
475
+ size: "sm",
476
+ variant: "ghost",
477
+ children: "Preview"
478
+ })
479
+ })
480
+ });
481
+ }
482
+ function WithImage() {
483
+ const [asked, setAsked] = useState(false);
484
+ return /* @__PURE__ */ jsxs("div", {
485
+ className: "rich-text-editor-stage",
486
+ children: [/* @__PURE__ */ jsx(StandIn, {
487
+ html: DESCRIPTION,
488
+ "aria-label": "Product description",
489
+ onImageRequest: () => setAsked(true)
490
+ }), /* @__PURE__ */ jsx("p", {
491
+ className: "rich-text-editor-status",
492
+ children: asked ? "onImageRequest: your media picker would open here." : "Press Insert image to see the host hook."
493
+ })]
494
+ });
495
+ }
496
+ function OwnWords() {
497
+ return /* @__PURE__ */ jsx("div", {
498
+ className: "rich-text-editor-stage",
499
+ children: /* @__PURE__ */ jsx(StandIn, {
500
+ html: DESCRIPTION,
501
+ "aria-label": "Product description",
502
+ labels: {
503
+ toolbar: "Text formatting",
504
+ bold: "Bold text",
505
+ italic: "Italic text"
506
+ }
507
+ })
508
+ });
509
+ }
510
+ var PICKER_ITEMS = {
511
+ categories: [{
512
+ id: "desks",
513
+ label: "Desks",
514
+ href: "/categories/desks"
515
+ }, {
516
+ id: "chairs",
517
+ label: "Chairs",
518
+ href: "/categories/chairs"
519
+ }],
520
+ products: [{
521
+ id: "arden",
522
+ label: "Arden ergonomic chair",
523
+ href: "/products/arden-ergonomic-chair"
524
+ }, {
525
+ id: "harbour",
526
+ label: "Harbour standing desk",
527
+ href: "/products/harbour-standing-desk"
528
+ }],
529
+ pages: [{
530
+ id: "delivery",
531
+ label: "Delivery and returns",
532
+ href: "/pages/delivery-and-returns"
533
+ }]
534
+ };
535
+ var PICKER_SOURCE = {
536
+ types: storefrontLinkTypes,
537
+ fetch: async (type, { query }) => {
538
+ await new Promise((resolve) => setTimeout(resolve, 250));
539
+ const items = (PICKER_ITEMS[type] ?? []).filter((item) => item.label.toLowerCase().includes(query.toLowerCase()));
540
+ return {
541
+ items,
542
+ total: items.length
543
+ };
544
+ }
545
+ };
546
+ function SmallTools() {
547
+ return /* @__PURE__ */ jsx("div", {
548
+ className: "rich-text-editor-stage",
549
+ children: /* @__PURE__ */ jsx(StandIn, {
550
+ html: "<p>Water H<sub>2</sub>O, the 1<sup>st</sup> of the month, and the code <code>ARD-CH-BLK</code>.</p>",
551
+ "aria-label": "Care note"
552
+ })
553
+ });
554
+ }
555
+ /** The markup TipTap's Image extension draws with resize on: a container, a wrapper, the picture and four corner handles. */
556
+ var RESIZABLE_IMAGE = `<div data-resize-container="" data-node="image" contenteditable="false" style="display: flex"><div data-resize-wrapper="" style="position: relative; display: block"><img src="${`data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"960\" height=\"540\" viewBox=\"0 0 320 180\"><rect width=\"320\" height=\"180\" fill=\"#e9dfd0\"/><rect x=\"196\" y=\"22\" width=\"92\" height=\"96\" rx=\"4\" fill=\"#f6efe4\"/><path d=\"M242 22v96M196 70h92\" stroke=\"#dccfbb\" stroke-width=\"3\"/><rect y=\"132\" width=\"320\" height=\"48\" fill=\"#c9b79c\"/><rect x=\"58\" y=\"96\" width=\"132\" height=\"10\" rx=\"3\" fill=\"#8a6033\"/><path d=\"M70 106v40M178 106v40\" stroke=\"#6f4d29\" stroke-width=\"6\" stroke-linecap=\"round\"/><path d=\"M98 96V58\" stroke=\"#5a6b74\" stroke-width=\"3\"/><path d=\"M84 66h28l-6-16H90z\" fill=\"#d8a94e\"/><rect x=\"132\" y=\"70\" width=\"40\" height=\"26\" rx=\"3\" fill=\"#3f4e57\"/></svg>")}`}" alt="The Leeds showroom" style="width: 320px; height: 180px" />${[
557
+ "top-left",
558
+ "top-right",
559
+ "bottom-left",
560
+ "bottom-right"
561
+ ].map((corner) => {
562
+ const [y, x] = corner.split("-");
563
+ return `<div data-resize-handle="${corner}" style="position: absolute; ${y}: 0; ${x}: 0"></div>`;
564
+ }).join("")}</div></div>`;
565
+ function Images() {
566
+ return /* @__PURE__ */ jsx("div", {
567
+ className: "rich-text-editor-stage",
568
+ children: /* @__PURE__ */ jsx(StandIn, {
569
+ html: `<p>Click the picture to choose it: the size tools join the toolbar, and its corners show their handles.</p>${RESIZABLE_IMAGE}<p>Visit the showroom in Leeds, Monday to Saturday.</p>`,
570
+ "aria-label": "Showroom page"
571
+ })
572
+ });
573
+ }
574
+ function Source() {
575
+ const [saved, setSaved] = useState("");
576
+ return /* @__PURE__ */ jsxs("div", {
577
+ className: "rich-text-editor-stage",
578
+ children: [/* @__PURE__ */ jsx(StandIn, {
579
+ html: DESCRIPTION,
580
+ "aria-label": "Product description",
581
+ htmlSource: true,
582
+ onHtmlSourceChange: setSaved
583
+ }), /* @__PURE__ */ jsx("p", {
584
+ className: "rich-text-editor-status",
585
+ children: saved ? `onHtmlSourceChange: ${saved.length} characters of HTML` : "Press HTML source, at the end of the toolbar."
586
+ })]
587
+ });
588
+ }
589
+ var SPEC_SHEET = "<style>.spec{border-collapse:collapse;font:14px/1.5 Helvetica,Arial,sans-serif}.spec td,.spec th{padding:6px 12px;border:1px solid #d9dedc;text-align:left}.spec th{background:#f2f4f3}</style><table class=\"spec\"><tr><th>Seat height</th><td>42 to 54cm</td></tr><tr><th>Weight limit</th><td>130kg</td></tr><tr><th>Guarantee</th><td>Five years</td></tr></table>";
590
+ function Raw() {
591
+ const [html, setHtml] = useState(SPEC_SHEET);
592
+ return /* @__PURE__ */ jsx("div", {
593
+ className: "rich-text-editor-stage",
594
+ children: /* @__PURE__ */ jsx(StandIn, {
595
+ html: "",
596
+ "aria-label": "Supplier description",
597
+ htmlSource: true,
598
+ rawHtml: html,
599
+ onHtmlSourceChange: setHtml
600
+ })
601
+ });
602
+ }
603
+ function Colours() {
604
+ return /* @__PURE__ */ jsx("div", {
605
+ className: "rich-text-editor-stage",
606
+ children: /* @__PURE__ */ jsx(StandIn, {
607
+ html: "<p>Select some words, then give them a <span style=\"color: #980000\">colour of their own</span> or a <span style=\"background-color: #fff2cc\">highlight behind them</span>.</p>",
608
+ "aria-label": "Promotion banner text"
609
+ })
610
+ });
611
+ }
612
+ function PickedLinks() {
613
+ return /* @__PURE__ */ jsx("div", {
614
+ className: "rich-text-editor-stage",
615
+ children: /* @__PURE__ */ jsx(StandIn, {
616
+ html: DESCRIPTION,
617
+ "aria-label": "Product description",
618
+ linkSource: PICKER_SOURCE,
619
+ linkTargeting: "auto"
620
+ })
621
+ });
622
+ }
623
+ var LONG = DESCRIPTION + "<p>The seat tilts and locks in four positions, and the arms move up, down, in, out and round, so the chair fits the desk rather than the other way about.</p>".repeat(4) + POLICY;
624
+ function Sticky() {
625
+ return /* @__PURE__ */ jsxs("div", {
626
+ className: "rich-text-editor-scroller",
627
+ tabIndex: 0,
628
+ role: "region",
629
+ "aria-label": "A long page",
630
+ children: [/* @__PURE__ */ jsx("p", {
631
+ className: "rich-text-editor-status",
632
+ children: "Scroll this box: the toolbar stays at its top."
633
+ }), /* @__PURE__ */ jsx(StandIn, {
634
+ html: LONG,
635
+ "aria-label": "Product description",
636
+ stickyToolbar: true
637
+ })]
638
+ });
639
+ }
640
+ function Page() {
641
+ return /* @__PURE__ */ jsxs(DocPage, {
642
+ title: "Rich text editor",
643
+ status: "new",
644
+ importNames: ["RichTextEditor", "richTextEditorLabels"],
645
+ lead: "The frame and toolbar for a rich-text field, around an editor you own. You make the editor with TipTap's useEditor and render its EditorContent inside; Constellation draws the chrome, reads the editor through a small shape, and never imports TipTap itself. The content is dressed by the .o-prose styles, which a read-only rich-text block can wear on its own.",
646
+ children: [
647
+ /* @__PURE__ */ jsxs(Section$1, {
648
+ id: "basics",
649
+ title: "Basics",
650
+ description: /* @__PURE__ */ jsxs("p", { children: [
651
+ "Pass your ",
652
+ /* @__PURE__ */ jsx("code", { children: "editor" }),
653
+ " and render ",
654
+ /* @__PURE__ */ jsx("code", { children: "<EditorContent editor={editor} />" }),
655
+ " as the children. The toolbar draws a group of tools for each family your editor supports: undo and redo, the text style, the marks, the lists and the quote, alignment, and the link. A tool appears only when its command exists on the editor, so a host without the underline extension, or without text alignment, simply gets no such button. A tool that is on is drawn raised, with a teal glyph. When the frame is narrower than the tools, they run on to more rows, a row never starting with a hairline (",
656
+ /* @__PURE__ */ jsxs("code", { children: ["toolbarWrap=", "{false}"] }),
657
+ " keeps one row that scrolls sideways). Reach for it for formatted copy a person writes: a product description, an email, a policy. For a plain answer, a ",
658
+ /* @__PURE__ */ jsx("code", { children: "Textarea" }),
659
+ " is lighter."
660
+ ] }),
661
+ children: [
662
+ /* @__PURE__ */ jsx(Example, {
663
+ align: "fill",
664
+ caption: "A live stand-in editor: the toolbar works over the content below it.",
665
+ code: `
666
+ // A stand-in editor for these docs, over a contentEditable div
667
+ const { editor, ref, onInput } = useStandInEditor(text)
668
+
669
+ <RichTextEditor editor={editor} aria-label="Product description">
670
+ <div ref={ref} contentEditable onInput={onInput} dangerouslySetInnerHTML={{ __html: html }} />
671
+ </RichTextEditor>`,
672
+ children: /* @__PURE__ */ jsx(Basic, {})
673
+ }),
674
+ /* @__PURE__ */ jsx(Note, {
675
+ title: "This page uses a stand-in",
676
+ children: "The docs app has no TipTap, so the examples here drive the frame with a small stand-in over a plain contentEditable div. It answers every command the toolbar uses, so every tool works and shows its state: the marks, lists and quote, the text style menu, alignment and the link dialog, and Undo and Redo, which stay off until there is something to undo. A real host passes its own editor. In code, it looks like this:"
677
+ }),
678
+ /* @__PURE__ */ jsx(CodeBlock$1, { code: `
679
+ import { useEditor, EditorContent } from '@tiptap/react'
680
+ import StarterKit from '@tiptap/starter-kit'
681
+ import Underline from '@tiptap/extension-underline'
682
+ import Link from '@tiptap/extension-link'
683
+ import TextAlign from '@tiptap/extension-text-align'
684
+ import { RichTextEditor } from '@orbitcommerce/constellation'
685
+
686
+ const editor = useEditor({
687
+ extensions: [StarterKit, Underline, Link, TextAlign.configure({ types: ['heading', 'paragraph'] })],
688
+ })
689
+
690
+ <RichTextEditor editor={editor} showCount characterLimit={500} aria-label="Product description">
691
+ <EditorContent editor={editor} />
692
+ </RichTextEditor>` })
693
+ ]
694
+ }),
695
+ /* @__PURE__ */ jsxs(Section$1, {
696
+ id: "tools",
697
+ title: "More tools, links and the toolbar",
698
+ description: /* @__PURE__ */ jsxs("p", { children: [
699
+ "Inline code, subscript and superscript join the marks when the editor has them (StarterKit's code, and the subscript and superscript extensions); each style in the text style menu is drawn at its own size. The link tool opens the ",
700
+ /* @__PURE__ */ jsx(DocLink, {
701
+ to: "/components/link-picker",
702
+ children: "link picker"
703
+ }),
704
+ " when you give it a source, and a toolbar can stay in view on a long page."
705
+ ] }),
706
+ children: [
707
+ /* @__PURE__ */ jsx(SubSection, {
708
+ title: "Code, subscript and superscript",
709
+ children: /* @__PURE__ */ jsx(Example, {
710
+ align: "fill",
711
+ code: `
712
+ const editor = useEditor({ extensions: [StarterKit, Subscript, Superscript] })
713
+
714
+ <RichTextEditor editor={editor}>
715
+ <EditorContent editor={editor} />
716
+ </RichTextEditor>`,
717
+ children: /* @__PURE__ */ jsx(SmallTools, {})
718
+ })
719
+ }),
720
+ /* @__PURE__ */ jsx(SubSection, {
721
+ title: "Image size and alignment",
722
+ children: /* @__PURE__ */ jsx(Example, {
723
+ align: "fill",
724
+ caption: "While a picture is chosen: 25, 50 and 75% of the text's width, and steps a tenth smaller or larger, never under 50px or past the picture's own width, its aspect kept. The alignment tools line it up. Every one is a button in the toolbar's arrow-key path; the corner handles are for the pointer.",
725
+ code: `
726
+ const editor = useEditor({
727
+ extensions: [
728
+ StarterKit,
729
+ Image.configure({
730
+ resize: { enabled: true, directions: ['top-left', 'top-right', 'bottom-left', 'bottom-right'], minWidth: 50, minHeight: 50, alwaysPreserveAspectRatio: true },
731
+ }),
732
+ TextAlign.configure({ types: ['heading', 'paragraph', 'image'] }),
733
+ ],
734
+ })`,
735
+ children: /* @__PURE__ */ jsx(Images, {})
736
+ })
737
+ }),
738
+ /* @__PURE__ */ jsx(SubSection, {
739
+ title: "HTML source",
740
+ children: /* @__PURE__ */ jsx(Example, {
741
+ align: "fill",
742
+ caption: "htmlSource adds the source tool at the toolbar's end: the content as HTML in a mono field, written back to the editor as you return, so your own update handler hears it.",
743
+ code: `
744
+ <RichTextEditor editor={editor} htmlSource onHtmlSourceChange={setDraft}>
745
+ <EditorContent editor={editor} />
746
+ </RichTextEditor>`,
747
+ children: /* @__PURE__ */ jsx(Source, {})
748
+ })
749
+ }),
750
+ /* @__PURE__ */ jsx(SubSection, {
751
+ title: "Content the editor cannot show",
752
+ children: /* @__PURE__ */ jsx(Example, {
753
+ align: "fill",
754
+ caption: "Content with a script, an iframe, a style, an embed or an object is drawn as a preview that runs nothing, under a banner with a way into its source. TipTap would drop those parts, so they never reach the editor: give the stored HTML as rawHtml and save what onHtmlSourceChange hears.",
755
+ code: `
756
+ <RichTextEditor editor={editor} htmlSource rawHtml={product.description} onHtmlSourceChange={saveDescription}>
757
+ <EditorContent editor={editor} />
758
+ </RichTextEditor>`,
759
+ children: /* @__PURE__ */ jsx(Raw, {})
760
+ })
761
+ }),
762
+ /* @__PURE__ */ jsx(SubSection, {
763
+ title: "Text colour and highlight",
764
+ children: /* @__PURE__ */ jsx(Example, {
765
+ align: "fill",
766
+ caption: "Each tool's bar shows the colour where the caret is. The popover has a tab for the text and one for the colour behind it: presets, a hex, the eyedropper and Clear, applied to the selection as you pick.",
767
+ code: `
768
+ const editor = useEditor({
769
+ extensions: [StarterKit, TextStyle, Color, Highlight.configure({ multicolor: true })],
770
+ })
771
+
772
+ <RichTextEditor editor={editor} colourPresets={brandColours}>
773
+ <EditorContent editor={editor} />
774
+ </RichTextEditor>`,
775
+ children: /* @__PURE__ */ jsx(Colours, {})
776
+ })
777
+ }),
778
+ /* @__PURE__ */ jsxs(SubSection, {
779
+ title: "Links",
780
+ children: [/* @__PURE__ */ jsx(Example, {
781
+ align: "fill",
782
+ caption: "With linkSource the link tool opens the link picker. Put the caret somewhere with nothing selected and the destination's name goes in as linked text.",
783
+ code: `
784
+ <RichTextEditor editor={editor} linkSource={linkSource} linkTargeting="auto">
785
+ <EditorContent editor={editor} />
786
+ </RichTextEditor>`,
787
+ children: /* @__PURE__ */ jsx(PickedLinks, {})
788
+ }), /* @__PURE__ */ jsxs(Note, {
789
+ title: "Where a link opens",
790
+ children: [
791
+ "With ",
792
+ /* @__PURE__ */ jsx("code", { children: "linkTargeting=\"auto\"" }),
793
+ " a link that leaves the site opens a new tab with",
794
+ " ",
795
+ /* @__PURE__ */ jsx("code", { children: "rel=\"noopener noreferrer nofollow\"" }),
796
+ " and a link to the store's own pages has neither, so the dialog asks nothing about tabs; that is how ",
797
+ /* @__PURE__ */ jsx("code", { children: "internalAwareLink" }),
798
+ " renders them too. The plain address dialog keeps a relative path as written: ",
799
+ /* @__PURE__ */ jsx("code", { children: "products/arden-chair" }),
800
+ " no longer becomes",
801
+ " ",
802
+ /* @__PURE__ */ jsx("code", { children: "https://products/arden-chair" }),
803
+ ", while ",
804
+ /* @__PURE__ */ jsx("code", { children: "example.com" }),
805
+ " still gains ",
806
+ /* @__PURE__ */ jsx("code", { children: "https://" }),
807
+ "."
808
+ ]
809
+ })]
810
+ }),
811
+ /* @__PURE__ */ jsx(SubSection, {
812
+ title: "A toolbar that stays in view",
813
+ children: /* @__PURE__ */ jsx(Example, {
814
+ align: "fill",
815
+ caption: "stickyToolbar keeps the tools at the top of the scrolling page while a long text scrolls under them; --o-rich-text-sticky-top puts them below a sticky header of your own.",
816
+ code: `
817
+ <RichTextEditor editor={editor} stickyToolbar style={{ '--o-rich-text-sticky-top': '64px' }}>
818
+ <EditorContent editor={editor} />
819
+ </RichTextEditor>`,
820
+ children: /* @__PURE__ */ jsx(Sticky, {})
821
+ })
822
+ })
823
+ ]
824
+ }),
825
+ /* @__PURE__ */ jsx(Section$1, {
826
+ id: "tiptap",
827
+ title: "With TipTap: the /tiptap entry",
828
+ description: /* @__PURE__ */ jsxs("p", { children: [
829
+ "Two extensions for the editor you make, from the optional ",
830
+ /* @__PURE__ */ jsx("code", { children: "/tiptap" }),
831
+ " entry (it needs",
832
+ " ",
833
+ /* @__PURE__ */ jsx("code", { children: "@tiptap/core" }),
834
+ ", and the main entry still imports no TipTap). ",
835
+ /* @__PURE__ */ jsx("code", { children: "internalAwareLink" }),
836
+ " takes your own Link extension and decides each link's tab by where it goes, so links between a store's pages no longer open new tabs or carry nofollow. ",
837
+ /* @__PURE__ */ jsx("code", { children: "PreserveInlineStyles" }),
838
+ " keeps the inline styles of imported and hand-written HTML through editing; register it last."
839
+ ] }),
840
+ children: /* @__PURE__ */ jsx(CodeBlock$1, { code: `
841
+ import Link from '@tiptap/extension-link'
842
+ import { internalAwareLink, PreserveInlineStyles } from '@orbitcommerce/constellation/tiptap'
843
+
844
+ const editor = useEditor({
845
+ extensions: [
846
+ StarterKit.configure({ link: false }),
847
+ internalAwareLink(Link).configure({ openOnClick: false }),
848
+ TextAlign.configure({ types: ['heading', 'paragraph'] }),
849
+ PreserveInlineStyles,
850
+ ],
851
+ })` })
852
+ }),
853
+ /* @__PURE__ */ jsxs(Section$1, {
854
+ id: "frame-states",
855
+ title: "The frame and its states",
856
+ description: /* @__PURE__ */ jsx("p", { children: "The frame turns teal on focus, red on error, and sinks into the well when the field is off. The toolbar can carry a count, extra controls at its end, or your own words; the image tool appears only when you ask for it." }),
857
+ children: [
858
+ /* @__PURE__ */ jsxs(SubSection, {
859
+ title: "Character count",
860
+ children: [/* @__PURE__ */ jsx(Example, {
861
+ align: "fill",
862
+ caption: "The count sits under the content: out of the limit when there is one, and in the negative tone past it.",
863
+ code: `
864
+ <RichTextEditor editor={editor} showCount characterLimit={220}>
865
+ <EditorContent editor={editor} />
866
+ </RichTextEditor>`,
867
+ children: /* @__PURE__ */ jsx(Counted, {})
868
+ }), /* @__PURE__ */ jsxs(Note, { children: [/* @__PURE__ */ jsx("code", { children: "showCount" }), " only says the count: it does not stop typing past the limit. Add TipTap's character-count extension and the count reads that instead, so the two agree."] })]
869
+ }),
870
+ /* @__PURE__ */ jsx(SubSection, {
871
+ title: "Invalid",
872
+ children: /* @__PURE__ */ jsx(Example, {
873
+ align: "fill",
874
+ caption: "In a Field with an error, the frame takes the negative tone and the content says aria-invalid.",
875
+ code: `
876
+ <Field label="Returns policy" error="Say how long a return takes, and who pays the postage.">
877
+ <RichTextEditor editor={editor}>
878
+ <EditorContent editor={editor} />
879
+ </RichTextEditor>
880
+ </Field>`,
881
+ children: /* @__PURE__ */ jsx(Invalid, {})
882
+ })
883
+ }),
884
+ /* @__PURE__ */ jsx(SubSection, {
885
+ title: "Read-only and disabled",
886
+ children: /* @__PURE__ */ jsx(Example, {
887
+ align: "fill",
888
+ caption: "Read-only keeps the content, drops the toolbar and stays copyable. Disabled sinks the field into the Input's well, quiets its words and turns every tool off.",
889
+ code: `
890
+ <RichTextEditor editor={editor} readOnly>
891
+ <EditorContent editor={editor} />
892
+ </RichTextEditor>
893
+
894
+ <RichTextEditor editor={editor} disabled>
895
+ <EditorContent editor={editor} />
896
+ </RichTextEditor>`,
897
+ children: /* @__PURE__ */ jsx(Off, {})
898
+ })
899
+ }),
900
+ /* @__PURE__ */ jsx(SubSection, {
901
+ title: "Controls of your own, and the image tool",
902
+ children: /* @__PURE__ */ jsx(Example, {
903
+ align: "fill",
904
+ caption: "toolbarEnd takes extra controls after the tools. onImageRequest adds the image tool and hands it back to you.",
905
+ code: `
906
+ <RichTextEditor editor={editor} toolbarEnd={<Button size="sm" variant="ghost">Preview</Button>}>
907
+ <EditorContent editor={editor} />
908
+ </RichTextEditor>
909
+
910
+ <RichTextEditor editor={editor} onImageRequest={() => openMediaPicker()}>
911
+ <EditorContent editor={editor} />
912
+ </RichTextEditor>`,
913
+ children: /* @__PURE__ */ jsxs("div", {
914
+ className: "rich-text-editor-stack",
915
+ children: [/* @__PURE__ */ jsx(ExtraControls, {}), /* @__PURE__ */ jsx(WithImage, {})]
916
+ })
917
+ })
918
+ }),
919
+ /* @__PURE__ */ jsx(SubSection, {
920
+ title: "Your own words",
921
+ children: /* @__PURE__ */ jsx(Example, {
922
+ align: "fill",
923
+ caption: "labels replaces any word the component says itself.",
924
+ code: `
925
+ <RichTextEditor editor={editor} labels={{ toolbar: 'Text formatting', bold: 'Bold text' }}>
926
+ <EditorContent editor={editor} />
927
+ </RichTextEditor>`,
928
+ children: /* @__PURE__ */ jsx(OwnWords, {})
929
+ })
930
+ })
931
+ ]
932
+ }),
933
+ /* @__PURE__ */ jsx(Section$1, {
934
+ id: "prose",
935
+ title: "The content styles, .o-prose",
936
+ description: /* @__PURE__ */ jsxs("p", { children: [
937
+ "The editor's surface already wears ",
938
+ /* @__PURE__ */ jsx("code", { children: "o-prose" }),
939
+ ", so its content reads as headings, paragraphs, lists, quotes, code and links. The same class dresses a read-only rich-text block on its own: a policy shown on a product page, a comment, an article. Headings and paragraphs, nested list markers, a quote, inline code and a code block, images, links and highlights all take the kit's tokens, in both themes."
940
+ ] }),
941
+ children: /* @__PURE__ */ jsx(Example, {
942
+ align: "fill",
943
+ code: `
944
+ <div className="o-prose">
945
+ <h2>Delivery and returns</h2>
946
+ <p>Orders placed before 2pm leave the warehouse the same day.</p>
947
+ <ul>
948
+ <li>Standard delivery, 2 to 3 working days.</li>
949
+ <li>Next day, ordered before 2pm.</li>
950
+ </ul>
951
+ <blockquote>If a chair arrives damaged, tell us within 14 days.</blockquote>
952
+ <p>Our stock codes look like <code>ARD-CH-BLK</code>.</p>
953
+ <p>Read the full <a href="https://orbit.example/returns">returns policy</a>.</p>
954
+ </div>`,
955
+ children: /* @__PURE__ */ jsx("div", {
956
+ className: "rich-text-editor-prose",
957
+ children: ARTICLE
958
+ })
959
+ })
960
+ }),
961
+ /* @__PURE__ */ jsx(Section$1, {
962
+ id: "both-themes",
963
+ title: "In both themes",
964
+ description: /* @__PURE__ */ jsx("p", { children: "The editor and a read-only article, light and dark side by side." }),
965
+ children: /* @__PURE__ */ jsx(ThemePair, {
966
+ align: "fill",
967
+ children: /* @__PURE__ */ jsxs("div", {
968
+ className: "rich-text-editor-pair",
969
+ children: [/* @__PURE__ */ jsx(StandIn, {
970
+ html: DESCRIPTION,
971
+ "aria-label": "Product description",
972
+ showCount: true
973
+ }), /* @__PURE__ */ jsx("div", {
974
+ className: "rich-text-editor-prose",
975
+ children: ARTICLE
976
+ })]
977
+ })
978
+ })
979
+ }),
980
+ /* @__PURE__ */ jsx(Fragment$1, {}),
981
+ /* @__PURE__ */ jsxs(Section$1, {
982
+ id: "guidelines",
983
+ title: "Guidelines",
984
+ children: [/* @__PURE__ */ jsx(DoDont, {
985
+ do: {
986
+ children: /* @__PURE__ */ jsx("div", {
987
+ className: "rich-text-editor-dodont",
988
+ children: /* @__PURE__ */ jsx(StandIn, {
989
+ html: "<p>The Arden chair, built for long days at a desk.</p>",
990
+ "aria-label": "Product description",
991
+ minHeight: "96px"
992
+ })
993
+ }),
994
+ caption: "Formatted copy that holds a shape: a description, an email, a policy."
995
+ },
996
+ dont: {
997
+ children: /* @__PURE__ */ jsx("div", {
998
+ className: "rich-text-editor-dodont",
999
+ children: /* @__PURE__ */ jsx(Field, {
1000
+ label: "Delivery note",
1001
+ children: /* @__PURE__ */ jsx(Textarea, {
1002
+ rows: 3,
1003
+ defaultValue: "Leave with the neighbour at number 12."
1004
+ })
1005
+ })
1006
+ }),
1007
+ caption: "A plain answer gets a Textarea. A toolbar offers formatting the answer does not need."
1008
+ }
1009
+ }), /* @__PURE__ */ jsx(Guidelines, { items: [
1010
+ "Use it when the words need shape: a heading, a list, a link. When the answer is plain, a Textarea is lighter and quicker.",
1011
+ "Show the tools your extensions actually give: the component already hides any it cannot run, so do not build a toolbar of your own around it.",
1012
+ "Keep the toolbar to the marks people reach for. More tools crowd the row and slow the choice.",
1013
+ "A limit is a guide, not a wall. If a length matters, add the character-count extension so typing stops and the count agrees.",
1014
+ "A read-only block of rich text is a div with o-prose: no editor, no toolbar."
1015
+ ] })]
1016
+ }),
1017
+ /* @__PURE__ */ jsxs(Section$1, {
1018
+ id: "accessibility",
1019
+ title: "Accessibility",
1020
+ description: /* @__PURE__ */ jsxs("p", { children: [
1021
+ "The toolbar is a real ",
1022
+ /* @__PURE__ */ jsx("code", { children: "role=\"toolbar\"" }),
1023
+ " named ",
1024
+ /* @__PURE__ */ jsx("code", { children: "Formatting" }),
1025
+ ", its tools one group per family. Each tool is an icon button with a label (\"Bold\", \"Bulleted list\"); a toggle says whether it is on with ",
1026
+ /* @__PURE__ */ jsx("code", { children: "aria-pressed" }),
1027
+ ". The content is a textbox: ",
1028
+ /* @__PURE__ */ jsx("code", { children: "role=\"textbox\"" }),
1029
+ " and",
1030
+ " ",
1031
+ /* @__PURE__ */ jsx("code", { children: "aria-multiline" }),
1032
+ " are set on the editable element, and its name and description come from the surrounding ",
1033
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
1034
+ " or an ",
1035
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
1036
+ " you pass; an error sets",
1037
+ " ",
1038
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
1039
+ "."
1040
+ ] }),
1041
+ children: [/* @__PURE__ */ jsx(Guidelines, { items: [
1042
+ "The toolbar has one tab stop, remembered as you move: Tab reaches the toolbar, then the arrow keys move between tools, Home and End jump to the first and last, and disabled tools are skipped.",
1043
+ "Every icon-only tool needs a label. The component supplies the English set; labels replaces any of them.",
1044
+ "The editing behaviour (bolding with the keyboard, moving the caret) is the host editor's, from TipTap and its extensions. The kit draws and wires the toolbar only.",
1045
+ "Give the field a name with a Field label or an aria-label, so the textbox is announced with what it is for.",
1046
+ "A disabled editor says so in tone and turns every tool off; a read-only one keeps the content selectable and copyable, with no toolbar."
1047
+ ] }), /* @__PURE__ */ jsx(DocTable, {
1048
+ columns: ["Key", "What it does"],
1049
+ rows: [
1050
+ ["Tab", "Reaches the toolbar, landing on the last tool you were on, or the first."],
1051
+ ["Arrow right, or left", "Moves to the next or previous tool, wrapping at the ends."],
1052
+ ["Home, End", "Moves to the first or last tool."],
1053
+ ["Space or Enter", "Presses the focused tool."]
1054
+ ]
1055
+ })]
1056
+ }),
1057
+ /* @__PURE__ */ jsxs(Section$1, {
1058
+ id: "props",
1059
+ title: "Props",
1060
+ description: /* @__PURE__ */ jsx("p", { children: "RichTextEditor also accepts every native div attribute; className, style and the rest land on the frame." }),
1061
+ children: [
1062
+ /* @__PURE__ */ jsx(PropsTable, {
1063
+ title: "RichTextEditor",
1064
+ rows: [
1065
+ {
1066
+ name: "editor",
1067
+ type: "RichTextEditorInstance | null",
1068
+ required: true,
1069
+ description: "Your TipTap editor from useEditor. While it is null the frame draws with a disabled toolbar."
1070
+ },
1071
+ {
1072
+ name: "children",
1073
+ type: "ReactNode",
1074
+ required: true,
1075
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
1076
+ "Your ",
1077
+ /* @__PURE__ */ jsx("code", { children: "<EditorContent editor={editor} />" }),
1078
+ "."
1079
+ ] })
1080
+ },
1081
+ {
1082
+ name: "headingLevels",
1083
+ type: "RichTextHeadingLevel[]",
1084
+ default: "[1, 2, 3]",
1085
+ description: "The heading levels the block menu offers."
1086
+ },
1087
+ {
1088
+ name: "onLinkRequest",
1089
+ type: "(current) => void",
1090
+ description: "Draw your own link picker instead of the kit's dialog; called with the current link."
1091
+ },
1092
+ {
1093
+ name: "linkSource",
1094
+ type: "LinkPickerSource",
1095
+ description: "The link tool opens the link picker over this source."
1096
+ },
1097
+ {
1098
+ name: "linkTargeting",
1099
+ type: "'manual' | 'auto'",
1100
+ default: "'manual'",
1101
+ description: "A new-tab box, or the tab decided by where the link goes."
1102
+ },
1103
+ {
1104
+ name: "linkPickerLabels",
1105
+ type: "Partial<LinkPickerLabels>",
1106
+ description: "The link picker’s words."
1107
+ },
1108
+ {
1109
+ name: "toolbarWrap",
1110
+ type: "boolean",
1111
+ default: "true",
1112
+ description: "The tools run on to more rows; false keeps one row that scrolls."
1113
+ },
1114
+ {
1115
+ name: "stickyToolbar",
1116
+ type: "boolean",
1117
+ default: "false",
1118
+ description: "Keeps the toolbar in view on a long page."
1119
+ },
1120
+ {
1121
+ name: "colourPresets",
1122
+ type: "string[]",
1123
+ default: "RICH_TEXT_COLOUR_PRESETS",
1124
+ description: "The colours the text colour and highlight popover offers."
1125
+ },
1126
+ {
1127
+ name: "htmlSource",
1128
+ type: "boolean",
1129
+ default: "false",
1130
+ description: "The HTML source tool at the toolbar’s end."
1131
+ },
1132
+ {
1133
+ name: "rawHtml",
1134
+ type: "string",
1135
+ description: "The stored content: drawn as a sandboxed preview when it holds what the editor cannot show."
1136
+ },
1137
+ {
1138
+ name: "onHtmlSourceChange",
1139
+ type: "(html: string) => void",
1140
+ description: "Hears the source as it is typed."
1141
+ },
1142
+ {
1143
+ name: "sourceMode, onSourceModeChange",
1144
+ type: "boolean, (on) => void",
1145
+ description: "The source view, controlled."
1146
+ },
1147
+ {
1148
+ name: "onImageRequest",
1149
+ type: "() => void",
1150
+ description: "Shows the image tool; call your own media picker."
1151
+ },
1152
+ {
1153
+ name: "toolbarEnd",
1154
+ type: "ReactNode",
1155
+ description: "Extra controls at the toolbar's end."
1156
+ },
1157
+ {
1158
+ name: "showCount",
1159
+ type: "boolean",
1160
+ default: "false",
1161
+ description: "A character count under the content; with characterLimit it says \"n of limit\"."
1162
+ },
1163
+ {
1164
+ name: "characterLimit",
1165
+ type: "number",
1166
+ description: "The most characters said, past which the count turns negative."
1167
+ },
1168
+ {
1169
+ name: "disabled",
1170
+ type: "boolean",
1171
+ default: "false",
1172
+ description: "Editing off and dimmed; calls editor.setEditable(false)."
1173
+ },
1174
+ {
1175
+ name: "readOnly",
1176
+ type: "boolean",
1177
+ default: "false",
1178
+ description: "Editing off without the dimming, and no toolbar."
1179
+ },
1180
+ {
1181
+ name: "invalid",
1182
+ type: "boolean",
1183
+ default: "false",
1184
+ description: "The error treatment, and aria-invalid on the content."
1185
+ },
1186
+ {
1187
+ name: "minHeight",
1188
+ type: "string",
1189
+ default: "'150px'",
1190
+ description: "The content area's least height, a CSS length."
1191
+ },
1192
+ {
1193
+ name: "labels",
1194
+ type: "Partial<RichTextEditorLabels>",
1195
+ default: "English defaults",
1196
+ description: "Reword the editor's own sentences, below."
1197
+ }
1198
+ ]
1199
+ }),
1200
+ /* @__PURE__ */ jsx(DocTable, {
1201
+ columns: ["Editor", "What the kit reads from it"],
1202
+ rows: [
1203
+ ["isActive(name)", "A tool's pressed state, and which block is current."],
1204
+ ["chain() and can().chain()", "Runs a tool; a tool is disabled when its command cannot run."],
1205
+ ["getAttributes(\"link\")", "Fills the link dialog with the link under the caret."],
1206
+ ["setEditable()", "Called by disabled and readOnly."],
1207
+ ["getText()", "The count, when there is no character-count extension."],
1208
+ ["on/off(\"transaction\", \"focus\", \"blur\")", "The frame re-renders on the editor's own events."],
1209
+ ["storage.characterCount.characters()", "The count, when that extension is installed."]
1210
+ ]
1211
+ }),
1212
+ /* @__PURE__ */ jsx(DocTable, {
1213
+ columns: ["Word", "Default"],
1214
+ rows: [
1215
+ ["toolbar", /* @__PURE__ */ jsx("code", { children: "Formatting" })],
1216
+ ["undo", /* @__PURE__ */ jsx("code", { children: "Undo" })],
1217
+ ["redo", /* @__PURE__ */ jsx("code", { children: "Redo" })],
1218
+ ["blockType", /* @__PURE__ */ jsx("code", { children: "Text style" })],
1219
+ ["paragraph", /* @__PURE__ */ jsx("code", { children: "Paragraph" })],
1220
+ ["heading", /* @__PURE__ */ jsx("code", { children: "(level) => `Heading ${level}`" })],
1221
+ ["bold", /* @__PURE__ */ jsx("code", { children: "Bold" })],
1222
+ ["italic", /* @__PURE__ */ jsx("code", { children: "Italic" })],
1223
+ ["underline", /* @__PURE__ */ jsx("code", { children: "Underline" })],
1224
+ ["strike", /* @__PURE__ */ jsx("code", { children: "Strikethrough" })],
1225
+ ["code", /* @__PURE__ */ jsx("code", { children: "Inline code" })],
1226
+ ["subscript", /* @__PURE__ */ jsx("code", { children: "Subscript" })],
1227
+ ["superscript", /* @__PURE__ */ jsx("code", { children: "Superscript" })],
1228
+ ["textColour", /* @__PURE__ */ jsx("code", { children: "Text colour" })],
1229
+ ["highlight", /* @__PURE__ */ jsx("code", { children: "Highlight" })],
1230
+ ["textTab", /* @__PURE__ */ jsx("code", { children: "Text" })],
1231
+ ["backgroundTab", /* @__PURE__ */ jsx("code", { children: "Background" })],
1232
+ ["clearColour", /* @__PURE__ */ jsx("code", { children: "Clear" })],
1233
+ ["imageSize", /* @__PURE__ */ jsx("code", { children: "Size" })],
1234
+ ["imageResize", /* @__PURE__ */ jsx("code", { children: "(percent) => `Resize image to ${percent}%`" })],
1235
+ ["imageSmaller", /* @__PURE__ */ jsx("code", { children: "Make image smaller" })],
1236
+ ["imageLarger", /* @__PURE__ */ jsx("code", { children: "Make image larger" })],
1237
+ ["htmlSource", /* @__PURE__ */ jsx("code", { children: "HTML source" })],
1238
+ ["sourcePlaceholder", /* @__PURE__ */ jsx("code", { children: "Write or paste HTML" })],
1239
+ ["rawPreview", /* @__PURE__ */ jsx("code", { children: "This content holds HTML the editor cannot show…" })],
1240
+ ["editSource", /* @__PURE__ */ jsx("code", { children: "Edit the HTML source" })],
1241
+ ["rawPreviewTitle", /* @__PURE__ */ jsx("code", { children: "HTML preview" })],
1242
+ ["bulletList", /* @__PURE__ */ jsx("code", { children: "Bulleted list" })],
1243
+ ["orderedList", /* @__PURE__ */ jsx("code", { children: "Numbered list" })],
1244
+ ["quote", /* @__PURE__ */ jsx("code", { children: "Quote" })],
1245
+ ["alignLeft", /* @__PURE__ */ jsx("code", { children: "Align left" })],
1246
+ ["alignCenter", /* @__PURE__ */ jsx("code", { children: "Centre" })],
1247
+ ["alignRight", /* @__PURE__ */ jsx("code", { children: "Align right" })],
1248
+ ["alignJustify", /* @__PURE__ */ jsx("code", { children: "Justify" })],
1249
+ ["link", /* @__PURE__ */ jsx("code", { children: "Link" })],
1250
+ ["image", /* @__PURE__ */ jsx("code", { children: "Insert image" })],
1251
+ ["linkTitle", /* @__PURE__ */ jsx("code", { children: "Link" })],
1252
+ ["linkUrl", /* @__PURE__ */ jsx("code", { children: "Web address" })],
1253
+ ["linkNewTab", /* @__PURE__ */ jsx("code", { children: "Open in a new tab" })],
1254
+ ["linkSave", /* @__PURE__ */ jsx("code", { children: "Save" })],
1255
+ ["linkRemove", /* @__PURE__ */ jsx("code", { children: "Remove link" })],
1256
+ ["count", /* @__PURE__ */ jsx("code", { children: "(characters, limit) => limit ? `${characters} of ${limit} characters` : `${characters} characters`" })]
1257
+ ]
1258
+ })
1259
+ ]
1260
+ })
1261
+ ]
1262
+ });
1263
+ }
1264
+ //#endregion
1265
+ export { Page, Preview };