@clevertask/scribe 0.1.26 → 0.1.28
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 +9 -1
- package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +174 -134
- package/dist/components/Menu/TableHeightSettings.d.ts +11 -0
- package/dist/components/Menu/TableHeightSettings.d.ts.map +1 -0
- package/dist/components/Menu/TableHeightSettings.js +156 -0
- package/dist/components/Menu/TableLayoutOptions.d.ts +24 -0
- package/dist/components/Menu/TableLayoutOptions.d.ts.map +1 -0
- package/dist/components/Menu/TableLayoutOptions.js +126 -0
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +13 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +165 -2
- package/dist/components/Scribe/extension/slashCommand/items.js +1 -1
- package/dist/components/Scribe/extension/table-layout.d.ts +31 -0
- package/dist/components/Scribe/extension/table-layout.d.ts.map +1 -0
- package/dist/components/Scribe/extension/table-layout.js +2 -0
- package/dist/components/Scribe/extension/table-sticky-header.d.ts +7 -0
- package/dist/components/Scribe/extension/table-sticky-header.d.ts.map +1 -0
- package/dist/components/Scribe/extension/table-sticky-header.js +106 -0
- package/dist/components/Scribe/index.js +2 -2
- package/dist/document-node-capabilities.d.ts.map +1 -1
- package/dist/document-node-capabilities.js +80 -68
- package/dist/{extension-BFPlsViw.js → extension-BU2USLV1.js} +1 -1
- package/dist/{html-to-markdown-BpR-7GtJ.js → html-to-markdown-DF93it73.js} +1 -1
- package/dist/main.css +47 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/{schema-extensions-BryyErmk.js → schema-extensions-DyCk1Goa.js} +10 -9
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{resizable-table-JZOaj_L3.js → table-layout-BoDS50DR.js} +140 -110
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -221,9 +221,17 @@ function App() {
|
|
|
221
221
|
|
|
222
222
|
Type `/table` to insert a 3 × 3 table with a header row. Selecting a table cell opens nearby controls for adding or deleting rows and columns, toggling the header row, and deleting the table. Drag a column boundary to resize it.
|
|
223
223
|
|
|
224
|
+
The **Table layout** menu stores each table's explicit layout choice. **Auto** keeps the existing sizing behavior. **Fit to width** wraps the table into the available editor width and temporarily disables column resizing. **Scroll horizontally** retains authored column widths, gives columns without a saved width a readable 128px minimum, and scrolls inside the editor when the table needs more room. Switching layouts retains the table's saved column widths.
|
|
225
|
+
|
|
226
|
+
**Limit height** caps the table and enables vertical scrolling; shorter tables stay compact. In **Table layout → Maximum height…**, enter a whole number from 120 to 2000 pixels and choose **Apply** to set that table's maximum. **Use default** clears its override and uses the host's `--scribe-table-max-height`, with a 360px fallback. Turning **Limit height** off retains the saved maximum for when it is enabled again. Changing the maximum leaves the limit toggle, width layout, and sticky header preference unchanged.
|
|
227
|
+
|
|
228
|
+
Layout and height choices apply in both editing and read-only views, and remain intact when content is saved and loaded as JSON, HTML, or Markdown. Hosts can use `editor.commands.setTableLayout("scroll")` (accepts `"auto"`, `"fit"`, or `"scroll"`), `editor.commands.setTableHeightLimit(true)` (accepts a boolean), and `editor.commands.setTableMaxHeight(600)` (accepts a whole number from 120 to 2000, or `null` to restore the default) while the selection is inside an editable table. The optional `maxHeight` table attribute is serialized as `data-table-max-height` in HTML; existing tables without it keep the host default.
|
|
229
|
+
|
|
230
|
+
**Sticky header row** keeps the first row visible while scrolling, independently of **Limit height**. New tables created with `/table` or `insertTable` start with it enabled when their entire first row contains header cells. Existing and imported tables retain their saved setting; tables without a saved sticky preference stay off. Toggle it in **Table layout**. With **Limit height** on, the header stays at the top of the table's own scroll area. With it off, the header follows the document's vertical scroll area until the table ends. This also works with horizontal scrolling and retains saved column widths. The preference stays saved if the header row is removed and becomes active again when it is restored. It works in editing and read-only views. Hosts can use `editor.commands.setTableStickyHeaderRow(true)` to enable it or `false` to clear it while the selection is inside an editable table. For document scrolling, set `--scribe-table-sticky-header-offset` on the editor's container to leave room above the header for a document toolbar; the default is `0px`.
|
|
231
|
+
|
|
224
232
|
Keyboard users can press `Alt + F10` while editing a table to focus its controls, use the arrow, Home, and End keys to move between actions, and press Escape to return to the active cell.
|
|
225
233
|
|
|
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.
|
|
234
|
+
Simple headed tables without layout, height, or sticky-header preferences serialize as GFM Markdown. Tables with those preferences (including a saved maximum while **Limit height** is off or an inactive sticky preference), 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.
|
|
227
235
|
|
|
228
236
|
Scribe's `insertTable` command and `/table` action do not create a table while the selection is
|
|
229
237
|
already inside another table. Existing documents containing nested tables remain loadable so old
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/TableBubbleMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/TableBubbleMenu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAKvD,OAAO,EACL,EAAE,EAQH,MAAM,OAAO,CAAC;AAQf,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAwJD,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA4Y7C,CAAC;eAEa,eAAe"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
1
|
+
import { c as e, u as t } from "../../table-layout-BoDS50DR.js";
|
|
2
|
+
import { s as n } from "../../dist-BiognBi4.js";
|
|
3
|
+
import { getPopupMountTarget as r } from "../Scribe/extension/getPopupMountTarget.js";
|
|
4
|
+
import { t as i } from "../../menus-BDXjZsFU.js";
|
|
5
|
+
import { getSelectionTableContext as a, tableBubbleMenuPluginKey as o } from "./tableBubbleMenuPlugin.js";
|
|
6
|
+
import { getSelectionContextualMenuOwner as s } from "./contextualMenuOwner.js";
|
|
7
|
+
import c from "./TableLayoutOptions.js";
|
|
8
|
+
import { Flex as l, IconButton as u, Separator as d } from "@radix-ui/themes";
|
|
9
|
+
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
10
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
9
11
|
//#region lib/components/Menu/TableBubbleMenu.tsx
|
|
10
|
-
var
|
|
12
|
+
var b = [
|
|
11
13
|
"addColumnAfter",
|
|
12
14
|
"addColumnBefore",
|
|
13
15
|
"addRowAfter",
|
|
@@ -16,7 +18,7 @@ var g = [
|
|
|
16
18
|
"deleteRow",
|
|
17
19
|
"deleteTable",
|
|
18
20
|
"toggleHeaderRow"
|
|
19
|
-
],
|
|
21
|
+
], x = {
|
|
20
22
|
canAddColumnAfter: !1,
|
|
21
23
|
canAddColumnBefore: !1,
|
|
22
24
|
canAddRowAfter: !1,
|
|
@@ -25,24 +27,25 @@ var g = [
|
|
|
25
27
|
canDeleteRow: !1,
|
|
26
28
|
canDeleteTable: !1,
|
|
27
29
|
canToggleHeaderRow: !1,
|
|
28
|
-
hasHeaderRow: !1
|
|
29
|
-
|
|
30
|
+
hasHeaderRow: !1,
|
|
31
|
+
canSetTableLayout: !1,
|
|
32
|
+
canSetTableHeightLimit: !1,
|
|
33
|
+
canSetTableMaxHeight: !1,
|
|
34
|
+
canSetTableStickyHeaderRow: !1,
|
|
35
|
+
tableLayout: "auto",
|
|
36
|
+
limitHeight: !1,
|
|
37
|
+
maxHeight: null,
|
|
38
|
+
stickyHeaderRow: !1
|
|
39
|
+
}, S = /auto|overlay|scroll/, C = (e) => {
|
|
30
40
|
let t = e.ownerDocument.defaultView;
|
|
31
41
|
if (!t) return [];
|
|
32
42
|
let n = [], r = e.parentElement;
|
|
33
43
|
for (; r && r !== e.ownerDocument.body && r !== e.ownerDocument.documentElement;) {
|
|
34
44
|
let e = t.getComputedStyle(r);
|
|
35
|
-
|
|
45
|
+
S.test(`${e.overflow} ${e.overflowX} ${e.overflowY}`) && n.push(r), r = r.parentElement;
|
|
36
46
|
}
|
|
37
47
|
return n;
|
|
38
|
-
},
|
|
39
|
-
let t = e.firstChild;
|
|
40
|
-
if (!t || t.childCount === 0) return !1;
|
|
41
|
-
let n = !0;
|
|
42
|
-
return t.forEach((e) => {
|
|
43
|
-
e.type.name !== "tableHeader" && (n = !1);
|
|
44
|
-
}), n;
|
|
45
|
-
}, x = ({ name: e }) => {
|
|
48
|
+
}, w = ({ name: e }) => {
|
|
46
49
|
let t = {
|
|
47
50
|
"aria-hidden": !0,
|
|
48
51
|
fill: "none",
|
|
@@ -57,12 +60,12 @@ var g = [
|
|
|
57
60
|
};
|
|
58
61
|
if (e === "add-row-above" || e === "add-row-below") {
|
|
59
62
|
let r = e === "add-row-above" ? 3.5 : 16.5;
|
|
60
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ y("svg", {
|
|
61
64
|
...t,
|
|
62
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ v("path", {
|
|
63
66
|
d: "M3.5 6.5h13v7h-13zM3.5 10h13M10 6.5v7",
|
|
64
67
|
...n
|
|
65
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ v("path", {
|
|
66
69
|
d: `M7.75 ${r}h4.5M10 ${r - 2.25}v4.5`,
|
|
67
70
|
...n
|
|
68
71
|
})]
|
|
@@ -70,92 +73,104 @@ var g = [
|
|
|
70
73
|
}
|
|
71
74
|
if (e === "add-column-before" || e === "add-column-after") {
|
|
72
75
|
let r = e === "add-column-before" ? 3.5 : 16.5;
|
|
73
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ y("svg", {
|
|
74
77
|
...t,
|
|
75
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ v("path", {
|
|
76
79
|
d: "M6.5 3.5h7v13h-7zM10 3.5v13M6.5 10h7",
|
|
77
80
|
...n
|
|
78
|
-
}), /* @__PURE__ */
|
|
81
|
+
}), /* @__PURE__ */ v("path", {
|
|
79
82
|
d: `M${r - 2.25} 10h4.5M${r} 7.75v4.5`,
|
|
80
83
|
...n
|
|
81
84
|
})]
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
|
-
return e === "delete-row" ? /* @__PURE__ */
|
|
87
|
+
return e === "delete-row" ? /* @__PURE__ */ y("svg", {
|
|
85
88
|
...t,
|
|
86
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ v("path", {
|
|
87
90
|
d: "M3.5 4h13v12h-13zM3.5 8h13M3.5 12h13M10 4v12",
|
|
88
91
|
...n
|
|
89
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ v("path", {
|
|
90
93
|
d: "M6.75 10h6.5",
|
|
91
94
|
stroke: "currentColor",
|
|
92
95
|
strokeWidth: "2.2"
|
|
93
96
|
})]
|
|
94
|
-
}) : e === "delete-column" ? /* @__PURE__ */
|
|
97
|
+
}) : e === "delete-column" ? /* @__PURE__ */ y("svg", {
|
|
95
98
|
...t,
|
|
96
|
-
children: [/* @__PURE__ */
|
|
99
|
+
children: [/* @__PURE__ */ v("path", {
|
|
97
100
|
d: "M4 3.5h12v13h-12zM8 3.5v13M12 3.5v13M4 10h12",
|
|
98
101
|
...n
|
|
99
|
-
}), /* @__PURE__ */
|
|
102
|
+
}), /* @__PURE__ */ v("path", {
|
|
100
103
|
d: "M10 6.75v6.5",
|
|
101
104
|
stroke: "currentColor",
|
|
102
105
|
strokeWidth: "2.2"
|
|
103
106
|
})]
|
|
104
|
-
}) : e === "toggle-header-row" ? /* @__PURE__ */
|
|
107
|
+
}) : e === "toggle-header-row" ? /* @__PURE__ */ y("svg", {
|
|
105
108
|
...t,
|
|
106
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ v("path", {
|
|
107
110
|
d: "M3.5 4h13v12h-13zM3.5 8h13M10 4v12",
|
|
108
111
|
...n
|
|
109
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ v("path", {
|
|
110
113
|
d: "M4.2 4.7h11.6v2.6H4.2z",
|
|
111
114
|
fill: "currentColor",
|
|
112
115
|
opacity: "0.45"
|
|
113
116
|
})]
|
|
114
|
-
}) : /* @__PURE__ */
|
|
117
|
+
}) : /* @__PURE__ */ y("svg", {
|
|
115
118
|
...t,
|
|
116
|
-
children: [/* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ v("path", {
|
|
117
120
|
d: "M3.5 4h13v12h-13zM3.5 8h13M10 4v12",
|
|
118
121
|
...n
|
|
119
|
-
}), /* @__PURE__ */
|
|
122
|
+
}), /* @__PURE__ */ v("path", {
|
|
120
123
|
d: "m6.75 7 6.5 6.5m0-6.5-6.5 6.5",
|
|
121
124
|
stroke: "currentColor",
|
|
122
125
|
strokeWidth: "1.8"
|
|
123
126
|
})]
|
|
124
127
|
});
|
|
125
|
-
},
|
|
126
|
-
let
|
|
127
|
-
editor:
|
|
128
|
-
selector: ({ editor:
|
|
129
|
-
if (!
|
|
130
|
-
let
|
|
128
|
+
}, T = ({ editor: S }) => {
|
|
129
|
+
let T = h(null), [E, D] = g(null), [O, k] = g(!1), [A, j] = g(!1), M = m(() => b.every((e) => typeof S.commands[e] == "function"), [S]), N = m(() => typeof S.commands.setTableLayout == "function" && typeof S.commands.setTableHeightLimit == "function", [S]), P = m(() => typeof S.commands.setTableStickyHeaderRow == "function", [S]), F = m(() => typeof S.commands.setTableMaxHeight == "function", [S]), I = n({
|
|
130
|
+
editor: S,
|
|
131
|
+
selector: ({ editor: n }) => {
|
|
132
|
+
if (!M || n.isDestroyed) return x;
|
|
133
|
+
let r = a(n.state), i = n.can(), o = r ? t(r.node) : !1, s = r?.node.attrs.limitHeight === !0, c = r?.node.attrs.stickyHeaderRow === !0;
|
|
131
134
|
return {
|
|
132
|
-
canAddColumnAfter:
|
|
133
|
-
canAddColumnBefore:
|
|
134
|
-
canAddRowAfter:
|
|
135
|
-
canAddRowBefore:
|
|
136
|
-
canDeleteColumn:
|
|
137
|
-
canDeleteRow:
|
|
138
|
-
canDeleteTable:
|
|
139
|
-
canToggleHeaderRow:
|
|
140
|
-
hasHeaderRow:
|
|
135
|
+
canAddColumnAfter: i.addColumnAfter(),
|
|
136
|
+
canAddColumnBefore: i.addColumnBefore(),
|
|
137
|
+
canAddRowAfter: i.addRowAfter(),
|
|
138
|
+
canAddRowBefore: i.addRowBefore(),
|
|
139
|
+
canDeleteColumn: i.deleteColumn(),
|
|
140
|
+
canDeleteRow: i.deleteRow(),
|
|
141
|
+
canDeleteTable: i.deleteTable(),
|
|
142
|
+
canToggleHeaderRow: i.toggleHeaderRow(),
|
|
143
|
+
hasHeaderRow: o,
|
|
144
|
+
canSetTableLayout: N && i.setTableLayout("auto"),
|
|
145
|
+
canSetTableHeightLimit: N && i.setTableHeightLimit(!0),
|
|
146
|
+
canSetTableMaxHeight: n.isEditable && F && i.setTableMaxHeight(null),
|
|
147
|
+
canSetTableStickyHeaderRow: n.isEditable && P && o && i.setTableStickyHeaderRow(!c),
|
|
148
|
+
tableLayout: r?.node.attrs.tableLayout ?? "auto",
|
|
149
|
+
limitHeight: s,
|
|
150
|
+
maxHeight: e(r?.node.attrs.maxHeight),
|
|
151
|
+
stickyHeaderRow: c
|
|
141
152
|
};
|
|
142
153
|
}
|
|
143
|
-
}),
|
|
144
|
-
let i = r.hasFocus() || t.contains(t.ownerDocument.activeElement);
|
|
145
|
-
return
|
|
146
|
-
}, [
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
}), L = f(({ editor: e, element: t, state: n, view: r }) => {
|
|
155
|
+
let i = O || A || r.hasFocus() || t.contains(t.ownerDocument.activeElement);
|
|
156
|
+
return M && e.isEditable && i && s(n) === "table";
|
|
157
|
+
}, [
|
|
158
|
+
M,
|
|
159
|
+
O,
|
|
160
|
+
A
|
|
161
|
+
]), R = f(() => {
|
|
162
|
+
if (S.isDestroyed) return null;
|
|
163
|
+
let e = a(S.state);
|
|
149
164
|
if (!e) return null;
|
|
150
|
-
let t =
|
|
165
|
+
let t = S.view.nodeDOM(e.position);
|
|
151
166
|
return t instanceof HTMLElement ? t.closest(".tableWrapper") ?? t.querySelector(".tableWrapper") ?? t : null;
|
|
152
|
-
}, [
|
|
153
|
-
|
|
154
|
-
let e =
|
|
167
|
+
}, [S]), z = f(() => r(S), [S]);
|
|
168
|
+
p(() => {
|
|
169
|
+
let e = S.view.dom.ownerDocument.defaultView;
|
|
155
170
|
if (!e) return;
|
|
156
|
-
let t =
|
|
171
|
+
let t = C(S.view.dom), n = null, r = () => {
|
|
157
172
|
n === null && (n = e.requestAnimationFrame(() => {
|
|
158
|
-
n = null,
|
|
173
|
+
n = null, S.isDestroyed || S.view.dispatch(S.state.tr.setMeta(o, "updatePosition"));
|
|
159
174
|
}));
|
|
160
175
|
};
|
|
161
176
|
return t.forEach((e) => {
|
|
@@ -165,27 +180,27 @@ var g = [
|
|
|
165
180
|
e.removeEventListener("scroll", r);
|
|
166
181
|
});
|
|
167
182
|
};
|
|
168
|
-
}, [
|
|
169
|
-
let e =
|
|
183
|
+
}, [S]), p(() => {
|
|
184
|
+
let e = S.view.dom.closest("[data-scribe-root]"), t = S.view.dom.ownerDocument.defaultView;
|
|
170
185
|
if (!e || !t) return;
|
|
171
186
|
let n = () => {
|
|
172
187
|
let t = e.getBoundingClientRect().width;
|
|
173
|
-
|
|
188
|
+
D(t > 0 ? Math.max(t - 16, 0) : null);
|
|
174
189
|
};
|
|
175
190
|
if (n(), !t.ResizeObserver) return;
|
|
176
191
|
let r = new t.ResizeObserver(n);
|
|
177
192
|
return r.observe(e), () => r.disconnect();
|
|
178
|
-
}, [
|
|
179
|
-
let e =
|
|
180
|
-
if (e.key !== "F10" || !e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !
|
|
181
|
-
let t =
|
|
193
|
+
}, [S]), p(() => {
|
|
194
|
+
let e = S.view.dom, t = (e) => {
|
|
195
|
+
if (e.key !== "F10" || !e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !S.isEditable || s(S.state) !== "table") return;
|
|
196
|
+
let t = T.current?.querySelector("button:not(:disabled)");
|
|
182
197
|
t && (e.preventDefault(), t.focus());
|
|
183
198
|
};
|
|
184
199
|
return e.addEventListener("keydown", t, !0), () => e.removeEventListener("keydown", t, !0);
|
|
185
|
-
}, [
|
|
186
|
-
let
|
|
200
|
+
}, [S]);
|
|
201
|
+
let B = f((e) => {
|
|
187
202
|
if (e.key === "Escape") {
|
|
188
|
-
e.preventDefault(),
|
|
203
|
+
e.preventDefault(), S.chain().focus().run();
|
|
189
204
|
return;
|
|
190
205
|
}
|
|
191
206
|
if (![
|
|
@@ -198,109 +213,134 @@ var g = [
|
|
|
198
213
|
if (t.length === 0) return;
|
|
199
214
|
let n = e.currentTarget.ownerDocument.activeElement, r = t.findIndex((e) => e === n), i = r;
|
|
200
215
|
i = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : e.key === "ArrowLeft" ? r <= 0 ? t.length - 1 : r - 1 : r < 0 || r === t.length - 1 ? 0 : r + 1, e.preventDefault(), t[i]?.focus();
|
|
201
|
-
}, [
|
|
216
|
+
}, [S]), V = m(() => ({
|
|
202
217
|
strategy: "fixed",
|
|
203
218
|
placement: "top-start",
|
|
204
219
|
offset: 8,
|
|
205
220
|
flip: {},
|
|
206
221
|
shift: { padding: 8 }
|
|
207
|
-
}), []),
|
|
222
|
+
}), []), H = m(() => [
|
|
208
223
|
[
|
|
209
224
|
{
|
|
210
225
|
label: "Add row above",
|
|
211
|
-
command: () =>
|
|
212
|
-
disabled: !
|
|
213
|
-
icon: /* @__PURE__ */
|
|
226
|
+
command: () => S.chain().focus().addRowBefore().run(),
|
|
227
|
+
disabled: !I.canAddRowBefore,
|
|
228
|
+
icon: /* @__PURE__ */ v(w, { name: "add-row-above" })
|
|
214
229
|
},
|
|
215
230
|
{
|
|
216
231
|
label: "Add row below",
|
|
217
|
-
command: () =>
|
|
218
|
-
disabled: !
|
|
219
|
-
icon: /* @__PURE__ */
|
|
232
|
+
command: () => S.chain().focus().addRowAfter().run(),
|
|
233
|
+
disabled: !I.canAddRowAfter,
|
|
234
|
+
icon: /* @__PURE__ */ v(w, { name: "add-row-below" })
|
|
220
235
|
},
|
|
221
236
|
{
|
|
222
237
|
label: "Delete row",
|
|
223
|
-
command: () =>
|
|
224
|
-
disabled: !
|
|
225
|
-
icon: /* @__PURE__ */
|
|
238
|
+
command: () => S.chain().focus().deleteRow().run(),
|
|
239
|
+
disabled: !I.canDeleteRow,
|
|
240
|
+
icon: /* @__PURE__ */ v(w, { name: "delete-row" })
|
|
226
241
|
}
|
|
227
242
|
],
|
|
228
243
|
[
|
|
229
244
|
{
|
|
230
245
|
label: "Add column before",
|
|
231
|
-
command: () =>
|
|
232
|
-
disabled: !
|
|
233
|
-
icon: /* @__PURE__ */
|
|
246
|
+
command: () => S.chain().focus().addColumnBefore().run(),
|
|
247
|
+
disabled: !I.canAddColumnBefore,
|
|
248
|
+
icon: /* @__PURE__ */ v(w, { name: "add-column-before" })
|
|
234
249
|
},
|
|
235
250
|
{
|
|
236
251
|
label: "Add column after",
|
|
237
|
-
command: () =>
|
|
238
|
-
disabled: !
|
|
239
|
-
icon: /* @__PURE__ */
|
|
252
|
+
command: () => S.chain().focus().addColumnAfter().run(),
|
|
253
|
+
disabled: !I.canAddColumnAfter,
|
|
254
|
+
icon: /* @__PURE__ */ v(w, { name: "add-column-after" })
|
|
240
255
|
},
|
|
241
256
|
{
|
|
242
257
|
label: "Delete column",
|
|
243
|
-
command: () =>
|
|
244
|
-
disabled: !
|
|
245
|
-
icon: /* @__PURE__ */
|
|
258
|
+
command: () => S.chain().focus().deleteColumn().run(),
|
|
259
|
+
disabled: !I.canDeleteColumn,
|
|
260
|
+
icon: /* @__PURE__ */ v(w, { name: "delete-column" })
|
|
246
261
|
}
|
|
247
262
|
],
|
|
248
263
|
[{
|
|
249
264
|
label: "Toggle header row",
|
|
250
|
-
command: () =>
|
|
251
|
-
disabled: !
|
|
252
|
-
icon: /* @__PURE__ */
|
|
253
|
-
ariaPressed:
|
|
265
|
+
command: () => S.chain().focus().toggleHeaderRow().run(),
|
|
266
|
+
disabled: !I.canToggleHeaderRow,
|
|
267
|
+
icon: /* @__PURE__ */ v(w, { name: "toggle-header-row" }),
|
|
268
|
+
ariaPressed: I.hasHeaderRow
|
|
254
269
|
}],
|
|
255
270
|
[{
|
|
256
271
|
label: "Delete table",
|
|
257
|
-
command: () =>
|
|
258
|
-
disabled: !
|
|
259
|
-
icon: /* @__PURE__ */
|
|
272
|
+
command: () => S.chain().focus().deleteTable().run(),
|
|
273
|
+
disabled: !I.canDeleteTable,
|
|
274
|
+
icon: /* @__PURE__ */ v(w, { name: "delete-table" })
|
|
260
275
|
}]
|
|
261
|
-
], [
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
-
editor:
|
|
264
|
-
pluginKey:
|
|
276
|
+
], [S, I]);
|
|
277
|
+
return /* @__PURE__ */ v(i, {
|
|
278
|
+
editor: S,
|
|
279
|
+
pluginKey: o,
|
|
265
280
|
updateDelay: 0,
|
|
266
281
|
resizeDelay: 0,
|
|
267
|
-
appendTo:
|
|
268
|
-
shouldShow:
|
|
269
|
-
getReferencedVirtualElement:
|
|
270
|
-
options:
|
|
271
|
-
children: /* @__PURE__ */
|
|
272
|
-
ref:
|
|
282
|
+
appendTo: z,
|
|
283
|
+
shouldShow: L,
|
|
284
|
+
getReferencedVirtualElement: R,
|
|
285
|
+
options: V,
|
|
286
|
+
children: /* @__PURE__ */ v(l, {
|
|
287
|
+
ref: T,
|
|
273
288
|
className: "scribe-table-bubble-menu",
|
|
274
289
|
role: "toolbar",
|
|
275
290
|
"aria-label": "Table controls",
|
|
276
291
|
"aria-keyshortcuts": "Alt+F10",
|
|
277
292
|
align: "center",
|
|
278
293
|
gap: "2",
|
|
279
|
-
onKeyDown:
|
|
280
|
-
style:
|
|
281
|
-
children:
|
|
294
|
+
onKeyDown: B,
|
|
295
|
+
style: E === null ? void 0 : { maxWidth: E },
|
|
296
|
+
children: H.map((e, t) => /* @__PURE__ */ y(l, {
|
|
282
297
|
align: "center",
|
|
283
298
|
gap: "1",
|
|
284
|
-
children: [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
children: [
|
|
300
|
+
t > 0 ? /* @__PURE__ */ v(d, {
|
|
301
|
+
orientation: "vertical",
|
|
302
|
+
decorative: !0,
|
|
303
|
+
style: { height: 20 }
|
|
304
|
+
}) : null,
|
|
305
|
+
t === H.length - 1 && N ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(c, {
|
|
306
|
+
editor: S,
|
|
307
|
+
layout: I.tableLayout,
|
|
308
|
+
limitHeight: I.limitHeight,
|
|
309
|
+
maxHeight: I.maxHeight,
|
|
310
|
+
stickyHeaderRow: I.stickyHeaderRow,
|
|
311
|
+
hasHeaderRow: I.hasHeaderRow,
|
|
312
|
+
canSetLayout: I.canSetTableLayout,
|
|
313
|
+
canSetHeightLimit: I.canSetTableHeightLimit,
|
|
314
|
+
hasMaxHeightCommand: F,
|
|
315
|
+
canSetMaxHeight: I.canSetTableMaxHeight,
|
|
316
|
+
hasStickyHeaderCommand: P,
|
|
317
|
+
canSetStickyHeaderRow: I.canSetTableStickyHeaderRow,
|
|
318
|
+
open: O,
|
|
319
|
+
onOpenChange: k,
|
|
320
|
+
heightSettingsOpen: A,
|
|
321
|
+
onHeightSettingsOpenChange: j
|
|
322
|
+
}), /* @__PURE__ */ v(d, {
|
|
323
|
+
orientation: "vertical",
|
|
324
|
+
decorative: !0,
|
|
325
|
+
style: { height: 20 }
|
|
326
|
+
})] }) : null,
|
|
327
|
+
e.map((e) => /* @__PURE__ */ v(u, {
|
|
328
|
+
type: "button",
|
|
329
|
+
size: "1",
|
|
330
|
+
radius: "medium",
|
|
331
|
+
color: e.label === "Delete table" ? "red" : "gray",
|
|
332
|
+
variant: e.ariaPressed ? "soft" : "ghost",
|
|
333
|
+
"aria-label": e.label,
|
|
334
|
+
"aria-pressed": e.ariaPressed,
|
|
335
|
+
disabled: e.disabled,
|
|
336
|
+
title: e.label,
|
|
337
|
+
onClick: e.command,
|
|
338
|
+
children: e.icon
|
|
339
|
+
}, e.label))
|
|
340
|
+
]
|
|
301
341
|
}, e[0]?.label))
|
|
302
342
|
})
|
|
303
343
|
});
|
|
304
344
|
};
|
|
305
345
|
//#endregion
|
|
306
|
-
export {
|
|
346
|
+
export { T as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
interface TableHeightSettingsProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
maxHeight: number | null;
|
|
6
|
+
canSetMaxHeight: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const TableHeightSettings: FC<TableHeightSettingsProps>;
|
|
10
|
+
export default TableHeightSettings;
|
|
11
|
+
//# sourceMappingURL=TableHeightSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHeightSettings.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/TableHeightSettings.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,EAAE,EAA+C,MAAM,OAAO,CAAC;AASxE,UAAU,wBAAwB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAqNrD,CAAC;eAEa,mBAAmB"}
|