quoin-editor 1.0.2 → 1.1.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 (224) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/ai.cjs +168 -249
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.js +37 -121
  5. package/dist/ai.js.map +1 -1
  6. package/dist/catalogue.cjs +28 -43
  7. package/dist/catalogue.cjs.map +1 -1
  8. package/dist/catalogue.js +20 -37
  9. package/dist/catalogue.js.map +1 -1
  10. package/dist/{chunk-DUE3HCZD.js → chunk-2EQ6FKSK.js} +19 -28
  11. package/dist/chunk-2EQ6FKSK.js.map +1 -0
  12. package/dist/{chunk-RJRX34BZ.js → chunk-3BXUGX5F.js} +4 -18
  13. package/dist/chunk-3BXUGX5F.js.map +1 -0
  14. package/dist/chunk-3QRVAI53.cjs +27 -0
  15. package/dist/chunk-3QRVAI53.cjs.map +1 -0
  16. package/dist/{chunk-U3LOLYAU.js → chunk-7FAVFJAS.js} +4 -10
  17. package/dist/chunk-7FAVFJAS.js.map +1 -0
  18. package/dist/{chunk-6V6GGBDK.cjs → chunk-7SVKLWDT.cjs} +24 -31
  19. package/dist/chunk-7SVKLWDT.cjs.map +1 -0
  20. package/dist/{chunk-EH5KXQXY.cjs → chunk-A6PGQVTR.cjs} +36 -20
  21. package/dist/chunk-A6PGQVTR.cjs.map +1 -0
  22. package/dist/{chunk-P6KYXFZC.cjs → chunk-ACSEYJJF.cjs} +426 -534
  23. package/dist/chunk-ACSEYJJF.cjs.map +1 -0
  24. package/dist/{chunk-4SLJNZSM.cjs → chunk-AIS37SL2.cjs} +201 -198
  25. package/dist/chunk-AIS37SL2.cjs.map +1 -0
  26. package/dist/{chunk-X4HDKFW5.cjs → chunk-DTQFYHDJ.cjs} +56 -105
  27. package/dist/chunk-DTQFYHDJ.cjs.map +1 -0
  28. package/dist/{chunk-O4Z2WMFF.js → chunk-HDJ653LM.js} +25 -18
  29. package/dist/chunk-HDJ653LM.js.map +1 -0
  30. package/dist/chunk-HQ43EIYO.cjs +94 -0
  31. package/dist/chunk-HQ43EIYO.cjs.map +1 -0
  32. package/dist/{chunk-6NULZPVC.js → chunk-HTLWPSMU.js} +8 -61
  33. package/dist/chunk-HTLWPSMU.js.map +1 -0
  34. package/dist/{chunk-ADSJ42DO.js → chunk-HWEK7EX5.js} +17 -69
  35. package/dist/chunk-HWEK7EX5.js.map +1 -0
  36. package/dist/{chunk-623AOJM2.js → chunk-ITXCE6KL.js} +7 -25
  37. package/dist/chunk-ITXCE6KL.js.map +1 -0
  38. package/dist/{chunk-AUOEM3SF.cjs → chunk-IXVGHH7F.cjs} +102 -155
  39. package/dist/chunk-IXVGHH7F.cjs.map +1 -0
  40. package/dist/{chunk-NEZJ7ZP5.js → chunk-JZJIWRF3.js} +4 -8
  41. package/dist/chunk-JZJIWRF3.js.map +1 -0
  42. package/dist/{chunk-C23RQVRK.js → chunk-KSF2HILJ.js} +66 -216
  43. package/dist/chunk-KSF2HILJ.js.map +1 -0
  44. package/dist/{chunk-OBMBSU2S.js → chunk-L4D23LM2.js} +5 -184
  45. package/dist/chunk-L4D23LM2.js.map +1 -0
  46. package/dist/{chunk-4XFXB37X.js → chunk-L6OW2FL3.js} +7 -90
  47. package/dist/chunk-L6OW2FL3.js.map +1 -0
  48. package/dist/chunk-LE5XMIFJ.cjs +4 -3
  49. package/dist/chunk-LE5XMIFJ.cjs.map +1 -1
  50. package/dist/{chunk-5MAYUGTE.cjs → chunk-LY2D45F2.cjs} +233 -363
  51. package/dist/chunk-LY2D45F2.cjs.map +1 -0
  52. package/dist/{chunk-VCLL5C7J.js → chunk-MGMA5PEL.js} +14 -57
  53. package/dist/chunk-MGMA5PEL.js.map +1 -0
  54. package/dist/chunk-MQUCCSWG.js +2 -3
  55. package/dist/chunk-MQUCCSWG.js.map +1 -1
  56. package/dist/chunk-NO3KTZDY.cjs +33 -0
  57. package/dist/chunk-NO3KTZDY.cjs.map +1 -0
  58. package/dist/{chunk-TLGX43P6.cjs → chunk-OM7E43ZN.cjs} +89 -86
  59. package/dist/chunk-OM7E43ZN.cjs.map +1 -0
  60. package/dist/{chunk-JHQUHFLX.js → chunk-PJCHSHM3.js} +38 -120
  61. package/dist/chunk-PJCHSHM3.js.map +1 -0
  62. package/dist/{chunk-EPARJI4V.js → chunk-QC35D2AU.js} +107 -262
  63. package/dist/chunk-QC35D2AU.js.map +1 -0
  64. package/dist/{chunk-CW3AFJBR.cjs → chunk-QEMGOL5L.cjs} +1302 -1773
  65. package/dist/chunk-QEMGOL5L.cjs.map +1 -0
  66. package/dist/chunk-QWS7KH3K.cjs +483 -0
  67. package/dist/chunk-QWS7KH3K.cjs.map +1 -0
  68. package/dist/{chunk-IQBMAE3F.js → chunk-RHQPAW4W.js} +34 -92
  69. package/dist/chunk-RHQPAW4W.js.map +1 -0
  70. package/dist/chunk-RIIXJWBR.cjs +24 -0
  71. package/dist/chunk-RIIXJWBR.cjs.map +1 -0
  72. package/dist/{chunk-VRS6WCEK.js → chunk-SAEQMDAU.js} +60 -167
  73. package/dist/chunk-SAEQMDAU.js.map +1 -0
  74. package/dist/chunk-SKZC4K5S.cjs +612 -0
  75. package/dist/chunk-SKZC4K5S.cjs.map +1 -0
  76. package/dist/{chunk-N4FGA3H4.js → chunk-TBCHYHNU.js} +38 -105
  77. package/dist/chunk-TBCHYHNU.js.map +1 -0
  78. package/dist/{chunk-OSHZQR3W.js → chunk-TNN6Z52D.js} +13 -45
  79. package/dist/chunk-TNN6Z52D.js.map +1 -0
  80. package/dist/{chunk-YBMUEEM5.js → chunk-TYZSB7JT.js} +4 -8
  81. package/dist/chunk-TYZSB7JT.js.map +1 -0
  82. package/dist/{chunk-ZKVOS57Q.cjs → chunk-VFSVN5IQ.cjs} +495 -551
  83. package/dist/chunk-VFSVN5IQ.cjs.map +1 -0
  84. package/dist/{chunk-FDRUAL3Z.cjs → chunk-WDO6DBYU.cjs} +90 -153
  85. package/dist/chunk-WDO6DBYU.cjs.map +1 -0
  86. package/dist/{chunk-WEYDDIBQ.cjs → chunk-WHV5ZSIO.cjs} +36 -64
  87. package/dist/chunk-WHV5ZSIO.cjs.map +1 -0
  88. package/dist/{chunk-T43RZTUT.js → chunk-XJDPQFPU.js} +693 -1247
  89. package/dist/chunk-XJDPQFPU.js.map +1 -0
  90. package/dist/{chunk-BQANU5BH.cjs → chunk-ZTLYHRZT.cjs} +34 -44
  91. package/dist/chunk-ZTLYHRZT.cjs.map +1 -0
  92. package/dist/chunk-ZWB7SZVI.cjs +200 -0
  93. package/dist/chunk-ZWB7SZVI.cjs.map +1 -0
  94. package/dist/comments.cjs +209 -290
  95. package/dist/comments.cjs.map +1 -1
  96. package/dist/comments.js +81 -186
  97. package/dist/comments.js.map +1 -1
  98. package/dist/diff.cjs +48 -65
  99. package/dist/diff.cjs.map +1 -1
  100. package/dist/diff.d.cts +2 -2
  101. package/dist/diff.d.ts +2 -2
  102. package/dist/diff.js +8 -32
  103. package/dist/diff.js.map +1 -1
  104. package/dist/docx.cjs +50 -63
  105. package/dist/docx.cjs.map +1 -1
  106. package/dist/docx.js +7 -22
  107. package/dist/docx.js.map +1 -1
  108. package/dist/embed.cjs +18 -12
  109. package/dist/embed.cjs.map +1 -1
  110. package/dist/embed.js +9 -16
  111. package/dist/embed.js.map +1 -1
  112. package/dist/emoji-data.cjs +7 -5
  113. package/dist/emoji-data.cjs.map +1 -1
  114. package/dist/emoji-data.js +3 -5
  115. package/dist/emoji-data.js.map +1 -1
  116. package/dist/emoji.cjs +25 -17
  117. package/dist/emoji.cjs.map +1 -1
  118. package/dist/emoji.js +8 -17
  119. package/dist/emoji.js.map +1 -1
  120. package/dist/engine.cjs +229 -118
  121. package/dist/engine.cjs.map +1 -1
  122. package/dist/engine.js +4 -118
  123. package/dist/engine.js.map +1 -1
  124. package/dist/find.cjs +29 -19
  125. package/dist/find.cjs.map +1 -1
  126. package/dist/find.js +8 -19
  127. package/dist/find.js.map +1 -1
  128. package/dist/headless.cjs +290 -151
  129. package/dist/headless.cjs.map +1 -1
  130. package/dist/headless.d.cts +5 -1
  131. package/dist/headless.d.ts +5 -1
  132. package/dist/headless.js +5 -151
  133. package/dist/headless.js.map +1 -1
  134. package/dist/index.cjs +348 -183
  135. package/dist/index.cjs.map +1 -1
  136. package/dist/index.d.cts +14 -4
  137. package/dist/index.d.ts +14 -4
  138. package/dist/index.js +7 -183
  139. package/dist/index.js.map +1 -1
  140. package/dist/math.cjs +19 -13
  141. package/dist/math.cjs.map +1 -1
  142. package/dist/math.js +10 -17
  143. package/dist/math.js.map +1 -1
  144. package/dist/mention.cjs +19 -13
  145. package/dist/mention.cjs.map +1 -1
  146. package/dist/mention.js +10 -17
  147. package/dist/mention.js.map +1 -1
  148. package/dist/presence.cjs +98 -132
  149. package/dist/presence.cjs.map +1 -1
  150. package/dist/presence.js +21 -78
  151. package/dist/presence.js.map +1 -1
  152. package/dist/{registry-CWBOSAHm.d.ts → registry-CXegaw5k.d.cts} +25 -2
  153. package/dist/{registry-CWBOSAHm.d.cts → registry-CXegaw5k.d.ts} +25 -2
  154. package/dist/stats.cjs +26 -18
  155. package/dist/stats.cjs.map +1 -1
  156. package/dist/stats.js +9 -18
  157. package/dist/stats.js.map +1 -1
  158. package/dist/styles.css +1 -1
  159. package/dist/table.cjs +89 -49
  160. package/dist/table.cjs.map +1 -1
  161. package/dist/table.js +8 -49
  162. package/dist/table.js.map +1 -1
  163. package/dist/toc.cjs +25 -17
  164. package/dist/toc.cjs.map +1 -1
  165. package/dist/toc.js +8 -17
  166. package/dist/toc.js.map +1 -1
  167. package/dist/view.cjs +13 -16
  168. package/dist/view.cjs.map +1 -1
  169. package/dist/view.d.cts +2 -2
  170. package/dist/view.d.ts +2 -2
  171. package/dist/view.js +7 -16
  172. package/dist/view.js.map +1 -1
  173. package/dist/yjs.cjs +186 -228
  174. package/dist/yjs.cjs.map +1 -1
  175. package/dist/yjs.js +12 -80
  176. package/dist/yjs.js.map +1 -1
  177. package/package.json +1 -1
  178. package/dist/chunk-4SLJNZSM.cjs.map +0 -1
  179. package/dist/chunk-4XFXB37X.js.map +0 -1
  180. package/dist/chunk-5MAYUGTE.cjs.map +0 -1
  181. package/dist/chunk-623AOJM2.js.map +0 -1
  182. package/dist/chunk-6NULZPVC.js.map +0 -1
  183. package/dist/chunk-6V6GGBDK.cjs.map +0 -1
  184. package/dist/chunk-73653CJ4.cjs +0 -34
  185. package/dist/chunk-73653CJ4.cjs.map +0 -1
  186. package/dist/chunk-ADSJ42DO.js.map +0 -1
  187. package/dist/chunk-AUOEM3SF.cjs.map +0 -1
  188. package/dist/chunk-BQANU5BH.cjs.map +0 -1
  189. package/dist/chunk-C23RQVRK.js.map +0 -1
  190. package/dist/chunk-CW3AFJBR.cjs.map +0 -1
  191. package/dist/chunk-DUE3HCZD.js.map +0 -1
  192. package/dist/chunk-EH5KXQXY.cjs.map +0 -1
  193. package/dist/chunk-EPARJI4V.js.map +0 -1
  194. package/dist/chunk-FDRUAL3Z.cjs.map +0 -1
  195. package/dist/chunk-IQBMAE3F.js.map +0 -1
  196. package/dist/chunk-JHQUHFLX.js.map +0 -1
  197. package/dist/chunk-KUYZMSMF.cjs +0 -100
  198. package/dist/chunk-KUYZMSMF.cjs.map +0 -1
  199. package/dist/chunk-LLTEGXWZ.cjs +0 -562
  200. package/dist/chunk-LLTEGXWZ.cjs.map +0 -1
  201. package/dist/chunk-N4FGA3H4.js.map +0 -1
  202. package/dist/chunk-NEZJ7ZP5.js.map +0 -1
  203. package/dist/chunk-O4Z2WMFF.js.map +0 -1
  204. package/dist/chunk-OBMBSU2S.js.map +0 -1
  205. package/dist/chunk-OSHZQR3W.js.map +0 -1
  206. package/dist/chunk-P6KYXFZC.cjs.map +0 -1
  207. package/dist/chunk-R2BLBV43.cjs +0 -239
  208. package/dist/chunk-R2BLBV43.cjs.map +0 -1
  209. package/dist/chunk-RJRX34BZ.js.map +0 -1
  210. package/dist/chunk-T43RZTUT.js.map +0 -1
  211. package/dist/chunk-TLGX43P6.cjs.map +0 -1
  212. package/dist/chunk-U3LOLYAU.js.map +0 -1
  213. package/dist/chunk-UEKXVCKC.cjs +0 -716
  214. package/dist/chunk-UEKXVCKC.cjs.map +0 -1
  215. package/dist/chunk-VCLL5C7J.js.map +0 -1
  216. package/dist/chunk-VRS6WCEK.js.map +0 -1
  217. package/dist/chunk-WEYDDIBQ.cjs.map +0 -1
  218. package/dist/chunk-X4HDKFW5.cjs.map +0 -1
  219. package/dist/chunk-X4P4TQXH.cjs +0 -30
  220. package/dist/chunk-X4P4TQXH.cjs.map +0 -1
  221. package/dist/chunk-XA3UEJIW.cjs +0 -25
  222. package/dist/chunk-XA3UEJIW.cjs.map +0 -1
  223. package/dist/chunk-YBMUEEM5.js.map +0 -1
  224. package/dist/chunk-ZKVOS57Q.cjs.map +0 -1
@@ -1,716 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _chunkXA3UEJIWcjs = require('./chunk-XA3UEJIW.cjs');
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- var _chunkCW3AFJBRcjs = require('./chunk-CW3AFJBR.cjs');
30
-
31
-
32
-
33
-
34
-
35
- var _chunkP6KYXFZCcjs = require('./chunk-P6KYXFZC.cjs');
36
-
37
-
38
- var _chunkEH5KXQXYcjs = require('./chunk-EH5KXQXY.cjs');
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
- var _chunkZKVOS57Qcjs = require('./chunk-ZKVOS57Q.cjs');
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
- var _chunk4SLJNZSMcjs = require('./chunk-4SLJNZSM.cjs');
67
-
68
- // src/extensions/embed/LinkCard.tsx
69
- var _react = require('react');
70
- var _jsxruntime = require('react/jsx-runtime');
71
- function LinkCard({ controller, blockId, url, title, description, image, readOnly, linkRef }) {
72
- const card = _react.useRef.call(void 0, null);
73
- const [failed, setFailed] = _react.useState.call(void 0, null);
74
- const href = _chunk4SLJNZSMcjs.sanitizeHref.call(void 0, url);
75
- const domain = _chunkXA3UEJIWcjs.domainOf.call(void 0, url);
76
- const picture = _chunkXA3UEJIWcjs.webAddress.call(void 0, image);
77
- const name = title || url;
78
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: card, className: "quoin-link-card", ...readOnly ? void 0 : _chunkCW3AFJBRcjs.selectHandlers.call(void 0, controller, blockId, card), children: [
79
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "quoin-link-card-text", children: [
80
- href === null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "quoin-link-card-title", children: name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
81
- "a",
82
- {
83
- ref: linkRef,
84
- href,
85
- target: "_blank",
86
- rel: "noopener noreferrer",
87
- className: "quoin-link-card-title",
88
- tabIndex: readOnly ? void 0 : -1,
89
- children: name
90
- }
91
- ),
92
- description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "quoin-link-card-description", children: description }),
93
- domain !== null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "quoin-link-card-domain", children: domain })
94
- ] }),
95
- picture !== null && picture !== failed && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
96
- "img",
97
- {
98
- src: picture,
99
- alt: "",
100
- loading: "lazy",
101
- referrerPolicy: "no-referrer",
102
- draggable: false,
103
- className: "quoin-link-card-image",
104
- onError: () => setFailed(picture)
105
- }
106
- )
107
- ] });
108
- }
109
-
110
- // src/extensions/embed/use-link-card-keys.ts
111
-
112
- function useLinkCardKeys(controller, blockId, url, editable) {
113
- const root = _react.useRef.call(void 0, null);
114
- const link = _react.useRef.call(void 0, null);
115
- const keys = _react.useMemo.call(void 0, () => ({ enter: () => _optionalChain([link, 'access', _ => _.current, 'optionalAccess', _2 => _2.focus, 'call', _3 => _3()]) }), []);
116
- _chunkCW3AFJBRcjs.useNodeKeys.call(void 0, controller, blockId, editable, _chunk4SLJNZSMcjs.sanitizeHref.call(void 0, url) !== null, root, keys);
117
- return { root, link };
118
- }
119
-
120
- // src/extensions/embed/use-unfurl.ts
121
-
122
-
123
- // src/extensions/embed/unfurled-patch.ts
124
- var filled = (value) => typeof value === "string" && value.trim() !== "" ? value : void 0;
125
- function unfurledPatch(found) {
126
- if (typeof found !== "object" || found === null) return null;
127
- const { title, description, image } = found;
128
- const patch = { title: filled(title), description: filled(description), image: _nullishCoalesce(_chunkXA3UEJIWcjs.webAddress.call(void 0, image), () => ( void 0)) };
129
- if (patch.title === void 0) return null;
130
- return Object.fromEntries(Object.entries(patch).filter(([, value]) => value !== void 0));
131
- }
132
-
133
- // src/extensions/embed/use-unfurl.ts
134
- var canvases = /* @__PURE__ */ new WeakMap();
135
- function asksOf(controller) {
136
- let asks = canvases.get(controller);
137
- if (asks === void 0) {
138
- asks = { asked: /* @__PURE__ */ new Set(), drawn: /* @__PURE__ */ new Map() };
139
- canvases.set(controller, asks);
140
- }
141
- return asks;
142
- }
143
- var keyOf = (blockId, url) => JSON.stringify([blockId, url]);
144
- function askFirstTime(controller, blockId, url) {
145
- const { asked } = asksOf(controller);
146
- const key = keyOf(blockId, url);
147
- if (asked.has(key)) return false;
148
- asked.add(key);
149
- return true;
150
- }
151
- function bookmarkAt(controller, blockId, url) {
152
- const block = _chunk4SLJNZSMcjs.blockById.call(void 0, controller.editor.state.doc, blockId);
153
- return _optionalChain([block, 'optionalAccess', _4 => _4.type]) === "BOOKMARK" && _chunk4SLJNZSMcjs.str.call(void 0, block.attrs.url) === url ? block : void 0;
154
- }
155
- async function unfurlInto(controller, blockId, url, unfurl, onError) {
156
- const { asked, drawn } = asksOf(controller);
157
- let found;
158
- try {
159
- found = await unfurl(url);
160
- } catch (cause) {
161
- if (bookmarkAt(controller, blockId, url) && drawn.get(blockId)) onError(_chunkCW3AFJBRcjs.toError.call(void 0, cause));
162
- return;
163
- }
164
- const patch = unfurledPatch(found);
165
- if (patch === null) return;
166
- const block = bookmarkAt(controller, blockId, url);
167
- if (block === void 0 || !drawn.get(blockId) || controller.readOnly) {
168
- asked.delete(keyOf(blockId, url));
169
- return;
170
- }
171
- if (_chunk4SLJNZSMcjs.str.call(void 0, block.attrs.title) !== "") return;
172
- const { editor } = controller;
173
- editor.dispatch(editor.createTransaction().step(_chunkZKVOS57Qcjs.setAttrsStep.call(void 0, blockId, patch)).setMeta("addToHistory", false));
174
- }
175
- function useUnfurl(controller, blockId, url, unfurl) {
176
- const { onError } = _chunkCW3AFJBRcjs.useQuoin.call(void 0, );
177
- _react.useEffect.call(void 0, () => {
178
- const { drawn } = asksOf(controller);
179
- drawn.set(blockId, (_nullishCoalesce(drawn.get(blockId), () => ( 0))) + 1);
180
- return () => {
181
- const left = (_nullishCoalesce(drawn.get(blockId), () => ( 1))) - 1;
182
- if (left > 0) drawn.set(blockId, left);
183
- else drawn.delete(blockId);
184
- };
185
- }, [controller, blockId]);
186
- _react.useEffect.call(void 0, () => {
187
- if (unfurl === void 0 || url === "" || !askFirstTime(controller, blockId, url)) return;
188
- void unfurlInto(controller, blockId, url, unfurl, onError);
189
- }, [controller, blockId, url, unfurl, onError]);
190
- }
191
-
192
- // src/extensions/embed/BookmarkBlock.tsx
193
-
194
- function BookmarkBlock({ block, controller, feature }) {
195
- const readOnly = _chunkP6KYXFZCcjs.useReadOnly.call(void 0, controller);
196
- const { attrs } = block;
197
- const url = _chunk4SLJNZSMcjs.str.call(void 0, attrs.url);
198
- const title = _chunk4SLJNZSMcjs.str.call(void 0, attrs.title);
199
- const { root, link } = useLinkCardKeys(controller, block.id, url, !readOnly);
200
- useUnfurl(controller, block.id, url, title === "" && !readOnly ? feature.unfurl : void 0);
201
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
202
- "div",
203
- {
204
- ref: root,
205
- role: "group",
206
- "aria-label": feature.labels.bookmark,
207
- contentEditable: false,
208
- className: "quoin-bookmark",
209
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
210
- LinkCard,
211
- {
212
- controller,
213
- blockId: block.id,
214
- url,
215
- title,
216
- description: _chunk4SLJNZSMcjs.str.call(void 0, attrs.description),
217
- image: _chunk4SLJNZSMcjs.str.call(void 0, attrs.image),
218
- readOnly,
219
- linkRef: link
220
- }
221
- )
222
- }
223
- );
224
- }
225
-
226
- // src/extensions/embed/EmbedBlock.tsx
227
-
228
-
229
- // src/extensions/embed/EmbedFrame.tsx
230
-
231
-
232
- // src/extensions/embed/embed-player.ts
233
- var PLAYER_HEIGHTS = { spotify: 352, soundcloud: 166 };
234
- var playerHeight = (provider) => Object.hasOwn(PLAYER_HEIGHTS, provider) ? PLAYER_HEIGHTS[provider] : void 0;
235
-
236
- // src/extensions/embed/use-cover-press.ts
237
-
238
- function useCoverPress(controller) {
239
- const [pressing, setPressing] = _react.useState.call(void 0, false);
240
- _chunkP6KYXFZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
241
- const doc = _optionalChain([controller, 'access', _5 => _5.root, 'optionalAccess', _6 => _6.ownerDocument]);
242
- if (!pressing || doc === void 0) return;
243
- const release = () => setPressing(false);
244
- doc.addEventListener("click", release);
245
- doc.addEventListener("pointercancel", release);
246
- doc.addEventListener("dragend", release);
247
- return () => {
248
- doc.removeEventListener("click", release);
249
- doc.removeEventListener("pointercancel", release);
250
- doc.removeEventListener("dragend", release);
251
- };
252
- }, [controller, pressing]);
253
- const onPress = (event) => {
254
- if (event.button === 0) setPressing(true);
255
- };
256
- return { pressing, onPress };
257
- }
258
-
259
- // src/extensions/embed/EmbedFrame.tsx
260
-
261
- function EmbedFrame({ blockId, controller, match, title, readOnly }) {
262
- const root = _react.useRef.call(void 0, null);
263
- const frame = _react.useRef.call(void 0, null);
264
- const selected = _chunkP6KYXFZCcjs.useEditorState.call(void 0,
265
- controller,
266
- _react.useCallback.call(void 0, ({ selection }) => _optionalChain([selection, 'optionalAccess', _7 => _7.kind]) === "node" && selection.block === blockId, [blockId])
267
- );
268
- const cover = useCoverPress(controller);
269
- const keys = _react.useMemo.call(void 0, () => ({ enter: () => void setTimeout(() => _optionalChain([frame, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.focus, 'call', _10 => _10()])) }), []);
270
- _chunkCW3AFJBRcjs.useNodeKeys.call(void 0, controller, blockId, !readOnly, true, root, keys);
271
- const height = playerHeight(match.provider);
272
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
273
- "div",
274
- {
275
- ref: root,
276
- className: "quoin-embed-frame",
277
- ...height === void 0 ? void 0 : { "data-player": "", style: { height } },
278
- children: [
279
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
280
- "iframe",
281
- {
282
- ref: frame,
283
- src: match.src,
284
- title,
285
- sandbox: _chunk4SLJNZSMcjs.EMBED_FRAME.sandbox,
286
- loading: _chunk4SLJNZSMcjs.EMBED_FRAME.loading,
287
- referrerPolicy: _chunk4SLJNZSMcjs.EMBED_FRAME.referrerpolicy,
288
- tabIndex: readOnly ? void 0 : -1
289
- }
290
- ),
291
- !readOnly && (!selected || cover.pressing) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
292
- "div",
293
- {
294
- "aria-hidden": "true",
295
- className: "quoin-embed-cover",
296
- onPointerDownCapture: cover.onPress,
297
- onMouseDown: (event) => event.preventDefault(),
298
- onClick: () => _chunkCW3AFJBRcjs.focusNode.call(void 0, controller, blockId)
299
- }
300
- )
301
- ]
302
- }
303
- );
304
- }
305
-
306
- // src/extensions/embed/providers.ts
307
- function frameOf(url, provider) {
308
- try {
309
- return _nullishCoalesce(_optionalChain([_chunk4SLJNZSMcjs.embedFrame.call(void 0, url, [provider]), 'optionalAccess', _11 => _11.src]), () => ( null));
310
- } catch (e) {
311
- _chunkEH5KXQXYcjs.devWarn.call(void 0, `the embed provider "${provider.name}" threw, so it frames nothing.`);
312
- return null;
313
- }
314
- }
315
- function matchEmbed(url, hostProviders = []) {
316
- for (const provider of [...hostProviders, ..._chunk4SLJNZSMcjs.coreEmbedProviders]) {
317
- const src = frameOf(url, provider);
318
- if (src !== null) return { provider: provider.name, src };
319
- }
320
- return null;
321
- }
322
-
323
- // src/extensions/embed/EmbedBlock.tsx
324
-
325
- function EmbedBlock({ block, controller, feature }) {
326
- const { labels, providers } = feature;
327
- const readOnly = _chunkP6KYXFZCcjs.useReadOnly.call(void 0, controller);
328
- const url = _chunk4SLJNZSMcjs.str.call(void 0, block.attrs.url);
329
- const match = _react.useMemo.call(void 0, () => matchEmbed(url, providers), [url, providers]);
330
- const { root, link } = useLinkCardKeys(controller, block.id, url, !readOnly && match === null);
331
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: root, role: "group", "aria-label": labels.embed, contentEditable: false, className: "quoin-embed", children: match === null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkCard, { controller, blockId: block.id, url, readOnly, linkRef: link }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
332
- EmbedFrame,
333
- {
334
- blockId: block.id,
335
- controller,
336
- match,
337
- title: _chunk4SLJNZSMcjs.firstNamed.call(void 0, labels.frameTitle(match.provider), match.provider, url),
338
- readOnly
339
- }
340
- ) });
341
- }
342
-
343
- // src/extensions/embed/embed-labels.ts
344
- var PROVIDER_FRAMES = {
345
- youtube: "YouTube video",
346
- vimeo: "Vimeo video",
347
- loom: "Loom video",
348
- figma: "Figma design",
349
- codepen: "CodePen pen",
350
- spotify: "Spotify player",
351
- soundcloud: "SoundCloud player"
352
- };
353
- var englishEmbedLabels = {
354
- embed: "Embed",
355
- embedDescription: "A video, design or player from a link",
356
- bookmark: "Bookmark",
357
- bookmarkDescription: "A card that links to a page",
358
- frameTitle: (provider) => Object.hasOwn(PROVIDER_FRAMES, provider) ? PROVIDER_FRAMES[provider] : `${provider} embed`,
359
- linkOptions: "Link options",
360
- keepAsLink: "Keep as link",
361
- embedLink: "Link to embed",
362
- bookmarkLink: "Link to bookmark",
363
- notALink: "Enter a web address, such as https://example.com",
364
- cannotEmbed: "This link cannot be embedded.",
365
- bookmarkInstead: "Bookmark instead"
366
- };
367
- function resolveEmbedLabels(overrides) {
368
- const given = Object.entries(_nullishCoalesce(overrides, () => ( {}))).filter(([, value]) => value !== void 0);
369
- return given.length === 0 ? englishEmbedLabels : { ...englishEmbedLabels, ...Object.fromEntries(given) };
370
- }
371
-
372
- // src/extensions/embed/embed-slash-items.ts
373
- var _lucidereact = require('lucide-react');
374
-
375
- // src/extensions/embed/link-request.ts
376
-
377
- var stores = /* @__PURE__ */ new WeakMap();
378
- function storeOf(controller) {
379
- let store = stores.get(controller);
380
- if (store === void 0) {
381
- store = { request: null, listeners: /* @__PURE__ */ new Set() };
382
- stores.set(controller, store);
383
- }
384
- return store;
385
- }
386
- function requestLink(controller, request) {
387
- const store = storeOf(controller);
388
- if (store.request === request) return;
389
- store.request = request;
390
- for (const listener of [...store.listeners]) listener();
391
- }
392
- function useLinkRequest(controller) {
393
- const subscribe = _react.useCallback.call(void 0,
394
- (notify) => {
395
- const { listeners } = storeOf(controller);
396
- listeners.add(notify);
397
- return () => void listeners.delete(notify);
398
- },
399
- [controller]
400
- );
401
- const read = _react.useCallback.call(void 0, () => storeOf(controller).request, [controller]);
402
- return _react.useSyncExternalStore.call(void 0, subscribe, read, read);
403
- }
404
-
405
- // src/extensions/embed/embed-slash-items.ts
406
- var embedSlashItems = (labels) => [
407
- {
408
- id: "embed",
409
- title: labels.embed,
410
- description: labels.embedDescription,
411
- group: "embeds",
412
- icon: _lucidereact.AppWindow,
413
- keywords: ["iframe", "video", "youtube", "vimeo", "loom", "figma", "codepen", "spotify", "soundcloud"],
414
- run: ({ controller, range }) => requestLink(controller, { kind: "embed", at: range })
415
- },
416
- {
417
- id: "bookmark",
418
- title: labels.bookmark,
419
- description: labels.bookmarkDescription,
420
- group: "embeds",
421
- icon: _lucidereact.Bookmark,
422
- keywords: ["link", "url", "card", "preview", "web"],
423
- run: ({ controller, range }) => requestLink(controller, { kind: "bookmark", at: range })
424
- }
425
- ];
426
-
427
- // src/extensions/embed/link-choice.ts
428
- var linkChoiceKey = _chunkZKVOS57Qcjs.createPluginKey.call(void 0, "linkChoice");
429
- var linkChoicePlugin = {
430
- key: linkChoiceKey,
431
- init: () => null,
432
- apply(tr, value, before, after) {
433
- const pasted = tr.getMeta(linkChoiceKey.name);
434
- if (pasted !== void 0) return pasted;
435
- if (value === null) return null;
436
- const moved = tr.selectionSet && !_chunkZKVOS57Qcjs.sameSelection.call(void 0, tr.before.selection, tr.selection);
437
- const lineChanged = _chunk4SLJNZSMcjs.blockById.call(void 0, before.doc, value.block) !== _chunk4SLJNZSMcjs.blockById.call(void 0, after.doc, value.block);
438
- return moved || lineChanged ? null : value;
439
- }
440
- };
441
- var linkChoice = (state) => _nullishCoalesce(state.pluginState.get(linkChoiceKey.name), () => ( null));
442
- function onEmptyLine({ doc, schema, selection }) {
443
- if (doc.blocks.length === 0) return true;
444
- if (_optionalChain([selection, 'optionalAccess', _12 => _12.kind]) !== "text" || !_chunkZKVOS57Qcjs.isCollapsed.call(void 0, selection)) return false;
445
- const block = _chunk4SLJNZSMcjs.blockById.call(void 0, doc, selection.head.block);
446
- return block !== void 0 && _chunkZKVOS57Qcjs.isParagraph.call(void 0, block) && _chunkZKVOS57Qcjs.regionLength.call(void 0, block, _nullishCoalesce(_chunkZKVOS57Qcjs.primaryRegion.call(void 0, schema, block), () => ( ""))) === 0;
447
- }
448
- var pasteLinkChoice = {
449
- name: "link-choice",
450
- match(text, state) {
451
- const link = _chunkZKVOS57Qcjs.pastedLink.call(void 0, text);
452
- const slice = link === null || link.rest !== "" || !onEmptyLine(state) ? null : _chunkZKVOS57Qcjs.sliceFromClipboard.call(void 0, { text });
453
- if (link === null || slice === null) return null;
454
- const paste = _chunkZKVOS57Qcjs.insertSlice.call(void 0, slice);
455
- return (before, dispatch) => paste(before, dispatch && ((tr) => dispatch(tr.setMeta(linkChoiceKey.name, choiceAfter(tr, link.href)))));
456
- }
457
- };
458
- function choiceAfter(tr, href) {
459
- const { selection } = tr;
460
- return _optionalChain([selection, 'optionalAccess', _13 => _13.kind]) === "text" ? { block: selection.head.block, href } : null;
461
- }
462
- function emptyParagraph(blockId) {
463
- return (state, dispatch) => {
464
- const line = _chunk4SLJNZSMcjs.blockById.call(void 0, state.doc, blockId);
465
- if (line === void 0 || !_chunkZKVOS57Qcjs.isParagraph.call(void 0, line)) return false;
466
- const tr = new (0, _chunkZKVOS57Qcjs.Transaction)(state).step(_chunkZKVOS57Qcjs.replaceBlockStep.call(void 0, _chunkZKVOS57Qcjs.withContent.call(void 0, state.schema, line, [])));
467
- _optionalChain([dispatch, 'optionalCall', _14 => _14(tr.setSelection(_chunkZKVOS57Qcjs.startOf.call(void 0, tr.doc, state.schema, blockId)))]);
468
- return true;
469
- };
470
- }
471
- function replaceLink(blockId, block) {
472
- return (state, dispatch) => {
473
- const { ok, tr } = _chunkZKVOS57Qcjs.runCommands.call(void 0, state, [emptyParagraph(blockId), _chunkCW3AFJBRcjs.insertBlocks.call(void 0, [block], "line", blockId)]);
474
- if (!ok || tr === null) return false;
475
- _optionalChain([dispatch, 'optionalCall', _15 => _15(tr)]);
476
- return true;
477
- };
478
- }
479
-
480
- // src/extensions/embed/LinkChoicePopover.tsx
481
-
482
-
483
- // src/extensions/embed/link-blocks.ts
484
- function embedOf(href, providers) {
485
- const match = matchEmbed(href, providers);
486
- return match === null ? null : { type: "EMBED", attrs: { url: href, provider: match.provider } };
487
- }
488
- var bookmarkOf = (href) => ({ type: "BOOKMARK", attrs: { url: href } });
489
- function typedLink(kind, typed, providers) {
490
- const href = _chunkXA3UEJIWcjs.webAddress.call(void 0, _chunkCW3AFJBRcjs.linkAddress.call(void 0, typed));
491
- if (href === null) return { href, block: null, problem: "notALink" };
492
- const block = kind === "embed" ? embedOf(href, providers) : bookmarkOf(href);
493
- return { href, block, problem: block === null ? "cannotEmbed" : null };
494
- }
495
-
496
- // src/extensions/embed/LinkChoicePopover.tsx
497
-
498
- var plainKey = (event) => !event.altKey && !event.ctrlKey && !event.metaKey;
499
- function linkEnd({ doc, schema }, blockId) {
500
- const block = _chunk4SLJNZSMcjs.blockById.call(void 0, doc, blockId);
501
- const region = block && _chunkZKVOS57Qcjs.primaryRegion.call(void 0, schema, block);
502
- const end = block && region ? _chunkZKVOS57Qcjs.regionLength.call(void 0, block, region) : 0;
503
- return block && region ? { block: blockId, region, from: end, to: end } : null;
504
- }
505
- function LinkChoicePopover({ controller, feature }) {
506
- const readOnly = _chunkP6KYXFZCcjs.useReadOnly.call(void 0, controller);
507
- const choice = _chunkP6KYXFZCcjs.useEditorState.call(void 0, controller, linkChoice);
508
- const [dismissed, setDismissed] = _react.useState.call(void 0, null);
509
- const dismiss = _react.useCallback.call(void 0, () => setDismissed(choice), [choice]);
510
- if (readOnly || choice === null || choice === dismissed) return null;
511
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkChoiceToolbar, { controller, feature, choice, onDismiss: dismiss });
512
- }
513
- function useEscapeInText(controller, onEscape) {
514
- _react.useEffect.call(void 0, () => {
515
- const intercept = (event) => {
516
- if (event.key !== "Escape" || !plainKey(event) || event.shiftKey) return false;
517
- event.preventDefault();
518
- onEscape();
519
- return true;
520
- };
521
- return _chunkCW3AFJBRcjs.interceptKeys.call(void 0, controller, intercept);
522
- }, [controller, onEscape]);
523
- }
524
- function LinkChoiceToolbar({ controller, feature: { labels, providers }, choice, onDismiss }) {
525
- const embed = _react.useMemo.call(void 0, () => embedOf(choice.href, providers), [choice.href, providers]);
526
- const range = _react.useMemo.call(void 0, () => linkEnd(controller.editor.state, choice.block), [controller, choice.block]);
527
- const { anchor } = _chunkCW3AFJBRcjs.useRangeAnchor.call(void 0, controller, range);
528
- const after = _react.useMemo.call(void 0, () => {
529
- const host = range && controller.registry.get(range.block, range.region);
530
- return host && _chunkCW3AFJBRcjs.inlineDirection.call(void 0, host) === "rtl" ? "left" : "right";
531
- }, [controller, range]);
532
- const roving = _chunkCW3AFJBRcjs.useRovingFocus.call(void 0, );
533
- const rovingRef = roving.ref;
534
- const content = _react.useRef.call(void 0, null);
535
- const ref = _react.useCallback.call(void 0,
536
- (element) => {
537
- content.current = element;
538
- rovingRef(element);
539
- },
540
- [rovingRef]
541
- );
542
- const ownerDocument = _react.useCallback.call(void 0, () => _nullishCoalesce(_optionalChain([controller, 'access', _16 => _16.root, 'optionalAccess', _17 => _17.ownerDocument]), () => ( document)), [controller]);
543
- _chunkCW3AFJBRcjs.useFocusKey.call(void 0, controller, roving.focusCurrent);
544
- useEscapeInText(controller, onDismiss);
545
- _chunkCW3AFJBRcjs.useOutsidePress.call(void 0, content, ownerDocument, onDismiss);
546
- const choose = (block) => {
547
- if (block === null) onDismiss();
548
- else controller.run(replaceLink(choice.block, block));
549
- controller.focus();
550
- };
551
- const onKeyDown = (event) => {
552
- if (!roving.owns(event.target) || _chunkP6KYXFZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
553
- if (event.key === "Escape") onDismiss();
554
- if (event.key === "Escape" || event.key === "Tab" && plainKey(event)) {
555
- event.preventDefault();
556
- controller.focus();
557
- } else roving.onKeyDown(event);
558
- };
559
- const button = (label, block) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCW3AFJBRcjs.Button, { type: "button", variant: "ghost", size: "sm", onClick: () => choose(block), children: label });
560
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkCW3AFJBRcjs.Popover, { open: true, modal: false, children: [
561
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCW3AFJBRcjs.PopoverAnchor, { virtualRef: anchor }),
562
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
563
- _chunkCW3AFJBRcjs.PopoverContent,
564
- {
565
- ref,
566
- role: "toolbar",
567
- "aria-label": labels.linkOptions,
568
- side: after,
569
- align: "end",
570
- sideOffset: 8,
571
- className: _chunkCW3AFJBRcjs.FLOATING_TOOLBAR,
572
- onOpenAutoFocus: _chunkCW3AFJBRcjs.preventDefault,
573
- onCloseAutoFocus: _chunkCW3AFJBRcjs.preventDefault,
574
- onPointerDown: _chunkCW3AFJBRcjs.keepFocus,
575
- onMouseDown: _chunkCW3AFJBRcjs.keepFocus,
576
- onFocus: roving.onFocus,
577
- onKeyDown,
578
- ..._chunkCW3AFJBRcjs.bubblePart.call(void 0, controller),
579
- children: [
580
- embed !== null && button(labels.embed, embed),
581
- button(labels.bookmark, bookmarkOf(choice.href)),
582
- button(labels.keepAsLink, null)
583
- ]
584
- }
585
- )
586
- ] });
587
- }
588
-
589
- // src/extensions/embed/LinkInputOverlay.tsx
590
-
591
-
592
- // src/extensions/embed/store-after-press.ts
593
- function storeAfterPress(controller, request, block) {
594
- const { editor } = controller;
595
- if (controller.readOnly || controller.root === null) return;
596
- controller.readSelectionFromDom();
597
- const line = request.at.block;
598
- const onLine = _chunkZKVOS57Qcjs.headBlockId.call(void 0, editor.state.selection) === line;
599
- const place = onLine ? _chunkCW3AFJBRcjs.insertBlockToWrite.call(void 0, block, false, line) : _chunkCW3AFJBRcjs.insertBlocks.call(void 0, [block], "stay", line);
600
- place(editor.state, (tr) => editor.dispatch(tr));
601
- }
602
-
603
- // src/extensions/embed/LinkInputOverlay.tsx
604
-
605
- function LinkInputOverlay({ controller, feature }) {
606
- const readOnly = _chunkP6KYXFZCcjs.useReadOnly.call(void 0, controller);
607
- const request = useLinkRequest(controller);
608
- const close = _react.useCallback.call(void 0, () => requestLink(controller, null), [controller]);
609
- _react.useEffect.call(void 0, () => {
610
- if (readOnly) close();
611
- }, [readOnly, close]);
612
- if (readOnly || request === null) return null;
613
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkInputPopover, { controller, feature, request, onClose: close });
614
- }
615
- function LinkInputPopover({ controller, feature: { labels, providers }, request, onClose }) {
616
- const [address, setAddress] = _react.useState.call(void 0, "");
617
- const [problem, setProblem] = _react.useState.call(void 0, null);
618
- const messageId = _react.useId.call(void 0, );
619
- const content = _react.useRef.call(void 0, null);
620
- const { anchor, side } = _chunkCW3AFJBRcjs.useRangeAnchor.call(void 0, controller, request.at);
621
- const name = request.kind === "embed" ? labels.embedLink : labels.bookmarkLink;
622
- const typed = () => typedLink(request.kind, address, providers);
623
- const finish = (block) => {
624
- onClose();
625
- if (block !== null && !controller.readOnly) controller.run(_chunkCW3AFJBRcjs.insertBlockToWrite.call(void 0, block, false, request.at.block));
626
- controller.focus();
627
- };
628
- const submit = (event) => {
629
- event.preventDefault();
630
- const { block, problem: refused } = typed();
631
- if (block === null) setProblem(refused);
632
- else finish(block);
633
- };
634
- const bookmarkInstead = () => finish(typedLink("bookmark", address, providers).block);
635
- const ownerDocument = _react.useCallback.call(void 0, () => _nullishCoalesce(_optionalChain([controller, 'access', _18 => _18.root, 'optionalAccess', _19 => _19.ownerDocument]), () => ( document)), [controller]);
636
- _chunkCW3AFJBRcjs.useOutsidePress.call(void 0, content, ownerDocument, () => {
637
- onClose();
638
- const { block } = typed();
639
- if (block !== null) setTimeout(() => storeAfterPress(controller, request, block));
640
- });
641
- const onKeyDown = (event) => {
642
- if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
643
- if (_chunkP6KYXFZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
644
- const controls = [...event.currentTarget.querySelectorAll("input, button")];
645
- const next = controls.indexOf(event.target) + (event.shiftKey ? -1 : 1);
646
- event.preventDefault();
647
- if (next >= 0 && next < controls.length) controls[next].focus();
648
- else finish(typed().block);
649
- };
650
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkCW3AFJBRcjs.Popover, { open: true, modal: false, children: [
651
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCW3AFJBRcjs.PopoverAnchor, { virtualRef: anchor }),
652
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
653
- _chunkCW3AFJBRcjs.PopoverContent,
654
- {
655
- ref: content,
656
- "aria-label": name,
657
- side,
658
- align: "start",
659
- className: "w-80 p-2 shadow-md",
660
- onCloseAutoFocus: _chunkCW3AFJBRcjs.preventDefault,
661
- onEscapeKeyDown: (event) => {
662
- event.preventDefault();
663
- if (!_chunkP6KYXFZCcjs.isComposingKey.call(void 0, controller, event)) finish(null);
664
- },
665
- ..._chunkCW3AFJBRcjs.bubblePart.call(void 0, controller),
666
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { noValidate: true, className: "quoin-embed-ask", onSubmit: submit, onKeyDown, children: [
667
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
668
- _chunkCW3AFJBRcjs.Input,
669
- {
670
- type: "url",
671
- className: "h-8",
672
- "aria-label": name,
673
- "aria-invalid": problem !== null || void 0,
674
- "aria-describedby": problem === null ? void 0 : messageId,
675
- value: address,
676
- onChange: (event) => {
677
- setAddress(event.target.value);
678
- setProblem(null);
679
- }
680
- }
681
- ),
682
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCW3AFJBRcjs.Button, { type: "submit", size: "sm", children: request.kind === "embed" ? labels.embed : labels.bookmark }),
683
- problem !== null && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { id: messageId, role: "alert", className: "quoin-embed-ask-message", children: labels[problem] }),
684
- problem === "cannotEmbed" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCW3AFJBRcjs.Button, { type: "button", variant: "outline", size: "sm", onClick: bookmarkInstead, children: labels.bookmarkInstead })
685
- ] })
686
- }
687
- )
688
- ] });
689
- }
690
-
691
- // src/extensions/embed/embed-extension.tsx
692
-
693
- function embedExtension(options = {}) {
694
- const feature = {
695
- labels: resolveEmbedLabels(options.labels),
696
- providers: _nullishCoalesce(options.providers, () => ( [])),
697
- unfurl: options.unfurl
698
- };
699
- const EmbedRenderer = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmbedBlock, { ...props, feature });
700
- const BookmarkRenderer = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BookmarkBlock, { ...props, feature });
701
- const ChoiceOverlay = ({ controller }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkChoicePopover, { controller, feature });
702
- const InputOverlay = ({ controller }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LinkInputOverlay, { controller, feature });
703
- const ui = {
704
- slashItems: embedSlashItems(feature.labels),
705
- renderers: { EMBED: EmbedRenderer, BOOKMARK: BookmarkRenderer },
706
- blockNames: { EMBED: feature.labels.embed, BOOKMARK: feature.labels.bookmark },
707
- overlays: [ChoiceOverlay, InputOverlay]
708
- };
709
- return _chunkZKVOS57Qcjs.defineExtension.call(void 0, { name: "embed", plugins: [linkChoicePlugin], pasteRules: [pasteLinkChoice], ui });
710
- }
711
-
712
-
713
-
714
-
715
- exports.englishEmbedLabels = englishEmbedLabels; exports.embedExtension = embedExtension;
716
- //# sourceMappingURL=chunk-UEKXVCKC.cjs.map