@clevertask/scribe 0.1.7 → 0.1.8

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 (44) hide show
  1. package/README.md +5 -4
  2. package/dist/{BarMenu-DC-S5Ggq.js → BarMenu-BG_w4DVo.js} +53 -25
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  5. package/dist/components/Menu/BarMenu.js +1 -1
  6. package/dist/components/Menu/BubbleMenu.js +2 -2
  7. package/dist/components/Menu/LinkBubbleMenu.js +13 -13
  8. package/dist/components/Menu/LinkEditor.js +4 -4
  9. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  10. package/dist/components/Menu/Mobile/ListOptionBar.js +11 -5
  11. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  12. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/emoji/EmojiList.js +6 -2
  14. package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
  15. package/dist/components/Scribe/extension/extension-link.js +1 -1
  16. package/dist/components/Scribe/extension/extension-markdown-paste.js +14 -6
  17. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  18. package/dist/components/Scribe/extension/index.js +1 -1
  19. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
  20. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +948 -943
  21. package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
  22. package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
  23. package/dist/components/Scribe/extension/tableOfContents.js +2 -2
  24. package/dist/components/Scribe/index.d.ts +2 -0
  25. package/dist/components/Scribe/index.d.ts.map +1 -1
  26. package/dist/components/Scribe/index.js +182 -80
  27. package/dist/{dist-BQjH-i-q.js → dist-BMKyBtRa.js} +112 -105
  28. package/dist/{dist-DT3iiwSr.js → dist-BgEySLwo.js} +9 -8
  29. package/dist/{dist-CnXCIcnl.js → dist-FrapLVQu.js} +16 -9
  30. package/dist/{extension-CZOsheCI.js → extension-BVGWENts.js} +1306 -1300
  31. package/dist/{extension-link-DZID_SYl.js → extension-link-CMRfHUc5.js} +5 -5
  32. package/dist/{floating-ui.dom-rih69525.js → floating-ui.dom-CmJ6iBdh.js} +4 -5
  33. package/dist/{html-to-markdown-CrNOkSye.js → html-to-markdown-Cta7-ssO.js} +3 -2
  34. package/dist/main.js +2 -2
  35. package/dist/{markdown-to-html-DEczPfuq.js → markdown-to-html-DwSNqq2i.js} +8 -6
  36. package/dist/{menus-CrKTaPWU.js → menus-D9OsP28c.js} +8 -8
  37. package/dist/{purify.es-DF9CW1cl.js → purify.es-CFiLaBu1.js} +1 -1
  38. package/dist/{slashCommand-B7CRIaKG.js → slashCommand-B6Iz1i0d.js} +5 -8
  39. package/dist/{tables-CjOC70rm.js → tables-CXpUVKdw.js} +9 -7
  40. package/dist/{tippy.esm-D9LL2xiE.js → tippy.esm-DOXqN1Qm.js} +2 -7
  41. package/dist/utils/html-to-markdown.js +1 -1
  42. package/dist/utils/index.js +4 -4
  43. package/dist/utils/markdown-to-html.js +1 -1
  44. package/package.json +49 -34
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "../../../../slashCommand-B7CRIaKG.js";
1
+ import { n as e, t } from "../../../../slashCommand-B6Iz1i0d.js";
2
2
  export { t as SlashCommand, e as slashMenuPluginKey };
@@ -1,6 +1,6 @@
1
- import { n as e } from "../../../../dist-DT3iiwSr.js";
1
+ import { n as e } from "../../../../dist-BgEySLwo.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
- import { t as n } from "../../../../tippy.esm-D9LL2xiE.js";
3
+ import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
4
4
  import { SlashCommandList as r } from "./SlashCommandList.js";
5
5
  //#region lib/components/Scribe/extension/slashCommand/renderItems.ts
6
6
  var i = () => {
@@ -1,5 +1,5 @@
1
- import { a as e, i as t } from "../../../dist-CnXCIcnl.js";
2
- import { n } from "../../../dist-BQjH-i-q.js";
1
+ import { a as e, i as t } from "../../../dist-FrapLVQu.js";
2
+ import { n } from "../../../dist-BMKyBtRa.js";
3
3
  //#region lib/components/Scribe/extension/tableOfContents.ts
4
4
  var r = "scribeTableOfContents", i = new e("scribeTableOfContents"), a = 10, o = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "heading", s = (e, t) => {
5
5
  let n = t[t.length - 1], r = [...t].reverse().find((t) => t.originalLevel <= e.node.attrs.level)?.level || 1;
@@ -28,6 +28,8 @@ export interface ScribeProps {
28
28
  * `ScribeRef.setContent` for programmatic updates after mount.
29
29
  */
30
30
  content?: string;
31
+ /** Accessible name for the rich-text editing surface. */
32
+ ariaLabel?: string;
31
33
  editable?: boolean;
32
34
  autoFocus?: boolean;
33
35
  extensions?: Extension[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Scribe/index.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAC;AAGxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EACV,kCAAkC,EAElC,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,EACP,MAAM,EAGN,SAAS,EACT,WAAW,EACX,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,oBAAoB,EAMrB,MAAM,OAAO,CAAC;AAGf,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EACV,kC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";
1
+ import { n as e, t } from "../../BarMenu-BG_w4DVo.js";
2
+ import { i as n, t as r } from "../../dist-BgEySLwo.js";
3
3
  import i from "../Menu/LinkBubbleMenu.js";
4
- import { t as a } from "../../html-to-markdown-CrNOkSye.js";
5
- import { t as o } from "../../extension-CZOsheCI.js";
4
+ import { t as a } from "../../html-to-markdown-Cta7-ssO.js";
5
+ import { t as o } from "../../extension-BVGWENts.js";
6
6
  import { SuggestionItemType as s } from "./extension/slashCommand/items.js";
7
7
  import "./extension/tableOfContents.js";
8
8
  import "../../utils/index.js";
@@ -10,7 +10,24 @@ import { ListOptionBar as c } from "../Menu/Mobile/ListOptionBar.js";
10
10
  import { forwardRef as l, useCallback as u, useEffect as d, useImperativeHandle as f, useRef as p, useState as m } from "react";
11
11
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
12
12
  import '../../assets/index.css';//#region lib/components/Scribe/index.tsx
13
- var _ = (e) => {
13
+ var _ = "Rich text editor", v = [
14
+ "role",
15
+ "aria-label",
16
+ "aria-multiline",
17
+ "aria-readonly"
18
+ ], y = (t, n, r) => {
19
+ let i = t.role ?? "textbox";
20
+ return {
21
+ ...t,
22
+ role: i,
23
+ class: e("scribe", t.class),
24
+ "aria-label": n ?? t["aria-label"] ?? _,
25
+ ...i === "textbox" ? {
26
+ "aria-multiline": "true",
27
+ "aria-readonly": String(!r)
28
+ } : {}
29
+ };
30
+ }, b = (e) => {
14
31
  let t = p([]), n = p(e);
15
32
  return d(() => {
16
33
  n.current = e;
@@ -20,80 +37,154 @@ var _ = (e) => {
20
37
  }, []),
21
38
  tableOfContentsItemsRef: t
22
39
  };
23
- }, v = l((n, o) => {
24
- let { autoFocus: s = !1, content: l, editable: m = !0, editor: _, initialContentWasApplied: v, onContentChange: y, showBarMenu: b = !0, editorContentStyle: x, editorContentClassName: S, mainContainerStyle: C, mainContainerClassName: w, onKeyDown: T, mobile: E, tableOfContentsItemsRef: D } = n, O = p(v && l !== void 0), k = u(({ editor: e, transaction: t }) => {
40
+ }, x = l((n, o) => {
41
+ let { ariaLabel: s, autoFocus: l = !1, content: m, editable: _ = !0, editor: b, editorProps: x, externalEditor: S, initialContentWasApplied: C, onContentChange: w, showBarMenu: T = !0, editorContentStyle: E, editorContentClassName: D, mainContainerStyle: O, mainContainerClassName: k, onKeyDown: A, mobile: j, tableOfContentsItemsRef: M } = n, N = p({
42
+ ariaLabel: s,
43
+ editable: _
44
+ }), P = p(null);
45
+ N.current = {
46
+ ariaLabel: s,
47
+ editable: _
48
+ };
49
+ let F = p(C && m !== void 0), I = u(({ editor: e, transaction: t }) => {
25
50
  if (t.getMeta("scribeTableOfContents")) return;
26
- let n = e.getHTML(), r = e.getJSON(), i = !m;
27
- y && y({
51
+ let n = e.getHTML(), r = e.getJSON(), i = !_;
52
+ w && w({
28
53
  jsonContent: e.isEmpty ? "" : r,
29
54
  htmlContent: e.isEmpty ? "" : n,
30
55
  markdownContent: e.isEmpty ? "" : a(n),
31
56
  source: i ? "programmatic" : "user"
32
57
  });
33
- }, [m, y]), A = u(() => {
34
- _.commands.setContent("");
35
- }, [_]), j = u((e) => _.isEmpty ? "" : {
36
- html: () => _.getHTML(),
37
- json: () => _.getJSON(),
38
- markdown: () => a(_.getHTML())
39
- }[e]?.(), [_]), M = u((e) => {
40
- _.commands.setContent(e);
41
- }, [_]), N = u((e) => {
42
- let t = typeof e == "string" ? e : e.id, n = D.current.find((e) => e.id === t) ?? (typeof e == "string" ? void 0 : e);
43
- if (!n || _.isDestroyed) return;
44
- let r = _.view.nodeDOM(n.pos), i = r instanceof HTMLElement ? r : n.dom;
45
- if (_.isEditable) {
46
- let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1, _.state.doc.content.size));
47
- _.commands.focus(e, { scrollIntoView: !1 });
58
+ }, [_, w]), L = u(() => {
59
+ b.commands.setContent("");
60
+ }, [b]), R = u((e) => b.isEmpty ? "" : {
61
+ html: () => b.getHTML(),
62
+ json: () => b.getJSON(),
63
+ markdown: () => a(b.getHTML())
64
+ }[e]?.(), [b]), z = u((e) => {
65
+ b.commands.setContent(e);
66
+ }, [b]), B = u((e) => {
67
+ let t = typeof e == "string" ? e : e.id, n = M.current.find((e) => e.id === t) ?? (typeof e == "string" ? void 0 : e);
68
+ if (!n || b.isDestroyed) return;
69
+ let r = b.view.nodeDOM(n.pos), i = r instanceof HTMLElement ? r : n.dom;
70
+ if (b.isEditable) {
71
+ let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1, b.state.doc.content.size));
72
+ b.commands.focus(e, { scrollIntoView: !1 });
48
73
  }
49
74
  i.scrollIntoView({
50
75
  behavior: "smooth",
51
76
  block: "start"
52
77
  });
53
- }, [_, D]);
78
+ }, [b, M]);
54
79
  return f(o, () => ({
55
- resetContent: A,
56
- setContent: M,
57
- getContent: j,
58
- scrollToTableOfContentsItem: N,
59
- editor: _
80
+ resetContent: L,
81
+ setContent: z,
82
+ getContent: R,
83
+ scrollToTableOfContentsItem: B,
84
+ editor: b
60
85
  }), [
61
- _,
62
- j,
63
- A,
64
- N,
65
- M
86
+ b,
87
+ R,
88
+ L,
89
+ B,
90
+ z
66
91
  ]), d(() => {
67
- if (l !== void 0) {
68
- if (O.current) {
69
- O.current = !1;
92
+ if (m !== void 0) {
93
+ if (F.current) {
94
+ F.current = !1;
70
95
  return;
71
96
  }
72
- _.commands.setContent(l, { emitUpdate: !1 });
97
+ b.commands.setContent(m, { emitUpdate: !1 });
73
98
  }
74
- }, [l, _]), d(() => {
75
- _.setEditable(!!m);
76
- }, [m, _]), d(() => (_.off("update"), _.on("update", k), () => {
77
- _.off("update", k);
78
- }), [_, k]), d(() => {
79
- s && _.commands.focus("end");
80
- }, [s, _]), /* @__PURE__ */ g("div", {
81
- className: e("scribe-wrapper", "scribe-root", w),
99
+ }, [m, b]), d(() => {
100
+ if (!S) {
101
+ P.current = null;
102
+ return;
103
+ }
104
+ let e = b.view.dom, t = Object.fromEntries(v.map((t) => [t, e.getAttribute(t)])), n = b.options.editable, r = b.options.editorProps ?? {}, i = r.attributes, a = /* @__PURE__ */ new Set(), o = (e, t) => {
105
+ let n = typeof i == "function" ? i.call(t, e) : i;
106
+ return Object.keys(n ?? {}).forEach((e) => a.add(e)), n ?? {};
107
+ }, s = (e, n) => {
108
+ let r = o(e, n), i = {};
109
+ return v.forEach((e) => {
110
+ let n = t[e];
111
+ !a.has(e) && n !== null && (i[e] = n);
112
+ }), {
113
+ ...i,
114
+ ...r
115
+ };
116
+ }, c = s(b.state, r);
117
+ P.current = {
118
+ editor: b,
119
+ attributes: c
120
+ };
121
+ let l = function(e) {
122
+ let t = s(e, this);
123
+ P.current?.editor === b && (P.current.attributes = t);
124
+ let n = N.current;
125
+ return y(t, n.ariaLabel, n.editable);
126
+ };
127
+ return b.setOptions({ editorProps: {
128
+ ...r,
129
+ attributes: l
130
+ } }), () => {
131
+ if (!b.isDestroyed) {
132
+ let s = b.options.editorProps ?? {}, c = s.attributes === l;
133
+ if (c) {
134
+ let e = { ...s };
135
+ i === void 0 ? delete e.attributes : e.attributes = i, b.setOptions({ editorProps: e });
136
+ }
137
+ b.setEditable(!!n, !1);
138
+ let u = c ? o(b.state, r) : null;
139
+ u && v.forEach((n) => {
140
+ let r = n in u ? u[n] : a.has(n) ? null : t[n];
141
+ if (r == null) {
142
+ e.removeAttribute(n);
143
+ return;
144
+ }
145
+ e.setAttribute(n, r);
146
+ });
147
+ }
148
+ P.current?.editor === b && (P.current = null);
149
+ };
150
+ }, [b, S]), d(() => {
151
+ b.setEditable(!!_);
152
+ let e = b.view.dom, t = y((S ? P.current?.attributes : typeof x?.editorProps?.attributes == "function" ? x.editorProps.attributes.call(x.editorProps, b.state) : x?.editorProps?.attributes) ?? {}, s, _);
153
+ v.forEach((n) => {
154
+ let r = t[n];
155
+ if (r === void 0) {
156
+ e.removeAttribute(n);
157
+ return;
158
+ }
159
+ e.setAttribute(n, r);
160
+ });
161
+ }, [
162
+ s,
163
+ _,
164
+ b,
165
+ x,
166
+ S
167
+ ]), d(() => (b.off("update"), b.on("update", I), () => {
168
+ b.off("update", I);
169
+ }), [b, I]), d(() => {
170
+ l && b.commands.focus("end");
171
+ }, [l, b]), /* @__PURE__ */ g("div", {
172
+ className: e("scribe-wrapper", "scribe-root", k),
82
173
  "data-scribe-root": !0,
83
- style: C,
174
+ style: O,
84
175
  children: [/* @__PURE__ */ g("div", {
85
- className: e("scribe-frame", m && "scribe-frame--editable"),
176
+ className: e("scribe-frame", _ && "scribe-frame--editable"),
86
177
  children: [
87
- _ && b ? /* @__PURE__ */ h(t, { editor: _ }) : null,
178
+ b && T ? /* @__PURE__ */ h(t, { editor: b }) : null,
88
179
  /* @__PURE__ */ g("div", {
89
- className: e("scribe-content", m && "scribe-content--editable", S),
90
- style: x,
180
+ className: e("scribe-content", _ && "scribe-content--editable", D),
181
+ style: E,
91
182
  children: [/* @__PURE__ */ h(r, {
92
- editor: _,
93
- onKeyDown: T
94
- }), m ? /* @__PURE__ */ h(i, { editor: _ }) : null]
183
+ editor: b,
184
+ onKeyDown: A
185
+ }), _ ? /* @__PURE__ */ h(i, { editor: b }) : null]
95
186
  }),
96
- E ? /* @__PURE__ */ h(c, { editor: _ }) : null
187
+ j ? /* @__PURE__ */ h(c, { editor: b }) : null
97
188
  ]
98
189
  }), /* @__PURE__ */ h("div", {
99
190
  className: "scribe-popup-root",
@@ -101,34 +192,45 @@ var _ = (e) => {
101
192
  })]
102
193
  });
103
194
  });
104
- v.displayName = "ScribeEditor";
105
- var y = l((e, t) => {
106
- let { content: r, editable: i = !0, editorProps: a, extensions: s, onTableOfContentsChange: c } = e, { handleTableOfContentsChange: l, tableOfContentsItemsRef: u } = _(c), [d] = m(() => ({
107
- ...a,
108
- content: r ?? a?.content,
109
- editable: i,
195
+ x.displayName = "ScribeEditor";
196
+ var S = l((e, t) => {
197
+ let { ariaLabel: r, content: i, editable: a = !0, editorProps: s, extensions: c, onTableOfContentsChange: l } = e, { handleTableOfContentsChange: u, tableOfContentsItemsRef: d } = b(l), f = s?.editorProps?.attributes, g = p({
198
+ ariaLabel: r,
199
+ editable: a
200
+ });
201
+ g.current = {
202
+ ariaLabel: r,
203
+ editable: a
204
+ };
205
+ let _ = typeof f == "function" ? function(e) {
206
+ let t = g.current;
207
+ return y(f.call(this, e), t.ariaLabel, t.editable);
208
+ } : y(f ?? {}, r, a), [v] = m(() => ({
209
+ ...s,
210
+ content: i ?? s?.content,
211
+ editable: a,
110
212
  extensions: [...o({
111
213
  ...e,
112
- onTableOfContentsChange: l
113
- }), ...s ?? []],
214
+ onTableOfContentsChange: u
215
+ }), ...c ?? []],
114
216
  editorProps: {
115
- attributes: { class: "scribe" },
116
- ...a?.editorProps
217
+ ...s?.editorProps,
218
+ attributes: _
117
219
  },
118
- shouldRerenderOnTransaction: a?.shouldRerenderOnTransaction ?? !1
119
- })), f = n(d);
120
- return f ? /* @__PURE__ */ h(v, {
220
+ shouldRerenderOnTransaction: s?.shouldRerenderOnTransaction ?? !1
221
+ })), S = n(v);
222
+ return S ? /* @__PURE__ */ h(x, {
121
223
  ...e,
122
224
  ref: t,
123
- editor: f,
225
+ editor: S,
124
226
  initialContentWasApplied: !0,
125
- tableOfContentsItemsRef: u
227
+ tableOfContentsItemsRef: d
126
228
  }) : null;
127
229
  });
128
- y.displayName = "OwnedScribe";
129
- var b = l((e, t) => {
130
- let { externalEditor: n, onTableOfContentsChange: r } = e, { tableOfContentsItemsRef: i } = _(r);
131
- return n ? /* @__PURE__ */ h(v, {
230
+ S.displayName = "OwnedScribe";
231
+ var C = l((e, t) => {
232
+ let { externalEditor: n, onTableOfContentsChange: r } = e, { tableOfContentsItemsRef: i } = b(r);
233
+ return n ? /* @__PURE__ */ h(x, {
132
234
  ...e,
133
235
  ref: t,
134
236
  editor: n,
@@ -136,14 +238,14 @@ var b = l((e, t) => {
136
238
  tableOfContentsItemsRef: i
137
239
  }) : null;
138
240
  });
139
- b.displayName = "ExternalScribe";
140
- var x = l((e, t) => e.externalEditor ? /* @__PURE__ */ h(b, {
241
+ C.displayName = "ExternalScribe";
242
+ var w = l((e, t) => e.externalEditor ? /* @__PURE__ */ h(C, {
141
243
  ...e,
142
244
  ref: t
143
- }) : /* @__PURE__ */ h(y, {
245
+ }) : /* @__PURE__ */ h(S, {
144
246
  ...e,
145
247
  ref: t
146
248
  }));
147
- x.displayName = "Scribe";
249
+ w.displayName = "Scribe";
148
250
  //#endregion
149
- export { x as Scribe, s as SuggestionItemType };
251
+ export { w as Scribe, s as SuggestionItemType };