@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.
- package/README.md +11 -1
- package/dist/{BarMenu-5S2vKAtc.js → BarMenu-5M9g9Y1j.js} +7 -5
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.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.d.ts +8 -0
- package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -0
- package/dist/components/Menu/TableBubbleMenu.js +305 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.d.ts +11 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.d.ts.map +1 -0
- package/dist/components/Menu/tableBubbleMenuPlugin.js +22 -0
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- 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/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.d.ts +8 -0
- package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -0
- package/dist/components/Scribe/extension/resizable-table.js +2 -0
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +1390 -1390
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/items.js +27 -0
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts +2 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +133 -128
- package/dist/{dist-DErUltkU.js → dist-DFua_Xbu.js} +37 -31
- package/dist/{dist-wYqYXEOz.js → dist-Dw4STOPE.js} +1 -1
- package/dist/{extension-6I5t1ZxQ.js → extension-Dy6hHSvD.js} +1324 -1783
- package/dist/{extension-link-DJy7XDoj.js → extension-link-CjfUZ90W.js} +1 -1
- package/dist/{html-to-markdown-Cta7-ssO.js → html-to-markdown-B6Uhn7ok.js} +112 -54
- package/dist/main.css +52 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-DwSNqq2i.js → markdown-to-html-WmeDaJXP.js} +73 -60
- package/dist/{menus-m_EkiaUN.js → menus-_EXlLMjz.js} +2 -2
- package/dist/{purify.es-CFiLaBu1.js → purify.es-BES4pJF7.js} +267 -260
- package/dist/resizable-table-Ddw3l6DJ.js +489 -0
- package/dist/{slashCommand-DuSH9sXJ.js → slashCommand-CxX07Nbk.js} +24 -22
- 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 +4 -4
- package/dist/utils/markdown-to-html.d.ts.map +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ A versatile, block-based rich text editor for diverse applications, built with T
|
|
|
10
10
|
- **Block-based Editing:** Enjoy a familiar and intuitive Notion-style editing experience.
|
|
11
11
|
- **Markdown Support:** Parse and render Markdown content effortlessly.
|
|
12
12
|
- **Markdown Paste:** Paste plain-text markdown into the editor and have it converted into rich content automatically.
|
|
13
|
+
- **Table Authoring:** Insert, resize, and edit tables with controls that stay next to the active table.
|
|
13
14
|
- **Versatile Integration:** Easily integrate `@clevertask/scribe` into any project requiring rich text editing.
|
|
14
15
|
- **View and Edit:** Seamlessly switch between viewing and editing modes.
|
|
15
16
|
- **Experimental Table of Contents:** Subscribe to heading changes and render an app-owned table of contents outside the editor.
|
|
@@ -19,6 +20,7 @@ A versatile, block-based rich text editor for diverse applications, built with T
|
|
|
19
20
|
- [@clevertask/scribe](#clevertaskscribe)
|
|
20
21
|
- [Installation](#installation)
|
|
21
22
|
- [Usage](#usage)
|
|
23
|
+
- [Table Authoring](#table-authoring)
|
|
22
24
|
- [Experimental Table of Contents](#experimental-table-of-contents)
|
|
23
25
|
- [Math Expressions](#math-expressions)
|
|
24
26
|
- [Props](#props)
|
|
@@ -109,6 +111,14 @@ function App() {
|
|
|
109
111
|
}
|
|
110
112
|
```
|
|
111
113
|
|
|
114
|
+
## Table Authoring
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
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.
|
|
119
|
+
|
|
120
|
+
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.
|
|
121
|
+
|
|
112
122
|
## Experimental Table of Contents
|
|
113
123
|
|
|
114
124
|
Scribe can expose table-of-contents data without rendering a table-of-contents block inside the editable document. Enable the experimental API with `enableTableOfContents`, keep the latest items in your app state, and call `scrollToTableOfContentsItem` when a user selects an entry.
|
|
@@ -190,7 +200,7 @@ If your content arrives as HTML (for example from a server), use the helper belo
|
|
|
190
200
|
| `editable` | `boolean` | `true` | Controls whether the editor is editable. |
|
|
191
201
|
| `autoFocus` | `boolean` | `false` | Controls whether the editor should automatically focus when mounted. |
|
|
192
202
|
| `extensions` | `Extension[]` | `undefined` | You can set your own extensions for the text editor. For more information, [check the tip tap extensions docs](https://tiptap.dev/docs/editor/core-concepts/extensions) |
|
|
193
|
-
| `externalEditor` | `Editor` | `undefined` | Uses a caller-owned Tiptap editor.
|
|
203
|
+
| `externalEditor` | `Editor` | `undefined` | Uses a caller-owned Tiptap editor. The caller remains responsible for its extension and plugin lifecycle, including table resizing, and for destroying it. |
|
|
194
204
|
| `editorProps` | `EditorProps` | `undefined` | A tiptap-based prop to handle advanced use cases, you can read about it on their [documentation](https://tiptap.dev/docs/editor/api/editor#editorprops) |
|
|
195
205
|
| `showBarMenu` | `boolean` | `true` | Determines whether to show the text editor top menu bar or not. This menu bar shows options to format the text |
|
|
196
206
|
| `placeholderText` | `string` | `Type "/" for commands...` | Change the initial placeholder for your text editor |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e } from "./dist-
|
|
1
|
+
import { a as e } from "./dist-Dw4STOPE.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";
|
|
@@ -10,10 +10,12 @@ import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
|
10
10
|
function k(e) {
|
|
11
11
|
var t, n, r = "";
|
|
12
12
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
13
|
-
else if (typeof e == "object")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
else if (typeof e == "object") {
|
|
14
|
+
if (Array.isArray(e)) {
|
|
15
|
+
var i = e.length;
|
|
16
|
+
for (t = 0; t < i; t++) e[t] && (n = k(e[t])) && (r && (r += " "), r += n);
|
|
17
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
18
|
+
}
|
|
17
19
|
return r;
|
|
18
20
|
}
|
|
19
21
|
function A() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../BarMenu-
|
|
1
|
+
import { t as e } from "../../BarMenu-5M9g9Y1j.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e } from "../../dist-
|
|
1
|
+
import { a as e } from "../../dist-Dw4STOPE.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
|
-
import { t as n } from "../../menus-
|
|
3
|
+
import { t as n } from "../../menus-_EXlLMjz.js";
|
|
4
4
|
import { Flex as r, IconButton as i } from "@radix-ui/themes";
|
|
5
5
|
import { useCallback as a } from "react";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as e } from "../../dist-
|
|
1
|
+
import { a as e } from "../../dist-Dw4STOPE.js";
|
|
2
2
|
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
3
|
import n from "./LinkEditor.js";
|
|
4
4
|
import { hideLinkBubbleMenu as r, linkBubbleMenuPluginKey as i, showLinkBubbleMenu as a } from "./linkBubbleMenuPlugin.js";
|
|
5
|
-
import { t as o } from "../../menus-
|
|
5
|
+
import { t as o } from "../../menus-_EXlLMjz.js";
|
|
6
6
|
import { Box as s } from "@radix-ui/themes";
|
|
7
7
|
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
8
8
|
import { jsx as p } from "react/jsx-runtime";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
export interface TableBubbleMenuProps {
|
|
4
|
+
editor: Editor;
|
|
5
|
+
}
|
|
6
|
+
declare const TableBubbleMenu: FC<TableBubbleMenuProps>;
|
|
7
|
+
export default TableBubbleMenu;
|
|
8
|
+
//# sourceMappingURL=TableBubbleMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableBubbleMenu.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/TableBubbleMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAkB,MAAM,eAAe,CAAC;AAKvD,OAAO,EACL,EAAE,EAQH,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAkKD,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAiV7C,CAAC;eAEa,eAAe"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { a as e } from "../../dist-Dw4STOPE.js";
|
|
2
|
+
import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
|
|
3
|
+
import { t as n } from "../../menus-_EXlLMjz.js";
|
|
4
|
+
import { getSelectionTableContext as r, tableBubbleMenuPluginKey as i } from "./tableBubbleMenuPlugin.js";
|
|
5
|
+
import { Flex as a, IconButton as o, Separator as s } from "@radix-ui/themes";
|
|
6
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
//#region lib/components/Menu/TableBubbleMenu.tsx
|
|
9
|
+
var h = [
|
|
10
|
+
"addColumnAfter",
|
|
11
|
+
"addColumnBefore",
|
|
12
|
+
"addRowAfter",
|
|
13
|
+
"addRowBefore",
|
|
14
|
+
"deleteColumn",
|
|
15
|
+
"deleteRow",
|
|
16
|
+
"deleteTable",
|
|
17
|
+
"toggleHeaderRow"
|
|
18
|
+
], g = {
|
|
19
|
+
canAddColumnAfter: !1,
|
|
20
|
+
canAddColumnBefore: !1,
|
|
21
|
+
canAddRowAfter: !1,
|
|
22
|
+
canAddRowBefore: !1,
|
|
23
|
+
canDeleteColumn: !1,
|
|
24
|
+
canDeleteRow: !1,
|
|
25
|
+
canDeleteTable: !1,
|
|
26
|
+
canToggleHeaderRow: !1,
|
|
27
|
+
hasHeaderRow: !1
|
|
28
|
+
}, _ = /auto|overlay|scroll/, v = (e) => {
|
|
29
|
+
let t = e.ownerDocument.defaultView;
|
|
30
|
+
if (!t) return [];
|
|
31
|
+
let n = [], r = e.parentElement;
|
|
32
|
+
for (; r && r !== e.ownerDocument.body && r !== e.ownerDocument.documentElement;) {
|
|
33
|
+
let e = t.getComputedStyle(r);
|
|
34
|
+
_.test(`${e.overflow} ${e.overflowX} ${e.overflowY}`) && n.push(r), r = r.parentElement;
|
|
35
|
+
}
|
|
36
|
+
return n;
|
|
37
|
+
}, y = (e) => {
|
|
38
|
+
let t = e.firstChild;
|
|
39
|
+
if (!t || t.childCount === 0) return !1;
|
|
40
|
+
let n = !0;
|
|
41
|
+
return t.forEach((e) => {
|
|
42
|
+
e.type.name !== "tableHeader" && (n = !1);
|
|
43
|
+
}), n;
|
|
44
|
+
}, b = ({ name: e }) => {
|
|
45
|
+
let t = {
|
|
46
|
+
"aria-hidden": !0,
|
|
47
|
+
fill: "none",
|
|
48
|
+
height: 18,
|
|
49
|
+
viewBox: "0 0 20 20",
|
|
50
|
+
width: 18
|
|
51
|
+
}, n = {
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeLinecap: "round",
|
|
54
|
+
strokeLinejoin: "round",
|
|
55
|
+
strokeWidth: 1.35
|
|
56
|
+
};
|
|
57
|
+
if (e === "add-row-above" || e === "add-row-below") {
|
|
58
|
+
let r = e === "add-row-above" ? 3.5 : 16.5;
|
|
59
|
+
return /* @__PURE__ */ m("svg", {
|
|
60
|
+
...t,
|
|
61
|
+
children: [/* @__PURE__ */ p("path", {
|
|
62
|
+
d: "M3.5 6.5h13v7h-13zM3.5 10h13M10 6.5v7",
|
|
63
|
+
...n
|
|
64
|
+
}), /* @__PURE__ */ p("path", {
|
|
65
|
+
d: `M7.75 ${r}h4.5M10 ${r - 2.25}v4.5`,
|
|
66
|
+
...n
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (e === "add-column-before" || e === "add-column-after") {
|
|
71
|
+
let r = e === "add-column-before" ? 3.5 : 16.5;
|
|
72
|
+
return /* @__PURE__ */ m("svg", {
|
|
73
|
+
...t,
|
|
74
|
+
children: [/* @__PURE__ */ p("path", {
|
|
75
|
+
d: "M6.5 3.5h7v13h-7zM10 3.5v13M6.5 10h7",
|
|
76
|
+
...n
|
|
77
|
+
}), /* @__PURE__ */ p("path", {
|
|
78
|
+
d: `M${r - 2.25} 10h4.5M${r} 7.75v4.5`,
|
|
79
|
+
...n
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return e === "delete-row" ? /* @__PURE__ */ m("svg", {
|
|
84
|
+
...t,
|
|
85
|
+
children: [/* @__PURE__ */ p("path", {
|
|
86
|
+
d: "M3.5 4h13v12h-13zM3.5 8h13M3.5 12h13M10 4v12",
|
|
87
|
+
...n
|
|
88
|
+
}), /* @__PURE__ */ p("path", {
|
|
89
|
+
d: "M6.75 10h6.5",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
strokeWidth: "2.2"
|
|
92
|
+
})]
|
|
93
|
+
}) : e === "delete-column" ? /* @__PURE__ */ m("svg", {
|
|
94
|
+
...t,
|
|
95
|
+
children: [/* @__PURE__ */ p("path", {
|
|
96
|
+
d: "M4 3.5h12v13h-12zM8 3.5v13M12 3.5v13M4 10h12",
|
|
97
|
+
...n
|
|
98
|
+
}), /* @__PURE__ */ p("path", {
|
|
99
|
+
d: "M10 6.75v6.5",
|
|
100
|
+
stroke: "currentColor",
|
|
101
|
+
strokeWidth: "2.2"
|
|
102
|
+
})]
|
|
103
|
+
}) : e === "toggle-header-row" ? /* @__PURE__ */ m("svg", {
|
|
104
|
+
...t,
|
|
105
|
+
children: [/* @__PURE__ */ p("path", {
|
|
106
|
+
d: "M3.5 4h13v12h-13zM3.5 8h13M10 4v12",
|
|
107
|
+
...n
|
|
108
|
+
}), /* @__PURE__ */ p("path", {
|
|
109
|
+
d: "M4.2 4.7h11.6v2.6H4.2z",
|
|
110
|
+
fill: "currentColor",
|
|
111
|
+
opacity: "0.45"
|
|
112
|
+
})]
|
|
113
|
+
}) : /* @__PURE__ */ m("svg", {
|
|
114
|
+
...t,
|
|
115
|
+
children: [/* @__PURE__ */ p("path", {
|
|
116
|
+
d: "M3.5 4h13v12h-13zM3.5 8h13M10 4v12",
|
|
117
|
+
...n
|
|
118
|
+
}), /* @__PURE__ */ p("path", {
|
|
119
|
+
d: "m6.75 7 6.5 6.5m0-6.5-6.5 6.5",
|
|
120
|
+
stroke: "currentColor",
|
|
121
|
+
strokeWidth: "1.8"
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
}, x = ({ editor: _ }) => {
|
|
125
|
+
let x = d(null), [S, C] = f(null), w = u(() => h.every((e) => typeof _.commands[e] == "function"), [_]), T = e({
|
|
126
|
+
editor: _,
|
|
127
|
+
selector: ({ editor: e }) => {
|
|
128
|
+
if (!w) return g;
|
|
129
|
+
let t = r(e.state), n = e.can();
|
|
130
|
+
return {
|
|
131
|
+
canAddColumnAfter: n.addColumnAfter(),
|
|
132
|
+
canAddColumnBefore: n.addColumnBefore(),
|
|
133
|
+
canAddRowAfter: n.addRowAfter(),
|
|
134
|
+
canAddRowBefore: n.addRowBefore(),
|
|
135
|
+
canDeleteColumn: n.deleteColumn(),
|
|
136
|
+
canDeleteRow: n.deleteRow(),
|
|
137
|
+
canDeleteTable: n.deleteTable(),
|
|
138
|
+
canToggleHeaderRow: n.toggleHeaderRow(),
|
|
139
|
+
hasHeaderRow: t ? y(t.node) : !1
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}), E = c(({ editor: e, element: t, state: n, view: i }) => {
|
|
143
|
+
let a = i.hasFocus() || t.contains(t.ownerDocument.activeElement);
|
|
144
|
+
return w && e.isEditable && a && r(n) !== null;
|
|
145
|
+
}, [w]), D = c(() => {
|
|
146
|
+
if (_.isDestroyed) return null;
|
|
147
|
+
let e = r(_.state);
|
|
148
|
+
if (!e) return null;
|
|
149
|
+
let t = _.view.nodeDOM(e.position);
|
|
150
|
+
return t instanceof HTMLElement ? t.closest(".tableWrapper") ?? t.querySelector(".tableWrapper") ?? t : null;
|
|
151
|
+
}, [_]), O = c(() => t(_), [_]);
|
|
152
|
+
l(() => {
|
|
153
|
+
let e = _.view.dom.ownerDocument.defaultView;
|
|
154
|
+
if (!e) return;
|
|
155
|
+
let t = v(_.view.dom), n = null, r = () => {
|
|
156
|
+
n === null && (n = e.requestAnimationFrame(() => {
|
|
157
|
+
n = null, _.isDestroyed || _.view.dispatch(_.state.tr.setMeta(i, "updatePosition"));
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
160
|
+
return t.forEach((e) => {
|
|
161
|
+
e.addEventListener("scroll", r, { passive: !0 });
|
|
162
|
+
}), () => {
|
|
163
|
+
n !== null && e.cancelAnimationFrame(n), t.forEach((e) => {
|
|
164
|
+
e.removeEventListener("scroll", r);
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
}, [_]), l(() => {
|
|
168
|
+
let e = _.view.dom.closest("[data-scribe-root]"), t = _.view.dom.ownerDocument.defaultView;
|
|
169
|
+
if (!e || !t) return;
|
|
170
|
+
let n = () => {
|
|
171
|
+
let t = e.getBoundingClientRect().width;
|
|
172
|
+
C(t > 0 ? Math.max(t - 16, 0) : null);
|
|
173
|
+
};
|
|
174
|
+
if (n(), !t.ResizeObserver) return;
|
|
175
|
+
let r = new t.ResizeObserver(n);
|
|
176
|
+
return r.observe(e), () => r.disconnect();
|
|
177
|
+
}, [_]), l(() => {
|
|
178
|
+
let e = _.view.dom, t = (e) => {
|
|
179
|
+
if (e.key !== "F10" || !e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !_.isEditable || !r(_.state)) return;
|
|
180
|
+
let t = x.current?.querySelector("button:not(:disabled)");
|
|
181
|
+
t && (e.preventDefault(), t.focus());
|
|
182
|
+
};
|
|
183
|
+
return e.addEventListener("keydown", t, !0), () => e.removeEventListener("keydown", t, !0);
|
|
184
|
+
}, [_]);
|
|
185
|
+
let k = c((e) => {
|
|
186
|
+
if (e.key === "Escape") {
|
|
187
|
+
e.preventDefault(), _.chain().focus().run();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (![
|
|
191
|
+
"ArrowLeft",
|
|
192
|
+
"ArrowRight",
|
|
193
|
+
"Home",
|
|
194
|
+
"End"
|
|
195
|
+
].includes(e.key)) return;
|
|
196
|
+
let t = Array.from(e.currentTarget.querySelectorAll("button:not(:disabled)"));
|
|
197
|
+
if (t.length === 0) return;
|
|
198
|
+
let n = e.currentTarget.ownerDocument.activeElement, r = t.findIndex((e) => e === n), i = r;
|
|
199
|
+
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();
|
|
200
|
+
}, [_]), A = u(() => ({
|
|
201
|
+
strategy: "fixed",
|
|
202
|
+
placement: "top-start",
|
|
203
|
+
offset: 8,
|
|
204
|
+
flip: {},
|
|
205
|
+
shift: { padding: 8 }
|
|
206
|
+
}), []), j = u(() => [
|
|
207
|
+
[
|
|
208
|
+
{
|
|
209
|
+
label: "Add row above",
|
|
210
|
+
command: () => _.chain().focus().addRowBefore().run(),
|
|
211
|
+
disabled: !T.canAddRowBefore,
|
|
212
|
+
icon: /* @__PURE__ */ p(b, { name: "add-row-above" })
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: "Add row below",
|
|
216
|
+
command: () => _.chain().focus().addRowAfter().run(),
|
|
217
|
+
disabled: !T.canAddRowAfter,
|
|
218
|
+
icon: /* @__PURE__ */ p(b, { name: "add-row-below" })
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
label: "Delete row",
|
|
222
|
+
command: () => _.chain().focus().deleteRow().run(),
|
|
223
|
+
disabled: !T.canDeleteRow,
|
|
224
|
+
icon: /* @__PURE__ */ p(b, { name: "delete-row" })
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
{
|
|
229
|
+
label: "Add column before",
|
|
230
|
+
command: () => _.chain().focus().addColumnBefore().run(),
|
|
231
|
+
disabled: !T.canAddColumnBefore,
|
|
232
|
+
icon: /* @__PURE__ */ p(b, { name: "add-column-before" })
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: "Add column after",
|
|
236
|
+
command: () => _.chain().focus().addColumnAfter().run(),
|
|
237
|
+
disabled: !T.canAddColumnAfter,
|
|
238
|
+
icon: /* @__PURE__ */ p(b, { name: "add-column-after" })
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
label: "Delete column",
|
|
242
|
+
command: () => _.chain().focus().deleteColumn().run(),
|
|
243
|
+
disabled: !T.canDeleteColumn,
|
|
244
|
+
icon: /* @__PURE__ */ p(b, { name: "delete-column" })
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
[{
|
|
248
|
+
label: "Toggle header row",
|
|
249
|
+
command: () => _.chain().focus().toggleHeaderRow().run(),
|
|
250
|
+
disabled: !T.canToggleHeaderRow,
|
|
251
|
+
icon: /* @__PURE__ */ p(b, { name: "toggle-header-row" }),
|
|
252
|
+
ariaPressed: T.hasHeaderRow
|
|
253
|
+
}],
|
|
254
|
+
[{
|
|
255
|
+
label: "Delete table",
|
|
256
|
+
command: () => _.chain().focus().deleteTable().run(),
|
|
257
|
+
disabled: !T.canDeleteTable,
|
|
258
|
+
icon: /* @__PURE__ */ p(b, { name: "delete-table" })
|
|
259
|
+
}]
|
|
260
|
+
], [_, T]);
|
|
261
|
+
return /* @__PURE__ */ p(n, {
|
|
262
|
+
editor: _,
|
|
263
|
+
pluginKey: i,
|
|
264
|
+
updateDelay: 0,
|
|
265
|
+
resizeDelay: 0,
|
|
266
|
+
appendTo: O,
|
|
267
|
+
shouldShow: E,
|
|
268
|
+
getReferencedVirtualElement: D,
|
|
269
|
+
options: A,
|
|
270
|
+
children: /* @__PURE__ */ p(a, {
|
|
271
|
+
ref: x,
|
|
272
|
+
className: "scribe-table-bubble-menu",
|
|
273
|
+
role: "toolbar",
|
|
274
|
+
"aria-label": "Table controls",
|
|
275
|
+
"aria-keyshortcuts": "Alt+F10",
|
|
276
|
+
align: "center",
|
|
277
|
+
gap: "2",
|
|
278
|
+
onKeyDown: k,
|
|
279
|
+
style: S === null ? void 0 : { maxWidth: S },
|
|
280
|
+
children: j.map((e, t) => /* @__PURE__ */ m(a, {
|
|
281
|
+
align: "center",
|
|
282
|
+
gap: "1",
|
|
283
|
+
children: [t > 0 ? /* @__PURE__ */ p(s, {
|
|
284
|
+
orientation: "vertical",
|
|
285
|
+
decorative: !0,
|
|
286
|
+
style: { height: 20 }
|
|
287
|
+
}) : null, e.map((e) => /* @__PURE__ */ p(o, {
|
|
288
|
+
type: "button",
|
|
289
|
+
size: "1",
|
|
290
|
+
radius: "medium",
|
|
291
|
+
color: e.label === "Delete table" ? "red" : "gray",
|
|
292
|
+
variant: e.ariaPressed ? "soft" : "ghost",
|
|
293
|
+
"aria-label": e.label,
|
|
294
|
+
"aria-pressed": e.ariaPressed,
|
|
295
|
+
disabled: e.disabled,
|
|
296
|
+
title: e.label,
|
|
297
|
+
onClick: e.command,
|
|
298
|
+
children: e.icon
|
|
299
|
+
}, e.label))]
|
|
300
|
+
}, e[0]?.label))
|
|
301
|
+
})
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
//#endregion
|
|
305
|
+
export { x as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
|
|
2
|
+
import type { EditorState } from "@tiptap/pm/state";
|
|
3
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
4
|
+
interface TableContext {
|
|
5
|
+
node: ProseMirrorNode;
|
|
6
|
+
position: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const tableBubbleMenuPluginKey: PluginKey<any>;
|
|
9
|
+
export declare const getSelectionTableContext: (state: EditorState) => TableContext | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tableBubbleMenuPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableBubbleMenuPlugin.d.ts","sourceRoot":"","sources":["../../../lib/components/Menu/tableBubbleMenuPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAe,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5D,UAAU,YAAY;IACpB,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,gBAAyC,CAAC;AAiB/E,eAAO,MAAM,wBAAwB,UAAW,WAAW,KAAG,YAAY,GAAG,IAkB5E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeSelection as e, PluginKey as t } from "@tiptap/pm/state";
|
|
2
|
+
//#region lib/components/Menu/tableBubbleMenuPlugin.ts
|
|
3
|
+
var n = new t("scribeTableBubbleMenu"), r = (e) => {
|
|
4
|
+
for (let t = e.depth; t > 0; --t) {
|
|
5
|
+
let n = e.node(t);
|
|
6
|
+
if (n.type.name === "table") return {
|
|
7
|
+
node: n,
|
|
8
|
+
position: e.before(t)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}, i = (t) => {
|
|
13
|
+
let { selection: n } = t;
|
|
14
|
+
if (n instanceof e && n.node.type.name === "table") return {
|
|
15
|
+
node: n.node,
|
|
16
|
+
position: n.from
|
|
17
|
+
};
|
|
18
|
+
let i = r(n.$from), a = r(n.$to);
|
|
19
|
+
return !i || !a || i.position !== a.position ? null : i;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as getSelectionTableContext, n as tableBubbleMenuPluginKey };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "../../../../dist-
|
|
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 { EmojiList as r } from "./EmojiList.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../extension-link-
|
|
1
|
+
import { t as e } from "../../../extension-link-CjfUZ90W.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as e } from "../../../dist-
|
|
2
|
-
import { n as t, t as n } from "../../../markdown-to-html-
|
|
1
|
+
import { n as e } from "../../../dist-DFua_Xbu.js";
|
|
2
|
+
import { n as t, t as n } from "../../../markdown-to-html-WmeDaJXP.js";
|
|
3
3
|
import { Plugin as r, PluginKey as i } from "@tiptap/pm/state";
|
|
4
4
|
//#region lib/components/Scribe/extension/extension-markdown-paste.ts
|
|
5
5
|
var a = new i("markdownPaste"), o = /* @__PURE__ */ new Set([
|
|
@@ -16,5 +16,5 @@ export declare const initExtensions: (props: ScribeProps) => (import("@tiptap/co
|
|
|
16
16
|
updateScrollParent: () => void;
|
|
17
17
|
}> | import("@tiptap/core").Extension<{
|
|
18
18
|
slashSuggestion: Partial<import("@tiptap/suggestion").SuggestionOptions<import("./slashCommand").SuggestionItem, import("./slashCommand").SuggestionItem>>;
|
|
19
|
-
}, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
|
|
19
|
+
}, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-item").TaskItemOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-task-list").TaskListOptions, any>)[];
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAsBtC,eAAO,MAAM,cAAc,UAAW,WAAW;;;;;;;;;;;;;;;;;o6BAwFhD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../extension-
|
|
1
|
+
import { t as e } from "../../../extension-Dy6hHSvD.js";
|
|
2
2
|
export { e as initExtensions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiptap only registers its column-resizing plugin when the editor is editable
|
|
3
|
+
* during extension initialization. Scribe can become editable after mount, so
|
|
4
|
+
* register the plugin for the editor lifetime and let its event handlers honor
|
|
5
|
+
* the current `view.editable` value.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ScribeTable: import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any>;
|
|
8
|
+
//# sourceMappingURL=resizable-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizable-table.d.ts","sourceRoot":"","sources":["../../../../lib/components/Scribe/extension/resizable-table.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kFAoCtB,CAAC"}
|