@clevertask/scribe 0.1.10 → 0.1.11

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 (49) hide show
  1. package/README.md +11 -1
  2. package/dist/{BarMenu-5S2vKAtc.js → BarMenu-5M9g9Y1j.js} +7 -5
  3. package/dist/components/Menu/BarMenu.js +1 -1
  4. package/dist/components/Menu/BubbleMenu.js +2 -2
  5. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  6. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  7. package/dist/components/Menu/TableBubbleMenu.d.ts +8 -0
  8. package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -0
  9. package/dist/components/Menu/TableBubbleMenu.js +305 -0
  10. package/dist/components/Menu/tableBubbleMenuPlugin.d.ts +11 -0
  11. package/dist/components/Menu/tableBubbleMenuPlugin.d.ts.map +1 -0
  12. package/dist/components/Menu/tableBubbleMenuPlugin.js +22 -0
  13. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  14. package/dist/components/Scribe/extension/extension-link.js +1 -1
  15. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  16. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  17. package/dist/components/Scribe/extension/index.d.ts +1 -1
  18. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  19. package/dist/components/Scribe/extension/index.js +1 -1
  20. package/dist/components/Scribe/extension/resizable-table.d.ts +8 -0
  21. package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -0
  22. package/dist/components/Scribe/extension/resizable-table.js +2 -0
  23. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1390 -1390
  24. package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
  25. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  26. package/dist/components/Scribe/extension/slashCommand/items.js +27 -0
  27. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  28. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  29. package/dist/components/Scribe/index.d.ts +2 -1
  30. package/dist/components/Scribe/index.d.ts.map +1 -1
  31. package/dist/components/Scribe/index.js +133 -128
  32. package/dist/{dist-DErUltkU.js → dist-DFua_Xbu.js} +37 -31
  33. package/dist/{dist-wYqYXEOz.js → dist-Dw4STOPE.js} +1 -1
  34. package/dist/{extension-6I5t1ZxQ.js → extension-Dy6hHSvD.js} +1324 -1783
  35. package/dist/{extension-link-DJy7XDoj.js → extension-link-CjfUZ90W.js} +1 -1
  36. package/dist/{html-to-markdown-Cta7-ssO.js → html-to-markdown-B6Uhn7ok.js} +112 -54
  37. package/dist/main.css +52 -1
  38. package/dist/main.js +2 -2
  39. package/dist/{markdown-to-html-DwSNqq2i.js → markdown-to-html-WmeDaJXP.js} +73 -60
  40. package/dist/{menus-m_EkiaUN.js → menus-_EXlLMjz.js} +2 -2
  41. package/dist/{purify.es-CFiLaBu1.js → purify.es-BES4pJF7.js} +267 -260
  42. package/dist/resizable-table-Ddw3l6DJ.js +489 -0
  43. package/dist/{slashCommand-DuSH9sXJ.js → slashCommand-CxX07Nbk.js} +24 -22
  44. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  45. package/dist/utils/html-to-markdown.js +1 -1
  46. package/dist/utils/index.js +4 -4
  47. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  48. package/dist/utils/markdown-to-html.js +1 -1
  49. package/package.json +6 -6
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "../../../../slashCommand-DuSH9sXJ.js";
1
+ import { n as e, t } from "../../../../slashCommand-CxX07Nbk.js";
2
2
  export { t as SlashCommand, e as slashMenuPluginKey };
@@ -1 +1 @@
1
- {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/slashCommand/items.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,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,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../lib/components/Scribe/extension/slashCommand/items.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,oBAAY,kBAAkB;IAC5B,YAAY,UAAU;IACtB,eAAe,aAAa;CAC7B;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,mBAAmB,CAAC;IAC7B,YAAY,EAAE,cAAc,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,8BAA8B,KAClC,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,sBAAsB,WAAY,MAAM,KAAG,mBA6BvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,qBA8N1E,CAAC"}
@@ -135,6 +135,33 @@ var t = /* @__PURE__ */ function(e) {
135
135
  children: /* @__PURE__ */ e("path", { d: "M21 12.75C21.4142 12.75 21.75 12.4142 21.75 12C21.75 11.5858 21.4142 11.25 21 11.25V12.75ZM3 11.25C2.58579 11.25 2.25 11.5858 2.25 12C2.25 12.4142 2.58579 12.75 3 12.75V11.25ZM7.54601 7.89101L7.8865 7.22275L7.54601 7.89101ZM7.10899 7.45399L7.77725 7.1135L7.10899 7.45399ZM16.891 7.45399L16.2228 7.1135L16.891 7.45399ZM16.454 7.89101L16.1135 7.22275L16.454 7.89101ZM16.454 4.10899L16.1135 4.77725L16.454 4.10899ZM16.891 4.54601L16.2228 4.8865L16.891 4.54601ZM7.54601 4.10899L7.8865 4.77725L7.54601 4.10899ZM7.10899 4.54601L7.77725 4.8865L7.10899 4.54601ZM7.54601 19.891L7.8865 19.2228L7.54601 19.891ZM7.10899 19.454L7.77725 19.1135L7.10899 19.454ZM16.891 19.454L16.2228 19.1135L16.891 19.454ZM16.454 19.891L16.1135 19.2228L16.454 19.891ZM16.454 16.109L16.1135 16.7772L16.454 16.109ZM16.891 16.546L16.2228 16.8865L16.891 16.546ZM7.54601 16.109L7.8865 16.7772L7.54601 16.109ZM7.10899 16.546L7.77725 16.8865L7.10899 16.546ZM21 11.25H3V12.75H21V11.25ZM8.6 4.75H15.4V3.25H8.6V4.75ZM16.25 5.6V6.4H17.75V5.6H16.25ZM15.4 7.25H8.6V8.75H15.4V7.25ZM7.75 6.4V5.6H6.25V6.4H7.75ZM8.6 7.25C8.3076 7.25 8.1334 7.24942 8.00428 7.23887C7.8839 7.22903 7.87011 7.2144 7.8865 7.22275L7.20552 8.55926C7.43582 8.67661 7.669 8.71647 7.88213 8.73388C8.08651 8.75058 8.33235 8.75 8.6 8.75V7.25ZM6.25 6.4C6.25 6.66765 6.24942 6.91349 6.26611 7.11787C6.28353 7.331 6.32339 7.56418 6.44074 7.79448L7.77725 7.1135C7.7856 7.12989 7.77097 7.1161 7.76113 6.99572C7.75058 6.8666 7.75 6.6924 7.75 6.4H6.25ZM7.8865 7.22275C7.83946 7.19878 7.80122 7.16054 7.77725 7.1135L6.44074 7.79448C6.60852 8.12377 6.87623 8.39148 7.20552 8.55926L7.8865 7.22275ZM16.25 6.4C16.25 6.6924 16.2494 6.8666 16.2389 6.99572C16.229 7.1161 16.2144 7.12989 16.2228 7.1135L17.5593 7.79448C17.6766 7.56418 17.7165 7.331 17.7339 7.11787C17.7506 6.91349 17.75 6.66765 17.75 6.4H16.25ZM15.4 8.75C15.6677 8.75 15.9135 8.75058 16.1179 8.73388C16.331 8.71647 16.5642 8.67661 16.7945 8.55926L16.1135 7.22275C16.1299 7.2144 16.1161 7.22903 15.9957 7.23887C15.8666 7.24942 15.6924 7.25 15.4 7.25V8.75ZM16.2228 7.1135C16.1988 7.16054 16.1605 7.19878 16.1135 7.22275L16.7945 8.55926C17.1238 8.39148 17.3915 8.12377 17.5593 7.79448L16.2228 7.1135ZM15.4 4.75C15.6924 4.75 15.8666 4.75058 15.9957 4.76113C16.1161 4.77097 16.1299 4.7856 16.1135 4.77725L16.7945 3.44074C16.5642 3.32339 16.331 3.28353 16.1179 3.26612C15.9135 3.24942 15.6677 3.25 15.4 3.25V4.75ZM17.75 5.6C17.75 5.33235 17.7506 5.08651 17.7339 4.88213C17.7165 4.669 17.6766 4.43582 17.5593 4.20552L16.2228 4.8865C16.2144 4.87011 16.229 4.8839 16.2389 5.00428C16.2494 5.1334 16.25 5.3076 16.25 5.6H17.75ZM16.1135 4.77725C16.1605 4.80122 16.1988 4.83946 16.2228 4.8865L17.5593 4.20552C17.3915 3.87623 17.1238 3.60852 16.7945 3.44074L16.1135 4.77725ZM8.6 3.25C8.33235 3.25 8.08651 3.24942 7.88213 3.26612C7.669 3.28353 7.43582 3.32339 7.20552 3.44074L7.8865 4.77725C7.87011 4.7856 7.8839 4.77097 8.00428 4.76113C8.1334 4.75058 8.3076 4.75 8.6 4.75V3.25ZM7.75 5.6C7.75 5.3076 7.75058 5.1334 7.76113 5.00428C7.77097 4.8839 7.7856 4.87011 7.77725 4.8865L6.44074 4.20552C6.32339 4.43582 6.28353 4.669 6.26611 4.88213C6.24942 5.08651 6.25 5.33235 6.25 5.6H7.75ZM7.20552 3.44074C6.87623 3.60852 6.60852 3.87623 6.44074 4.20552L7.77725 4.8865C7.80122 4.83946 7.83946 4.80122 7.8865 4.77725L7.20552 3.44074ZM8.6 16.75H15.4V15.25H8.6V16.75ZM16.25 17.6V18.4H17.75V17.6H16.25ZM15.4 19.25H8.6V20.75H15.4V19.25ZM7.75 18.4V17.6H6.25V18.4H7.75ZM8.6 19.25C8.3076 19.25 8.1334 19.2494 8.00428 19.2389C7.8839 19.229 7.87011 19.2144 7.8865 19.2228L7.20552 20.5593C7.43582 20.6766 7.669 20.7165 7.88213 20.7339C8.08651 20.7506 8.33235 20.75 8.6 20.75V19.25ZM6.25 18.4C6.25 18.6677 6.24942 18.9135 6.26611 19.1179C6.28353 19.331 6.32339 19.5642 6.44074 19.7945L7.77725 19.1135C7.7856 19.1299 7.77097 19.1161 7.76113 18.9957C7.75058 18.8666 7.75 18.6924 7.75 18.4H6.25ZM7.8865 19.2228C7.83946 19.1988 7.80122 19.1605 7.77725 19.1135L6.44074 19.7945C6.60852 20.1238 6.87623 20.3915 7.20552 20.5593L7.8865 19.2228ZM16.25 18.4C16.25 18.6924 16.2494 18.8666 16.2389 18.9957C16.229 19.1161 16.2144 19.1299 16.2228 19.1135L17.5593 19.7945C17.6766 19.5642 17.7165 19.331 17.7339 19.1179C17.7506 18.9135 17.75 18.6677 17.75 18.4H16.25ZM15.4 20.75C15.6677 20.75 15.9135 20.7506 16.1179 20.7339C16.331 20.7165 16.5642 20.6766 16.7945 20.5593L16.1135 19.2228C16.1299 19.2144 16.1161 19.229 15.9957 19.2389C15.8666 19.2494 15.6924 19.25 15.4 19.25V20.75ZM16.2228 19.1135C16.1988 19.1605 16.1605 19.1988 16.1135 19.2228L16.7945 20.5593C17.1238 20.3915 17.3915 20.1238 17.5593 19.7945L16.2228 19.1135ZM15.4 16.75C15.6924 16.75 15.8666 16.7506 15.9957 16.7611C16.1161 16.771 16.1299 16.7856 16.1135 16.7772L16.7945 15.4407C16.5642 15.3234 16.331 15.2835 16.1179 15.2661C15.9135 15.2494 15.6677 15.25 15.4 15.25V16.75ZM17.75 17.6C17.75 17.3323 17.7506 17.0865 17.7339 16.8821C17.7165 16.669 17.6766 16.4358 17.5593 16.2055L16.2228 16.8865C16.2144 16.8701 16.229 16.8839 16.2389 17.0043C16.2494 17.1334 16.25 17.3076 16.25 17.6H17.75ZM16.1135 16.7772C16.1605 16.8012 16.1988 16.8395 16.2228 16.8865L17.5593 16.2055C17.3915 15.8762 17.1238 15.6085 16.7945 15.4407L16.1135 16.7772ZM8.6 15.25C8.33235 15.25 8.08651 15.2494 7.88213 15.2661C7.66899 15.2835 7.43582 15.3234 7.20552 15.4407L7.8865 16.7772C7.87011 16.7856 7.8839 16.771 8.00428 16.7611C8.1334 16.7506 8.3076 16.75 8.6 16.75V15.25ZM7.75 17.6C7.75 17.3076 7.75058 17.1334 7.76113 17.0043C7.77097 16.8839 7.7856 16.8701 7.77725 16.8865L6.44074 16.2055C6.32339 16.4358 6.28353 16.669 6.26611 16.8821C6.24942 17.0865 6.25 17.3323 6.25 17.6H7.75ZM7.20552 15.4407C6.87623 15.6085 6.60852 15.8762 6.44074 16.2055L7.77725 16.8865C7.80122 16.8395 7.83946 16.8012 7.8865 16.7772L7.20552 15.4407Z" })
136
136
  })
137
137
  },
138
+ {
139
+ title: "Table",
140
+ description: "Insert a 3 × 3 table",
141
+ type: "Advanced",
142
+ command: ({ editor: e, range: t }) => e.chain().focus().deleteRange(t).insertTable({
143
+ rows: 3,
144
+ cols: 3,
145
+ withHeaderRow: !0
146
+ }).run(),
147
+ searchTerms: [
148
+ "grid",
149
+ "rows",
150
+ "columns"
151
+ ],
152
+ icon: /* @__PURE__ */ e("svg", {
153
+ className: "slash-menu-icon slash-menu-icon-with-strokes",
154
+ viewBox: "0 0 24 24",
155
+ fill: "none",
156
+ xmlns: "http://www.w3.org/2000/svg",
157
+ children: /* @__PURE__ */ e("path", {
158
+ d: "M4 5H20V19H4V5ZM4 9H20M4 14H20M9.333 5V19M14.667 5V19",
159
+ strokeWidth: "1.5",
160
+ strokeLinecap: "round",
161
+ strokeLinejoin: "round"
162
+ })
163
+ })
164
+ },
138
165
  {
139
166
  title: "Code Block",
140
167
  description: "Add a block of code",
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../../dist-wYqYXEOz.js";
1
+ import { n as e } from "../../../../dist-Dw4STOPE.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
3
  import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
4
4
  import { SlashCommandList as r } from "./SlashCommandList.js";
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-DErUltkU.js";
1
+ import { n as e } from "../../../dist-DFua_Xbu.js";
2
2
  import { Plugin as t, PluginKey as n } from "@tiptap/pm/state";
3
3
  //#region lib/components/Scribe/extension/tableOfContents.ts
4
4
  var r = "scribeTableOfContents", i = new n("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) => {
@@ -35,7 +35,8 @@ export interface ScribeProps {
35
35
  extensions?: Extension[];
36
36
  /**
37
37
  * A caller-owned editor. Scribe attaches it without taking responsibility
38
- * for destroying it.
38
+ * for destroying it. Its extension and plugin lifecycle, including table
39
+ * resizing, also remains caller-owned.
39
40
  */
40
41
  externalEditor?: Editor;
41
42
  editorProps?: UseEditorOpt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E,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACzC,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,sEAAsE;IACtE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mFAAmF;IACnF,uBAAuB,CAAC,EAAE,kCAAkC,CAAC;CAC9D;AAobD,eAAO,MAAM,MAAM,mGAMlB,CAAC"}
@@ -1,142 +1,143 @@
1
- import { n as e, t } from "../../BarMenu-5S2vKAtc.js";
2
- import { i as n, t as r } from "../../dist-wYqYXEOz.js";
1
+ import { n as e, t } from "../../BarMenu-5M9g9Y1j.js";
2
+ import { i as n, t as r } from "../../dist-Dw4STOPE.js";
3
3
  import i from "../Menu/LinkBubbleMenu.js";
4
- import { t as a } from "../../html-to-markdown-Cta7-ssO.js";
5
- import { t as o } from "../../extension-6I5t1ZxQ.js";
6
- import { SuggestionItemType as s } from "./extension/slashCommand/items.js";
4
+ import a from "../Menu/TableBubbleMenu.js";
5
+ import { t as o } from "../../html-to-markdown-B6Uhn7ok.js";
6
+ import { t as s } from "../../extension-Dy6hHSvD.js";
7
+ import { SuggestionItemType as c } from "./extension/slashCommand/items.js";
7
8
  import "./extension/tableOfContents.js";
8
9
  import "../../utils/index.js";
9
- import { ListOptionBar as c } from "../Menu/Mobile/ListOptionBar.js";
10
- import { forwardRef as l, useCallback as u, useEffect as d, useImperativeHandle as f, useRef as p, useState as m } from "react";
11
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
10
+ import { ListOptionBar as l } from "../Menu/Mobile/ListOptionBar.js";
11
+ import { forwardRef as u, useCallback as d, useEffect as f, useImperativeHandle as p, useRef as m, useState as h } from "react";
12
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
13
  import '../../assets/index.css';//#region lib/components/Scribe/index.tsx
13
- var _ = "Rich text editor", v = [
14
+ var v = "Rich text editor", y = [
14
15
  "role",
15
16
  "aria-label",
16
17
  "aria-multiline",
17
18
  "aria-readonly"
18
- ], y = (t, n, r) => {
19
+ ], b = (t, n, r) => {
19
20
  let i = t.role ?? "textbox";
20
21
  return {
21
22
  ...t,
22
23
  role: i,
23
24
  class: e("scribe", t.class),
24
- "aria-label": n ?? t["aria-label"] ?? _,
25
+ "aria-label": n ?? t["aria-label"] ?? v,
25
26
  ...i === "textbox" ? {
26
27
  "aria-multiline": "true",
27
28
  "aria-readonly": String(!r)
28
29
  } : {}
29
30
  };
30
- }, b = (e) => {
31
- let t = p([]), n = p(e);
32
- return d(() => {
31
+ }, x = (e) => {
32
+ let t = m([]), n = m(e);
33
+ return f(() => {
33
34
  n.current = e;
34
35
  }, [e]), {
35
- handleTableOfContentsChange: u((e, r) => {
36
+ handleTableOfContentsChange: d((e, r) => {
36
37
  t.current = e, n.current?.(e, r);
37
38
  }, []),
38
39
  tableOfContentsItemsRef: t
39
40
  };
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: _
41
+ }, S = u((n, s) => {
42
+ let { ariaLabel: c, autoFocus: u = !1, content: h, editable: v = !0, editor: x, editorProps: S, externalEditor: C, initialContentWasApplied: w, onContentChange: T, showBarMenu: E = !0, editorContentStyle: D, editorContentClassName: O, mainContainerStyle: k, mainContainerClassName: A, onKeyDown: j, mobile: M, tableOfContentsItemsRef: N } = n, P = m({
43
+ ariaLabel: c,
44
+ editable: v
45
+ }), F = m(null);
46
+ P.current = {
47
+ ariaLabel: c,
48
+ editable: v
48
49
  };
49
- let F = p(C && m !== void 0), I = u(({ editor: e, transaction: t }) => {
50
+ let I = m(w && h !== void 0), L = d(({ editor: e, transaction: t }) => {
50
51
  if (t.getMeta("scribeTableOfContents")) return;
51
- let n = e.getHTML(), r = e.getJSON(), i = !_;
52
- w && w({
52
+ let n = e.getHTML(), r = e.getJSON(), i = !v;
53
+ T && T({
53
54
  jsonContent: e.isEmpty ? "" : r,
54
55
  htmlContent: e.isEmpty ? "" : n,
55
- markdownContent: e.isEmpty ? "" : a(n),
56
+ markdownContent: e.isEmpty ? "" : o(n),
56
57
  source: i ? "programmatic" : "user"
57
58
  });
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 });
59
+ }, [v, T]), R = d(() => {
60
+ x.commands.setContent("");
61
+ }, [x]), z = d((e) => x.isEmpty ? "" : {
62
+ html: () => x.getHTML(),
63
+ json: () => x.getJSON(),
64
+ markdown: () => o(x.getHTML())
65
+ }[e]?.(), [x]), B = d((e) => {
66
+ x.commands.setContent(e);
67
+ }, [x]), V = d((e) => {
68
+ let t = typeof e == "string" ? e : e.id, n = N.current.find((e) => e.id === t) ?? (typeof e == "string" ? void 0 : e);
69
+ if (!n || x.isDestroyed) return;
70
+ let r = x.view.nodeDOM(n.pos), i = r instanceof HTMLElement ? r : n.dom;
71
+ if (x.isEditable) {
72
+ let e = Math.max(0, Math.min(n.pos + n.node.nodeSize - 1, x.state.doc.content.size));
73
+ x.commands.focus(e, { scrollIntoView: !1 });
73
74
  }
74
75
  i.scrollIntoView({
75
76
  behavior: "smooth",
76
77
  block: "start"
77
78
  });
78
- }, [b, M]);
79
- return f(o, () => ({
80
- resetContent: L,
81
- setContent: z,
82
- getContent: R,
83
- scrollToTableOfContentsItem: B,
84
- editor: b
79
+ }, [x, N]);
80
+ return p(s, () => ({
81
+ resetContent: R,
82
+ setContent: B,
83
+ getContent: z,
84
+ scrollToTableOfContentsItem: V,
85
+ editor: x
85
86
  }), [
86
- b,
87
+ x,
88
+ z,
87
89
  R,
88
- L,
89
- B,
90
- z
91
- ]), d(() => {
92
- if (m !== void 0) {
93
- if (F.current) {
94
- F.current = !1;
90
+ V,
91
+ B
92
+ ]), f(() => {
93
+ if (h !== void 0) {
94
+ if (I.current) {
95
+ I.current = !1;
95
96
  return;
96
97
  }
97
- b.commands.setContent(m, { emitUpdate: !1 });
98
+ x.commands.setContent(h, { emitUpdate: !1 });
98
99
  }
99
- }, [m, b]), d(() => {
100
- if (!S) {
101
- P.current = null;
100
+ }, [h, x]), f(() => {
101
+ if (!C) {
102
+ F.current = null;
102
103
  return;
103
104
  }
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 e = x.view.dom, t = Object.fromEntries(y.map((t) => [t, e.getAttribute(t)])), n = x.options.editable, r = x.options.editorProps ?? {}, i = r.attributes, a = /* @__PURE__ */ new Set(), o = (e, t) => {
105
106
  let n = typeof i == "function" ? i.call(t, e) : i;
106
107
  return Object.keys(n ?? {}).forEach((e) => a.add(e)), n ?? {};
107
108
  }, s = (e, n) => {
108
109
  let r = o(e, n), i = {};
109
- return v.forEach((e) => {
110
+ return y.forEach((e) => {
110
111
  let n = t[e];
111
112
  !a.has(e) && n !== null && (i[e] = n);
112
113
  }), {
113
114
  ...i,
114
115
  ...r
115
116
  };
116
- }, c = s(b.state, r);
117
- P.current = {
118
- editor: b,
117
+ }, c = s(x.state, r);
118
+ F.current = {
119
+ editor: x,
119
120
  attributes: c
120
121
  };
121
122
  let l = function(e) {
122
123
  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);
124
+ F.current?.editor === x && (F.current.attributes = t);
125
+ let n = P.current;
126
+ return b(t, n.ariaLabel, n.editable);
126
127
  };
127
- return b.setOptions({ editorProps: {
128
+ return x.setOptions({ editorProps: {
128
129
  ...r,
129
130
  attributes: l
130
131
  } }), () => {
131
- if (!b.isDestroyed) {
132
- let s = b.options.editorProps ?? {}, c = s.attributes === l;
132
+ if (!x.isDestroyed) {
133
+ let s = x.options.editorProps ?? {}, c = s.attributes === l;
133
134
  if (c) {
134
135
  let e = { ...s };
135
- i === void 0 ? delete e.attributes : e.attributes = i, b.setOptions({ editorProps: e });
136
+ i === void 0 ? delete e.attributes : e.attributes = i, x.setOptions({ editorProps: e });
136
137
  }
137
- b.setEditable(!!n, !1);
138
- let u = c ? o(b.state, r) : null;
139
- u && v.forEach((n) => {
138
+ x.setEditable(!!n, !1);
139
+ let u = c ? o(x.state, r) : null;
140
+ u && y.forEach((n) => {
140
141
  let r = n in u ? u[n] : a.has(n) ? null : t[n];
141
142
  if (r == null) {
142
143
  e.removeAttribute(n);
@@ -145,12 +146,12 @@ var _ = "Rich text editor", v = [
145
146
  e.setAttribute(n, r);
146
147
  });
147
148
  }
148
- P.current?.editor === b && (P.current = null);
149
+ F.current?.editor === x && (F.current = null);
149
150
  };
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) => {
151
+ }, [x, C]), f(() => {
152
+ x.setEditable(!!v);
153
+ let e = x.view.dom, t = b((C ? F.current?.attributes : typeof S?.editorProps?.attributes == "function" ? S.editorProps.attributes.call(S.editorProps, x.state) : S?.editorProps?.attributes) ?? {}, c, v);
154
+ y.forEach((n) => {
154
155
  let r = t[n];
155
156
  if (r === void 0) {
156
157
  e.removeAttribute(n);
@@ -159,78 +160,82 @@ var _ = "Rich text editor", v = [
159
160
  e.setAttribute(n, r);
160
161
  });
161
162
  }, [
162
- s,
163
- _,
164
- b,
163
+ c,
164
+ v,
165
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),
166
+ S,
167
+ C
168
+ ]), f(() => (x.off("update"), x.on("update", L), () => {
169
+ x.off("update", L);
170
+ }), [x, L]), f(() => {
171
+ u && x.commands.focus("end");
172
+ }, [u, x]), /* @__PURE__ */ _("div", {
173
+ className: e("scribe-wrapper", "scribe-root", A),
173
174
  "data-scribe-root": !0,
174
- style: O,
175
- children: [/* @__PURE__ */ g("div", {
176
- className: e("scribe-frame", _ && "scribe-frame--editable"),
175
+ style: k,
176
+ children: [/* @__PURE__ */ _("div", {
177
+ className: e("scribe-frame", v && "scribe-frame--editable"),
177
178
  children: [
178
- b && T ? /* @__PURE__ */ h(t, { editor: b }) : null,
179
- /* @__PURE__ */ g("div", {
180
- className: e("scribe-content", _ && "scribe-content--editable", D),
181
- style: E,
182
- children: [/* @__PURE__ */ h(r, {
183
- editor: b,
184
- onKeyDown: A
185
- }), _ ? /* @__PURE__ */ h(i, { editor: b }) : null]
179
+ x && E ? /* @__PURE__ */ g(t, { editor: x }) : null,
180
+ /* @__PURE__ */ _("div", {
181
+ className: e("scribe-content", v && "scribe-content--editable", O),
182
+ style: D,
183
+ children: [
184
+ /* @__PURE__ */ g(r, {
185
+ editor: x,
186
+ onKeyDown: j
187
+ }),
188
+ v ? /* @__PURE__ */ g(i, { editor: x }) : null,
189
+ v && x.schema.nodes.table ? /* @__PURE__ */ g(a, { editor: x }) : null
190
+ ]
186
191
  }),
187
- j ? /* @__PURE__ */ h(c, { editor: b }) : null
192
+ M ? /* @__PURE__ */ g(l, { editor: x }) : null
188
193
  ]
189
- }), /* @__PURE__ */ h("div", {
194
+ }), /* @__PURE__ */ g("div", {
190
195
  className: "scribe-popup-root",
191
196
  "data-scribe-popup-root": !0
192
197
  })]
193
198
  });
194
199
  });
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({
200
+ S.displayName = "ScribeEditor";
201
+ var C = u((e, t) => {
202
+ let { ariaLabel: r, content: i, editable: a = !0, editorProps: o, extensions: c, onTableOfContentsChange: l } = e, { handleTableOfContentsChange: u, tableOfContentsItemsRef: d } = x(l), f = o?.editorProps?.attributes, p = m({
198
203
  ariaLabel: r,
199
204
  editable: a
200
205
  });
201
- g.current = {
206
+ p.current = {
202
207
  ariaLabel: r,
203
208
  editable: a
204
209
  };
205
210
  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
+ let t = p.current;
212
+ return b(f.call(this, e), t.ariaLabel, t.editable);
213
+ } : b(f ?? {}, r, a), [v] = h(() => ({
214
+ ...o,
215
+ content: i ?? o?.content,
211
216
  editable: a,
212
- extensions: [...o({
217
+ extensions: [...s({
213
218
  ...e,
214
219
  onTableOfContentsChange: u
215
220
  }), ...c ?? []],
216
221
  editorProps: {
217
- ...s?.editorProps,
222
+ ...o?.editorProps,
218
223
  attributes: _
219
224
  },
220
- shouldRerenderOnTransaction: s?.shouldRerenderOnTransaction ?? !1
221
- })), S = n(v);
222
- return S ? /* @__PURE__ */ h(x, {
225
+ shouldRerenderOnTransaction: o?.shouldRerenderOnTransaction ?? !1
226
+ })), y = n(v);
227
+ return y ? /* @__PURE__ */ g(S, {
223
228
  ...e,
224
229
  ref: t,
225
- editor: S,
230
+ editor: y,
226
231
  initialContentWasApplied: !0,
227
232
  tableOfContentsItemsRef: d
228
233
  }) : null;
229
234
  });
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, {
235
+ C.displayName = "OwnedScribe";
236
+ var w = u((e, t) => {
237
+ let { externalEditor: n, onTableOfContentsChange: r } = e, { tableOfContentsItemsRef: i } = x(r);
238
+ return n ? /* @__PURE__ */ g(S, {
234
239
  ...e,
235
240
  ref: t,
236
241
  editor: n,
@@ -238,14 +243,14 @@ var C = l((e, t) => {
238
243
  tableOfContentsItemsRef: i
239
244
  }) : null;
240
245
  });
241
- C.displayName = "ExternalScribe";
242
- var w = l((e, t) => e.externalEditor ? /* @__PURE__ */ h(C, {
246
+ w.displayName = "ExternalScribe";
247
+ var T = u((e, t) => e.externalEditor ? /* @__PURE__ */ g(w, {
243
248
  ...e,
244
249
  ref: t
245
- }) : /* @__PURE__ */ h(S, {
250
+ }) : /* @__PURE__ */ g(C, {
246
251
  ...e,
247
252
  ref: t
248
253
  }));
249
- w.displayName = "Scribe";
254
+ T.displayName = "Scribe";
250
255
  //#endregion
251
- export { w as Scribe, s as SuggestionItemType };
256
+ export { T as Scribe, c as SuggestionItemType };
@@ -1175,24 +1175,26 @@ function pn(e, t, n) {
1175
1175
  }
1176
1176
  var mn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1177
1177
  let { selection: a } = n, { empty: o, ranges: s } = a, c = N(e, r.schema);
1178
- if (i) if (o) {
1179
- let e = Tt(r, c);
1180
- n.addStoredMark(c.create({
1181
- ...e,
1182
- ...t
1183
- }));
1184
- } else s.forEach((e) => {
1185
- let i = e.$from.pos, a = e.$to.pos;
1186
- r.doc.nodesBetween(i, a, (e, r) => {
1187
- let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
1188
- e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
1189
- c === e.type && n.addMark(o, s, c.create({
1190
- ...e.attrs,
1191
- ...t
1192
- }));
1193
- }) : n.addMark(o, s, c.create(t));
1178
+ if (i) {
1179
+ if (o) {
1180
+ let e = Tt(r, c);
1181
+ n.addStoredMark(c.create({
1182
+ ...e,
1183
+ ...t
1184
+ }));
1185
+ } else s.forEach((e) => {
1186
+ let i = e.$from.pos, a = e.$to.pos;
1187
+ r.doc.nodesBetween(i, a, (e, r) => {
1188
+ let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
1189
+ e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
1190
+ c === e.type && n.addMark(o, s, c.create({
1191
+ ...e.attrs,
1192
+ ...t
1193
+ }));
1194
+ }) : n.addMark(o, s, c.create(t));
1195
+ });
1194
1196
  });
1195
- });
1197
+ }
1196
1198
  return pn(r, n, c);
1197
1199
  }, hn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), gn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1198
1200
  let a = j(e, n.schema), o;
@@ -1635,14 +1637,16 @@ function Zn(e) {
1635
1637
  let a = g.slice(0, i);
1636
1638
  m = a.trim();
1637
1639
  let o = e.slice(0, p + i + n[0].length), c = [];
1638
- if (m) if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
1639
- e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
1640
- }); c.length > 0;) {
1641
- let e = c[c.length - 1];
1642
- if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
1643
- else break;
1640
+ if (m) {
1641
+ if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
1642
+ e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
1643
+ }); c.length > 0;) {
1644
+ let e = c[c.length - 1];
1645
+ if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
1646
+ else break;
1647
+ }
1648
+ else c = r.inlineTokens(m);
1644
1649
  }
1645
- else c = r.inlineTokens(m);
1646
1650
  return {
1647
1651
  type: t,
1648
1652
  raw: o,
@@ -2664,13 +2668,15 @@ var $ = class e extends sr {
2664
2668
  closest(e, t = {}) {
2665
2669
  let n = null, r = this.parent;
2666
2670
  for (; r && !n;) {
2667
- if (r.node.type.name === e) if (Object.keys(t).length > 0) {
2668
- let e = r.node.attrs, n = Object.keys(t);
2669
- for (let r = 0; r < n.length; r += 1) {
2670
- let i = n[r];
2671
- if (e[i] !== t[i]) break;
2672
- }
2673
- } else n = r;
2671
+ if (r.node.type.name === e) {
2672
+ if (Object.keys(t).length > 0) {
2673
+ let e = r.node.attrs, n = Object.keys(t);
2674
+ for (let r = 0; r < n.length; r += 1) {
2675
+ let i = n[r];
2676
+ if (e[i] !== t[i]) break;
2677
+ }
2678
+ } else n = r;
2679
+ }
2674
2680
  r = r.parent;
2675
2681
  }
2676
2682
  return n;
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
2
- import { t } from "./dist-DErUltkU.js";
2
+ import { t } from "./dist-DFua_Xbu.js";
3
3
  import * as n from "react";
4
4
  import r, { createContext as i, forwardRef as a, useContext as o, useDebugValue as s, useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f, version as p } from "react";
5
5
  import m, { flushSync as h } from "react-dom";