@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.
- package/README.md +48 -0
- package/dist/{BarMenu-DW95OBe1.js → BarMenu-BGWT4Oyk.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.js +2 -2
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +2 -0
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +35 -33
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-_L8dTDsy.js → dist-BiognBi4.js} +3 -2
- package/dist/{dist-Cer8ra_P.js → dist-Dk0fXvrc.js} +1 -1
- package/dist/{dist-ClNucvAM.js → dist-xjmWZ-oh.js} +785 -785
- package/dist/{extension-B7i7CZ1Y.js → extension-BFPlsViw.js} +1 -1
- package/dist/{extension-link-BQrkQZHi.js → extension-link-DmM_EJTn.js} +1 -1
- package/dist/{html-to-markdown-CKpceHDk.js → html-to-markdown-BpR-7GtJ.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-zj2j0HLf.js → markdown-to-html-BoK5O_j-.js} +183 -143
- package/dist/{menus-BhM4ctz2.js → menus-BDXjZsFU.js} +2 -2
- package/dist/{purify.es-CpMrJENN.js → purify.es-q6CUdJQi.js} +251 -190
- package/dist/{resizable-table-DgMCiXeO.js → resizable-table-JZOaj_L3.js} +88 -78
- package/dist/{schema-extensions-ggKYCkRf.js → schema-extensions-BryyErmk.js} +6 -6
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +5 -4
- package/dist/table-transforms.d.ts +58 -0
- package/dist/table-transforms.d.ts.map +1 -0
- package/dist/table-transforms.js +166 -0
- package/dist/{tippy.esm-8vSV0zL7.js → tippy.esm-MjWnmeEn.js} +0 -3
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- 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-
|
|
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";
|