@clevertask/scribe 0.1.24 → 0.1.26

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 (54) hide show
  1. package/README.md +48 -0
  2. package/dist/{BarMenu-DW95OBe1.js → BarMenu-BGWT4Oyk.js} +1 -1
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.js +1 -1
  5. package/dist/components/Menu/BubbleMenu.js +2 -2
  6. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  7. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  8. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  9. package/dist/components/Menu/TableBubbleMenu.js +2 -2
  10. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  11. package/dist/components/Scribe/extension/callout.js +1 -1
  12. package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
  13. package/dist/components/Scribe/extension/extension-link.js +1 -1
  14. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  15. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
  18. package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
  19. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  20. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  21. package/dist/components/Scribe/extension/index.js +1 -1
  22. package/dist/components/Scribe/extension/resizable-table.d.ts +2 -0
  23. package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
  24. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  25. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  26. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  27. package/dist/components/Scribe/extension/slashCommand/items.js +35 -33
  28. package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
  29. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  30. package/dist/components/Scribe/index.js +4 -4
  31. package/dist/{dist-_L8dTDsy.js → dist-BiognBi4.js} +3 -2
  32. package/dist/{dist-Cer8ra_P.js → dist-Dk0fXvrc.js} +1 -1
  33. package/dist/{dist-ClNucvAM.js → dist-xjmWZ-oh.js} +785 -785
  34. package/dist/{extension-B7i7CZ1Y.js → extension-BFPlsViw.js} +1 -1
  35. package/dist/{extension-link-BQrkQZHi.js → extension-link-DmM_EJTn.js} +1 -1
  36. package/dist/{html-to-markdown-CKpceHDk.js → html-to-markdown-BpR-7GtJ.js} +1 -1
  37. package/dist/main.js +2 -2
  38. package/dist/{markdown-to-html-zj2j0HLf.js → markdown-to-html-BoK5O_j-.js} +183 -143
  39. package/dist/{menus-BhM4ctz2.js → menus-BDXjZsFU.js} +2 -2
  40. package/dist/{purify.es-CpMrJENN.js → purify.es-q6CUdJQi.js} +251 -190
  41. package/dist/{resizable-table-DgMCiXeO.js → resizable-table-JZOaj_L3.js} +88 -78
  42. package/dist/{schema-extensions-ggKYCkRf.js → schema-extensions-BryyErmk.js} +6 -6
  43. package/dist/schema-extensions.js +1 -1
  44. package/dist/schema.d.ts +1 -0
  45. package/dist/schema.d.ts.map +1 -1
  46. package/dist/schema.js +5 -4
  47. package/dist/table-transforms.d.ts +58 -0
  48. package/dist/table-transforms.d.ts.map +1 -0
  49. package/dist/table-transforms.js +166 -0
  50. package/dist/{tippy.esm-8vSV0zL7.js → tippy.esm-MjWnmeEn.js} +0 -3
  51. package/dist/utils/html-to-markdown.js +1 -1
  52. package/dist/utils/index.js +4 -4
  53. package/dist/utils/markdown-to-html.js +1 -1
  54. package/package.json +11 -11
package/README.md CHANGED
@@ -107,6 +107,47 @@ capability declaration to `createScribeDocumentNodeCapabilityManifest`. Use
107
107
  is missing, duplicated, or no longer matches the schema. A custom node can declare no potential
108
108
  operations and remain explicitly read-only.
109
109
 
110
+ ### Headless table transforms
111
+
112
+ The same headless entry can insert or delete an exact logical table row or column and can merge or
113
+ split cells without mounting an editor or accessing the DOM:
114
+
115
+ ```ts
116
+ import { applyScribeTableTransform, createScribeSchemaExtensions } from "@clevertask/scribe/schema";
117
+ import { getSchema } from "@tiptap/core";
118
+
119
+ const schema = getSchema(createScribeSchemaExtensions({ enableUndoRedo: false }));
120
+ const document = schema.nodeFromJSON(storedDocument);
121
+ const tablePosition = 42; // ProseMirror position immediately before the table node.
122
+ const result = applyScribeTableTransform(document, tablePosition, {
123
+ type: "insert_row",
124
+ index: 1,
125
+ });
126
+
127
+ persist(result.document);
128
+ ```
129
+
130
+ Rows and columns use zero-based logical coordinates from ProseMirror's table grid, not physical
131
+ child indexes. An insertion index may equal the current row or column count; deletion indexes must
132
+ name an existing logical row or column. Merge rectangles use half-open bounds: `topRow` and
133
+ `leftColumn` are included, while `bottomRowExclusive` and `rightColumnExclusive` are excluded. A
134
+ split's `row` and `column` must identify the merged cell's top-left logical coordinate. Existing
135
+ rowspans and colspans can therefore affect more than one physical cell even though the requested
136
+ logical boundary remains exact. The returned `before` and `after` geometry reports logical rows,
137
+ logical columns, and physical cell count.
138
+
139
+ `applyScribeTableTransform` is an immutable, exact-snapshot operation: it returns a new ProseMirror
140
+ document and leaves its input unchanged. It does not rebase coordinates or detect that another
141
+ writer changed the stored document after the input snapshot was read. On a concurrent change,
142
+ discard the candidate, read the latest document, resolve the intended table and coordinates again,
143
+ and rerun the transform. Invalid coordinates, malformed or nested tables, and operations that do
144
+ not apply throw `ScribeTableTransformError`.
145
+
146
+ This API owns only schema-valid table geometry. The host application owns authorization, protected
147
+ node rules, revision and conflict checks, destructive previews, payload limits, Yjs conversion and
148
+ persistence, and durable readback. In CleverTask, those checks belong to the collaboration and API
149
+ layers rather than Scribe.
150
+
110
151
  ## Usage
111
152
 
112
153
  ### Basic usage
@@ -184,6 +225,13 @@ Keyboard users can press `Alt + F10` while editing a table to focus its controls
184
225
 
185
226
  Simple headed tables serialize as GFM Markdown. Tables with merged cells, multiple blocks in a cell, resized columns, or other structures that GFM cannot represent are kept as sanitized raw HTML inside the Markdown output so their structure is not silently lost.
186
227
 
228
+ Scribe's `insertTable` command and `/table` action do not create a table while the selection is
229
+ already inside another table. Existing documents containing nested tables remain loadable so old
230
+ content is not destroyed. This guard covers Scribe-owned authoring paths only: arbitrary consumer
231
+ calls to `insertContent`, Markdown table paste, and rich-HTML table paste remain trusted integration
232
+ points. Applications that require a hard no-nested-table guarantee must validate or filter those
233
+ paths too.
234
+
187
235
  ## External Link Previews
188
236
 
189
237
  > [!NOTE]
@@ -1,4 +1,4 @@
1
- import { s as e } from "./dist-_L8dTDsy.js";
1
+ import { s as e } from "./dist-BiognBi4.js";
2
2
  import { getPopupMountTarget as t } from "./components/Scribe/extension/getPopupMountTarget.js";
3
3
  import n from "./components/Menu/LinkEditor.js";
4
4
  import { hideLinkBubbleMenu as r } from "./components/Menu/linkBubbleMenuPlugin.js";