@clevertask/scribe 0.0.13 → 0.0.15

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 (70) hide show
  1. package/README.md +5 -10
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.d.ts +3 -2
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -0
  5. package/dist/components/Menu/BarMenu.js +39 -18
  6. package/dist/components/Menu/BubbleMenu.d.ts +3 -2
  7. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -0
  8. package/dist/components/Menu/BubbleMenu.js +1 -1
  9. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +2 -1
  10. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -0
  11. package/dist/components/Menu/Mobile/ListOptionBar.js +3 -15
  12. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +2 -1
  13. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -0
  14. package/dist/components/Scribe/extension/emoji/EmojiList.js +25 -14
  15. package/dist/components/Scribe/extension/emoji/suggest.d.ts +1 -0
  16. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -0
  17. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  18. package/dist/components/Scribe/extension/extension-link.d.ts +2 -1
  19. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -0
  20. package/dist/components/Scribe/extension/extension-link.js +2 -4
  21. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts +4 -0
  22. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -0
  23. package/dist/components/Scribe/extension/extension-markdown-paste.js +46 -0
  24. package/dist/components/Scribe/extension/extension-selectedText.d.ts +2 -1
  25. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -0
  26. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  27. package/dist/components/Scribe/extension/index.d.ts +3 -2
  28. package/dist/components/Scribe/extension/index.d.ts.map +1 -0
  29. package/dist/components/Scribe/extension/index.js +25 -23
  30. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +3 -2
  31. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -0
  32. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +6 -5
  33. package/dist/components/Scribe/extension/slashCommand/index.d.ts +3 -2
  34. package/dist/components/Scribe/extension/slashCommand/index.d.ts.map +1 -0
  35. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  36. package/dist/components/Scribe/extension/slashCommand/items.d.ts +3 -2
  37. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -0
  38. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +2 -1
  39. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -0
  40. package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
  41. package/dist/components/Scribe/index.d.ts +6 -4
  42. package/dist/components/Scribe/index.d.ts.map +1 -0
  43. package/dist/components/Scribe/index.js +34 -44
  44. package/dist/{index-flsxByQS.js → index-BKFDqQPh.js} +9 -3
  45. package/dist/{index-BfaHEr44.js → index-CL2WLiGu.js} +1 -1
  46. package/dist/{index-CWvaDN_2.js → index-Cxf4VEm1.js} +5252 -5318
  47. package/dist/{index-Bvgjhwaj.js → index-PzbCrHp0.js} +1 -1
  48. package/dist/main.css +3 -0
  49. package/dist/main.d.ts +4 -3
  50. package/dist/main.d.ts.map +1 -0
  51. package/dist/main.js +1 -1
  52. package/dist/{marked.esm-H7n4rMcO.js → markdown-to-html-__93dwok.js} +50 -47
  53. package/dist/{purify.es-DcWaZU6I.js → purify.es-BPDBzHtc.js} +114 -114
  54. package/dist/utils/convert-legacy-math-delimiters.d.ts +1 -0
  55. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -0
  56. package/dist/utils/create-scribe-editor.d.ts +3 -2
  57. package/dist/utils/create-scribe-editor.d.ts.map +1 -0
  58. package/dist/utils/create-scribe-editor.js +8 -4
  59. package/dist/utils/html-to-markdown.d.ts +1 -0
  60. package/dist/utils/html-to-markdown.d.ts.map +1 -0
  61. package/dist/utils/html-to-markdown.js +1 -1
  62. package/dist/utils/index.d.ts +6 -5
  63. package/dist/utils/index.d.ts.map +1 -0
  64. package/dist/utils/index.js +3 -3
  65. package/dist/utils/is-in-viewport.d.ts +1 -0
  66. package/dist/utils/is-in-viewport.d.ts.map +1 -0
  67. package/dist/utils/markdown-to-html.d.ts +1 -0
  68. package/dist/utils/markdown-to-html.d.ts.map +1 -0
  69. package/dist/utils/markdown-to-html.js +3 -4
  70. package/package.json +53 -56
@@ -2,11 +2,11 @@ import { jsx as n, jsxs as P } from "react/jsx-runtime";
2
2
  import O from "../Menu/BarMenu.js";
3
3
  import { c as l } from "../../clsx-OuTLNxxd.js";
4
4
  import { html2md as b } from "../../utils/html-to-markdown.js";
5
- import "../../marked.esm-H7n4rMcO.js";
6
- import "../../purify.es-DcWaZU6I.js";
7
- import { E as R } from "../../index-flsxByQS.js";
5
+ import "../../markdown-to-html-__93dwok.js";
6
+ import "../../purify.es-BPDBzHtc.js";
7
+ import { E as R } from "../../index-BKFDqQPh.js";
8
8
  import { initExtensions as T } from "./extension/index.js";
9
- import { E as z } from "../../index-Bvgjhwaj.js";
9
+ import { E as z } from "../../index-PzbCrHp0.js";
10
10
  import { forwardRef as J, useRef as D, useCallback as s, useImperativeHandle as F, useEffect as i } from "react";
11
11
  import { ListOptionBar as I } from "../Menu/Mobile/ListOptionBar.js";
12
12
  import '../../assets/index.css';const _ = J((p, g) => {
@@ -51,17 +51,14 @@ import '../../assets/index.css';const _ = J((p, g) => {
51
51
  }));
52
52
  const t = c.current, E = s(() => {
53
53
  t?.commands.setContent("");
54
- }, []), S = s(
55
- (e) => {
56
- const r = {
57
- html: () => t?.getHTML(),
58
- json: () => t?.getJSON(),
59
- markdown: () => b(t?.getHTML() || "")
60
- };
61
- return t?.isEmpty ? "" : r[e]?.();
62
- },
63
- []
64
- ), B = s((e) => {
54
+ }, []), S = s((e) => {
55
+ const r = {
56
+ html: () => t?.getHTML(),
57
+ json: () => t?.getJSON(),
58
+ markdown: () => b(t?.getHTML() || "")
59
+ };
60
+ return t?.isEmpty ? "" : r[e]?.();
61
+ }, []), B = s((e) => {
65
62
  t?.commands.setContent(e);
66
63
  }, []);
67
64
  return F(g, () => ({
@@ -77,39 +74,32 @@ import '../../assets/index.css';const _ = J((p, g) => {
77
74
  t.off("update", d);
78
75
  }), [d]), i(() => {
79
76
  u && t?.commands.focus("end");
80
- }, [u]), /* @__PURE__ */ n(
77
+ }, [u]), /* @__PURE__ */ n("div", { className: l("scribe-wrapper", N), style: M, children: /* @__PURE__ */ P(
81
78
  "div",
82
79
  {
83
- className: l("scribe-wrapper", N),
84
- style: M,
85
- children: /* @__PURE__ */ P(
86
- "div",
87
- {
88
- className: l(
89
- o && "rounded-lg border",
90
- a ? "border-zinc-700" : "border-zinc-200"
91
- ),
92
- children: [
93
- t && h && /* @__PURE__ */ n(O, { editor: t, darkMode: !!a }),
94
- /* @__PURE__ */ n(
95
- "div",
96
- {
97
- className: l(
98
- "prose max-w-none",
99
- o && "w-full p-[16px]",
100
- a && "prose-invert",
101
- y
102
- ),
103
- style: w,
104
- children: /* @__PURE__ */ n(z, { editor: t, onKeyDown: j })
105
- }
80
+ className: l(
81
+ o && "rounded-lg border",
82
+ a ? "border-zinc-700" : "border-zinc-200"
83
+ ),
84
+ children: [
85
+ t && h && /* @__PURE__ */ n(O, { editor: t, darkMode: !!a }),
86
+ /* @__PURE__ */ n(
87
+ "div",
88
+ {
89
+ className: l(
90
+ "prose max-w-none",
91
+ o && "w-full p-[16px]",
92
+ a && "prose-invert",
93
+ y
106
94
  ),
107
- v && /* @__PURE__ */ n(I, { editor: t })
108
- ]
109
- }
110
- )
95
+ style: w,
96
+ children: /* @__PURE__ */ n(z, { editor: t, onKeyDown: j })
97
+ }
98
+ ),
99
+ v && /* @__PURE__ */ n(I, { editor: t })
100
+ ]
111
101
  }
112
- );
102
+ ) });
113
103
  });
114
104
  export {
115
105
  _ as Scribe
@@ -8242,7 +8242,13 @@ class Ma {
8242
8242
  for (let f of a)
8243
8243
  if (f.nodeName == "BR" && f.parentNode) {
8244
8244
  let d = f.nextSibling;
8245
- d && d.nodeType == 1 && d.contentEditable == "false" && f.parentNode.removeChild(f);
8245
+ for (; d && d.nodeType == 1; ) {
8246
+ if (d.contentEditable == "false") {
8247
+ f.parentNode.removeChild(f);
8248
+ break;
8249
+ }
8250
+ d = d.firstChild;
8251
+ }
8246
8252
  }
8247
8253
  } else if (Q && a.length) {
8248
8254
  let f = a.filter((d) => d.nodeName == "BR");
@@ -8662,11 +8668,11 @@ class Ps {
8662
8668
  }
8663
8669
  updateDraggedNode(e, t) {
8664
8670
  let n = e.node, i = -1;
8665
- if (this.state.doc.nodeAt(n.from) == n.node)
8671
+ if (n.from < this.state.doc.content.size && this.state.doc.nodeAt(n.from) == n.node)
8666
8672
  i = n.from;
8667
8673
  else {
8668
8674
  let s = n.from + (this.state.doc.content.size - t.doc.content.size);
8669
- (s > 0 && this.state.doc.nodeAt(s)) == n.node && (i = s);
8675
+ (s > 0 && s < this.state.doc.content.size && this.state.doc.nodeAt(s)) == n.node && (i = s);
8670
8676
  }
8671
8677
  this.dragging = new Es(e.slice, e.move, i < 0 ? void 0 : S.create(this.state.doc, i));
8672
8678
  }
@@ -1,4 +1,4 @@
1
- import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-flsxByQS.js";
1
+ import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-BKFDqQPh.js";
2
2
  function Q(y) {
3
3
  var i;
4
4
  const { char: f, allowSpaces: D, allowToIncludeChar: I, allowedPrefixes: v, startOfLine: K, $position: g } = y, P = D && !I, m = H(f), B = new RegExp(`\\s${m}$`), C = K ? "^" : "", M = I ? "" : m, S = P ? new RegExp(`${C}${m}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${C}(?:^)?${m}[^\\s${M}]*`, "gm"), p = ((i = g.nodeBefore) === null || i === void 0 ? void 0 : i.isText) && g.nodeBefore.text;