art-bd-ui 1.0.37 → 1.0.39
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/dist/cjs/_virtual/index5.js +2 -8
- package/dist/cjs/_virtual/index6.js +4 -4
- package/dist/cjs/_virtual/index7.js +8 -2
- package/dist/cjs/components/quiz/runner/question/question.js +9 -2
- package/dist/cjs/components/ui/rich-editor/bubble-menus/code-block-bubble-menu.js +21 -8
- package/dist/cjs/components/ui/rich-editor/extensions/carousel/extension.js +5 -0
- package/dist/cjs/components/ui/rich-editor/extensions/carousel/view.js +2 -1
- package/dist/cjs/components/ui/rich-editor/extensions/code-block/index.js +26 -0
- package/dist/cjs/components/ui/rich-editor/extensions/code-block/lowlight-base.js +108 -0
- package/dist/cjs/components/ui/rich-editor/extensions/code-block/node-view.js +63 -0
- package/dist/cjs/components/ui/rich-editor/extensions/code-block/utils.js +159 -0
- package/dist/cjs/components/ui/rich-editor/extensions/columns/extension.js +243 -0
- package/dist/cjs/components/ui/rich-editor/extensions/columns/node-view.js +12 -0
- package/dist/cjs/components/ui/rich-editor/extensions/columns/utils.js +76 -0
- package/dist/cjs/components/ui/rich-editor/extensions/columns.js +4 -10
- package/dist/cjs/components/ui/rich-editor/extensions/table/kit.js +58 -0
- package/dist/cjs/components/ui/rich-editor/extensions/table/table-cell.js +20 -0
- package/dist/cjs/components/ui/rich-editor/extensions/table/table-floating-controls.js +20 -4
- package/dist/cjs/components/ui/rich-editor/extensions/table/table-header.js +20 -0
- package/dist/cjs/components/ui/rich-editor/extensions/table/table-row.js +14 -0
- package/dist/cjs/components/ui/rich-editor/extensions/table/table.js +22 -0
- package/dist/cjs/components/ui/rich-editor/extensions.js +28 -9
- package/dist/cjs/components/ui/rich-editor/rich-editor.js +6 -6
- package/dist/cjs/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
- package/dist/cjs/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
- package/dist/cjs/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
- package/dist/cjs/node_modules/color-parse/index.js +1 -1
- package/dist/cjs/node_modules/prop-types/index.js +1 -1
- package/dist/esm/_virtual/index5.js +2 -6
- package/dist/esm/_virtual/index6.js +4 -4
- package/dist/esm/_virtual/index7.js +6 -2
- package/dist/esm/components/quiz/runner/question/question.js +9 -2
- package/dist/esm/components/ui/rich-editor/bubble-menus/code-block-bubble-menu.js +15 -2
- package/dist/esm/components/ui/rich-editor/extensions/carousel/extension.js +5 -0
- package/dist/esm/components/ui/rich-editor/extensions/carousel/view.js +2 -1
- package/dist/esm/components/ui/rich-editor/extensions/code-block/index.js +12 -0
- package/dist/esm/components/ui/rich-editor/extensions/code-block/lowlight-base.js +106 -0
- package/dist/esm/components/ui/rich-editor/extensions/code-block/node-view.js +42 -0
- package/dist/esm/components/ui/rich-editor/extensions/code-block/utils.js +148 -0
- package/dist/esm/components/ui/rich-editor/extensions/columns/extension.js +240 -0
- package/dist/esm/components/ui/rich-editor/extensions/columns/node-view.js +10 -0
- package/dist/esm/components/ui/rich-editor/extensions/columns/utils.js +73 -0
- package/dist/esm/components/ui/rich-editor/extensions/columns.js +4 -10
- package/dist/esm/components/ui/rich-editor/extensions/table/kit.js +56 -0
- package/dist/esm/components/ui/rich-editor/extensions/table/table-cell.js +18 -0
- package/dist/esm/components/ui/rich-editor/extensions/table/table-floating-controls.js +20 -4
- package/dist/esm/components/ui/rich-editor/extensions/table/table-header.js +18 -0
- package/dist/esm/components/ui/rich-editor/extensions/table/table-row.js +12 -0
- package/dist/esm/components/ui/rich-editor/extensions/table/table.js +20 -0
- package/dist/esm/components/ui/rich-editor/extensions.js +23 -4
- package/dist/esm/components/ui/rich-editor/rich-editor.js +1 -1
- package/dist/esm/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +1 -1
- package/dist/esm/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +1 -1
- package/dist/esm/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +1 -1
- package/dist/esm/node_modules/color-parse/index.js +1 -1
- package/dist/esm/node_modules/prop-types/index.js +1 -1
- package/dist/types/index.d.ts +20 -20
- package/package.json +1 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/core/dist/index.js');
|
|
4
|
+
var index$1 = require('../../../../../node_modules/prosemirror-state/dist/index.js');
|
|
5
|
+
var index$2 = require('../../../../../node_modules/@tiptap/react/dist/index.js');
|
|
6
|
+
var nodeView = require('./node-view.js');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Columns extension for creating multi-column layouts.
|
|
11
|
+
* Each column can contain regular content (paragraphs, headings, lists, etc.).
|
|
12
|
+
*
|
|
13
|
+
* Attributes that map to raw CSS are stored in the `style` attribute so that
|
|
14
|
+
* serialised HTML is portable. Attributes that map to Tailwind utility classes
|
|
15
|
+
* (grid-cols-N, gap-N, items-X, …) are stored in `data-*` attributes and
|
|
16
|
+
* converted to classes inside renderHTML.
|
|
17
|
+
*/
|
|
18
|
+
const Columns = index.Node.create({
|
|
19
|
+
name: "columns",
|
|
20
|
+
group: "block",
|
|
21
|
+
content: "column+",
|
|
22
|
+
defining: true,
|
|
23
|
+
addAttributes() {
|
|
24
|
+
return {
|
|
25
|
+
// --- Tailwind-class-mapped attributes (stored as data-*) ---
|
|
26
|
+
columns: {
|
|
27
|
+
default: 3,
|
|
28
|
+
parseHTML: (el) => Number(el.getAttribute("data-columns")) || 3,
|
|
29
|
+
renderHTML: (attrs) => ({ "data-columns": attrs.columns }),
|
|
30
|
+
},
|
|
31
|
+
gap: {
|
|
32
|
+
default: "4",
|
|
33
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-gap")) !== null && _a !== void 0 ? _a : "4"; },
|
|
34
|
+
renderHTML: (attrs) => ({ "data-gap": attrs.gap }),
|
|
35
|
+
},
|
|
36
|
+
alignItems: {
|
|
37
|
+
default: "stretch",
|
|
38
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-align-items")) !== null && _a !== void 0 ? _a : "stretch"; },
|
|
39
|
+
renderHTML: (attrs) => ({ "data-align-items": attrs.alignItems }),
|
|
40
|
+
},
|
|
41
|
+
justifyItems: {
|
|
42
|
+
default: "stretch",
|
|
43
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-justify-items")) !== null && _a !== void 0 ? _a : "stretch"; },
|
|
44
|
+
renderHTML: (attrs) => ({ "data-justify-items": attrs.justifyItems }),
|
|
45
|
+
},
|
|
46
|
+
justifyContent: {
|
|
47
|
+
default: "start",
|
|
48
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-justify-content")) !== null && _a !== void 0 ? _a : "start"; },
|
|
49
|
+
renderHTML: (attrs) => ({ "data-justify-content": attrs.justifyContent }),
|
|
50
|
+
},
|
|
51
|
+
alignContent: {
|
|
52
|
+
default: "start",
|
|
53
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-align-content")) !== null && _a !== void 0 ? _a : "start"; },
|
|
54
|
+
renderHTML: (attrs) => ({ "data-align-content": attrs.alignContent }),
|
|
55
|
+
},
|
|
56
|
+
// --- CSS-style attributes (stored in the `style` attribute) ---
|
|
57
|
+
width: {
|
|
58
|
+
default: null,
|
|
59
|
+
parseHTML: (el) => el.style.width || null,
|
|
60
|
+
renderHTML: (attrs) => (attrs.width ? { style: `width: ${attrs.width}` } : {}),
|
|
61
|
+
},
|
|
62
|
+
height: {
|
|
63
|
+
default: null,
|
|
64
|
+
parseHTML: (el) => el.style.height || null,
|
|
65
|
+
renderHTML: (attrs) => (attrs.height ? { style: `height: ${attrs.height}` } : {}),
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
parseHTML() {
|
|
70
|
+
return [{ tag: 'div[data-type="columns"]' }];
|
|
71
|
+
},
|
|
72
|
+
renderHTML({ HTMLAttributes, node }) {
|
|
73
|
+
const { columns, gap, alignItems, justifyItems, justifyContent, alignContent } = node.attrs;
|
|
74
|
+
// Only Tailwind-class-based attrs need manual class computation.
|
|
75
|
+
// CSS-style attrs (width, height) are already merged into HTMLAttributes
|
|
76
|
+
// by their per-attribute renderHTML above.
|
|
77
|
+
const classes = [
|
|
78
|
+
"columns-layout",
|
|
79
|
+
"grid",
|
|
80
|
+
`grid-cols-${columns !== null && columns !== void 0 ? columns : 3}`,
|
|
81
|
+
`gap-${gap !== null && gap !== void 0 ? gap : "4"}`,
|
|
82
|
+
alignItems && alignItems !== "stretch" ? `items-${alignItems}` : null,
|
|
83
|
+
justifyItems && justifyItems !== "stretch" ? `justify-items-${justifyItems}` : null,
|
|
84
|
+
justifyContent && justifyContent !== "start" ? `justify-${justifyContent}` : null,
|
|
85
|
+
alignContent && alignContent !== "start" ? `content-${alignContent}` : null,
|
|
86
|
+
"my-4",
|
|
87
|
+
]
|
|
88
|
+
.filter(Boolean)
|
|
89
|
+
.join(" ");
|
|
90
|
+
return [
|
|
91
|
+
"div",
|
|
92
|
+
index.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
93
|
+
"data-type": "columns",
|
|
94
|
+
class: classes,
|
|
95
|
+
}),
|
|
96
|
+
0,
|
|
97
|
+
];
|
|
98
|
+
},
|
|
99
|
+
addCommands() {
|
|
100
|
+
return {
|
|
101
|
+
setColumns: (options) => ({ tr, dispatch, editor }) => {
|
|
102
|
+
const count = (options === null || options === void 0 ? void 0 : options.columns) || 2;
|
|
103
|
+
const colType = editor.schema.nodes.column;
|
|
104
|
+
const colsType = editor.schema.nodes.columns;
|
|
105
|
+
const cols = [];
|
|
106
|
+
for (let i = 0; i < count; i++) {
|
|
107
|
+
const col = colType.createAndFill({ index: i });
|
|
108
|
+
if (col)
|
|
109
|
+
cols.push(col);
|
|
110
|
+
}
|
|
111
|
+
const node = colsType.createChecked({ columns: count }, cols);
|
|
112
|
+
if (dispatch) {
|
|
113
|
+
const offset = tr.selection.anchor + 1;
|
|
114
|
+
tr.replaceSelectionWith(node)
|
|
115
|
+
.scrollIntoView()
|
|
116
|
+
.setSelection(index$1.TextSelection.near(tr.doc.resolve(offset)));
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
addColBefore: () => ({ dispatch, state }) => utils.addOrDeleteCol({ dispatch, state, type: "addBefore" }),
|
|
121
|
+
addColAfter: () => ({ dispatch, state }) => utils.addOrDeleteCol({ dispatch, state, type: "addAfter" }),
|
|
122
|
+
deleteCol: () => ({ dispatch, state }) => utils.addOrDeleteCol({ dispatch, state, type: "delete" }),
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
addKeyboardShortcuts() {
|
|
126
|
+
return {
|
|
127
|
+
"Mod-Alt-G": () => this.editor.commands.setColumns(),
|
|
128
|
+
Tab: () => utils.gotoCol({
|
|
129
|
+
state: this.editor.state,
|
|
130
|
+
dispatch: this.editor.view.dispatch,
|
|
131
|
+
type: "after",
|
|
132
|
+
}),
|
|
133
|
+
"Shift-Tab": () => utils.gotoCol({
|
|
134
|
+
state: this.editor.state,
|
|
135
|
+
dispatch: this.editor.view.dispatch,
|
|
136
|
+
type: "before",
|
|
137
|
+
}),
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Column extension — a single column within a Columns layout.
|
|
143
|
+
*
|
|
144
|
+
* Same convention: raw CSS properties live in `style`; Tailwind-mapped values
|
|
145
|
+
* (padding scale, box-shadow token) are kept in `data-*` attributes.
|
|
146
|
+
*/
|
|
147
|
+
const Column = index.Node.create({
|
|
148
|
+
name: "column",
|
|
149
|
+
group: "block",
|
|
150
|
+
content: "block+",
|
|
151
|
+
defining: true,
|
|
152
|
+
isolating: true,
|
|
153
|
+
addAttributes() {
|
|
154
|
+
return {
|
|
155
|
+
// Internal index — always a data attribute
|
|
156
|
+
index: {
|
|
157
|
+
default: 0,
|
|
158
|
+
parseHTML: (el) => {
|
|
159
|
+
const val = el.getAttribute("data-index");
|
|
160
|
+
return val !== null ? parseInt(val, 10) : 0;
|
|
161
|
+
},
|
|
162
|
+
renderHTML: (attrs) => ({ "data-index": attrs.index }),
|
|
163
|
+
},
|
|
164
|
+
// --- Tailwind-class-mapped attributes (stored as data-*) ---
|
|
165
|
+
padding: {
|
|
166
|
+
default: "0",
|
|
167
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-padding")) !== null && _a !== void 0 ? _a : "0"; },
|
|
168
|
+
renderHTML: (attrs) => ({ "data-padding": attrs.padding }),
|
|
169
|
+
},
|
|
170
|
+
boxShadow: {
|
|
171
|
+
default: "none",
|
|
172
|
+
parseHTML: (el) => { var _a; return (_a = el.getAttribute("data-box-shadow")) !== null && _a !== void 0 ? _a : "none"; },
|
|
173
|
+
renderHTML: (attrs) => ({ "data-box-shadow": attrs.boxShadow }),
|
|
174
|
+
},
|
|
175
|
+
// --- CSS-style attributes (stored in the `style` attribute) ---
|
|
176
|
+
width: {
|
|
177
|
+
default: null,
|
|
178
|
+
parseHTML: (el) => el.style.width || null,
|
|
179
|
+
renderHTML: (attrs) => (attrs.width ? { style: `width: ${attrs.width}` } : {}),
|
|
180
|
+
},
|
|
181
|
+
height: {
|
|
182
|
+
default: null,
|
|
183
|
+
parseHTML: (el) => el.style.height || null,
|
|
184
|
+
renderHTML: (attrs) => (attrs.height ? { style: `height: ${attrs.height}` } : {}),
|
|
185
|
+
},
|
|
186
|
+
borderWidth: {
|
|
187
|
+
default: null,
|
|
188
|
+
parseHTML: (el) => el.style.borderWidth || null,
|
|
189
|
+
renderHTML: (attrs) => attrs.borderWidth ? { style: `border-width: ${attrs.borderWidth}` } : {},
|
|
190
|
+
},
|
|
191
|
+
borderColor: {
|
|
192
|
+
default: null,
|
|
193
|
+
parseHTML: (el) => el.style.borderColor || null,
|
|
194
|
+
renderHTML: (attrs) => attrs.borderColor ? { style: `border-color: ${attrs.borderColor}` } : {},
|
|
195
|
+
},
|
|
196
|
+
borderStyle: {
|
|
197
|
+
default: null,
|
|
198
|
+
parseHTML: (el) => el.style.borderStyle || null,
|
|
199
|
+
renderHTML: (attrs) => attrs.borderStyle ? { style: `border-style: ${attrs.borderStyle}` } : {},
|
|
200
|
+
},
|
|
201
|
+
backgroundColor: {
|
|
202
|
+
default: null,
|
|
203
|
+
parseHTML: (el) => el.style.backgroundColor || null,
|
|
204
|
+
renderHTML: (attrs) => attrs.backgroundColor ? { style: `background-color: ${attrs.backgroundColor}` } : {},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
parseHTML() {
|
|
209
|
+
return [{ tag: 'div[data-type="column"]' }];
|
|
210
|
+
},
|
|
211
|
+
renderHTML({ HTMLAttributes, node }) {
|
|
212
|
+
const { padding, boxShadow } = node.attrs;
|
|
213
|
+
// CSS-style attrs (width, height, border-*, background-color) are already
|
|
214
|
+
// merged into HTMLAttributes by their per-attribute renderHTML above.
|
|
215
|
+
// We only need to map Tailwind-token attrs to classes here.
|
|
216
|
+
const boxShadowClass = boxShadow === "sm"
|
|
217
|
+
? "shadow-sm"
|
|
218
|
+
: boxShadow === "md"
|
|
219
|
+
? "shadow-md"
|
|
220
|
+
: boxShadow === "lg"
|
|
221
|
+
? "shadow-lg"
|
|
222
|
+
: boxShadow === "xl"
|
|
223
|
+
? "shadow-xl"
|
|
224
|
+
: null;
|
|
225
|
+
const classes = ["column", padding && padding !== "0" ? `p-${padding}` : null, boxShadowClass]
|
|
226
|
+
.filter(Boolean)
|
|
227
|
+
.join(" ");
|
|
228
|
+
return [
|
|
229
|
+
"div",
|
|
230
|
+
index.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
231
|
+
"data-type": "column",
|
|
232
|
+
class: classes,
|
|
233
|
+
}),
|
|
234
|
+
0,
|
|
235
|
+
];
|
|
236
|
+
},
|
|
237
|
+
addNodeView() {
|
|
238
|
+
return index$2.ReactNodeViewRenderer(nodeView.ColumnNodeView);
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
exports.Column = Column;
|
|
243
|
+
exports.Columns = Columns;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var index = require('../../../../../node_modules/@tiptap/react/dist/index.js');
|
|
5
|
+
var utils = require('../../../../../lib/utils.js');
|
|
6
|
+
|
|
7
|
+
const ColumnNodeView = (props) => {
|
|
8
|
+
const { selected } = props;
|
|
9
|
+
return (jsxRuntime.jsx(index.NodeViewWrapper, { as: "div", "data-type": "column", className: utils.cn("min-h-[60px] border border-dashed border-muted-foreground/40 bg-muted/10", "flex-1", selected && "ring-2 ring-primary"), children: jsxRuntime.jsx(index.NodeViewContent, { as: "div" }) }));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.ColumnNodeView = ColumnNodeView;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/core/dist/index.js');
|
|
4
|
+
var index$2 = require('../../../../../node_modules/prosemirror-model/dist/index.js');
|
|
5
|
+
var index$1 = require('../../../../../node_modules/prosemirror-state/dist/index.js');
|
|
6
|
+
|
|
7
|
+
function addOrDeleteCol({ state, dispatch, type, }) {
|
|
8
|
+
const maybeColumns = index.findParentNode((node) => node.type.name === "columns")(state.selection);
|
|
9
|
+
const maybeColumn = index.findParentNode((node) => node.type.name === "column")(state.selection);
|
|
10
|
+
if (dispatch && maybeColumns && maybeColumn) {
|
|
11
|
+
const cols = maybeColumns.node;
|
|
12
|
+
const colIndex = maybeColumn.node.attrs.index;
|
|
13
|
+
const colsJSON = cols.toJSON();
|
|
14
|
+
let nextIndex = colIndex;
|
|
15
|
+
if (type === "delete") {
|
|
16
|
+
if (colsJSON.content.length <= 1)
|
|
17
|
+
return false;
|
|
18
|
+
nextIndex = Math.max(0, colIndex - 1);
|
|
19
|
+
colsJSON.content.splice(colIndex, 1);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
nextIndex = type === "addBefore" ? colIndex : colIndex + 1;
|
|
23
|
+
colsJSON.content.splice(nextIndex, 0, {
|
|
24
|
+
type: "column",
|
|
25
|
+
attrs: { index: 0 },
|
|
26
|
+
content: [{ type: "paragraph" }],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
colsJSON.attrs.columns = colsJSON.content.length;
|
|
30
|
+
colsJSON.content.forEach((colJSON, index) => {
|
|
31
|
+
colJSON.attrs.index = index;
|
|
32
|
+
});
|
|
33
|
+
const nextCols = index$2.Node.fromJSON(state.schema, colsJSON);
|
|
34
|
+
let nextSelectPos = maybeColumns.pos;
|
|
35
|
+
nextCols.content.forEach((col, _pos, index) => {
|
|
36
|
+
if (index < nextIndex) {
|
|
37
|
+
nextSelectPos += col.nodeSize;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const tr = state.tr.setTime(Date.now());
|
|
41
|
+
tr.replaceWith(maybeColumns.pos, maybeColumns.pos + maybeColumns.node.nodeSize, nextCols).setSelection(index$1.TextSelection.near(tr.doc.resolve(nextSelectPos + 1)));
|
|
42
|
+
dispatch(tr);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
function gotoCol({ state, dispatch, type }) {
|
|
48
|
+
const maybeColumns = index.findParentNode((node) => node.type.name === "columns")(state.selection);
|
|
49
|
+
const maybeColumn = index.findParentNode((node) => node.type.name === "column")(state.selection);
|
|
50
|
+
if (dispatch && maybeColumns && maybeColumn) {
|
|
51
|
+
const cols = maybeColumns.node;
|
|
52
|
+
const colIndex = maybeColumn.node.attrs.index;
|
|
53
|
+
const totalCols = cols.attrs.columns;
|
|
54
|
+
let nextIndex;
|
|
55
|
+
if (type === "before") {
|
|
56
|
+
nextIndex = (colIndex - 1 + totalCols) % totalCols;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
nextIndex = (colIndex + 1) % totalCols;
|
|
60
|
+
}
|
|
61
|
+
let nextSelectPos = maybeColumns.pos;
|
|
62
|
+
cols.content.forEach((col, _pos, index) => {
|
|
63
|
+
if (index < nextIndex) {
|
|
64
|
+
nextSelectPos += col.nodeSize;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const tr = state.tr.setTime(Date.now());
|
|
68
|
+
tr.setSelection(index$1.TextSelection.near(tr.doc.resolve(nextSelectPos + 1)));
|
|
69
|
+
dispatch(tr);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
exports.addOrDeleteCol = addOrDeleteCol;
|
|
76
|
+
exports.gotoCol = gotoCol;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('../../../../node_modules/@tiptap/core/dist/index.js');
|
|
4
4
|
var index$1 = require('../../../../node_modules/prosemirror-state/dist/index.js');
|
|
5
|
-
var index$2 = require('../../../../node_modules/@tiptap/react/dist/index.js');
|
|
6
|
-
var columnsNodeView = require('../views/columns-node-view.js');
|
|
7
5
|
var columnsUtils = require('./columns-utils.js');
|
|
8
6
|
|
|
9
7
|
/**
|
|
@@ -222,11 +220,7 @@ const Column = index.Node.create({
|
|
|
222
220
|
: boxShadow === "xl"
|
|
223
221
|
? "shadow-xl"
|
|
224
222
|
: null;
|
|
225
|
-
const classes = [
|
|
226
|
-
"column",
|
|
227
|
-
padding && padding !== "0" ? `p-${padding}` : null,
|
|
228
|
-
boxShadowClass,
|
|
229
|
-
]
|
|
223
|
+
const classes = ["column", padding && padding !== "0" ? `p-${padding}` : null, boxShadowClass]
|
|
230
224
|
.filter(Boolean)
|
|
231
225
|
.join(" ");
|
|
232
226
|
return [
|
|
@@ -238,9 +232,9 @@ const Column = index.Node.create({
|
|
|
238
232
|
0,
|
|
239
233
|
];
|
|
240
234
|
},
|
|
241
|
-
addNodeView() {
|
|
242
|
-
|
|
243
|
-
},
|
|
235
|
+
// addNodeView() {
|
|
236
|
+
// return ReactNodeViewRenderer(ColumnNodeView);
|
|
237
|
+
// },
|
|
244
238
|
});
|
|
245
239
|
|
|
246
240
|
exports.Column = Column;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/core/dist/index.js');
|
|
4
|
+
var table = require('./table.js');
|
|
5
|
+
var tableRow = require('./table-row.js');
|
|
6
|
+
var tableHeader = require('./table-header.js');
|
|
7
|
+
var tableCell = require('./table-cell.js');
|
|
8
|
+
var tableCellStyle = require('./table-cell-style.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Bundles all table-related content extensions into a single unit.
|
|
12
|
+
*
|
|
13
|
+
* Uses the local Table, TableRow, TableHeader, and TableCell extensions which
|
|
14
|
+
* carry their own base visual styles via HTMLAttributes — keeping styling
|
|
15
|
+
* co-located with the extension rather than on the root editor element.
|
|
16
|
+
*
|
|
17
|
+
* Including TableCellStyle here means alignment and background-color
|
|
18
|
+
* attributes are always registered alongside the table nodes — no separate
|
|
19
|
+
* registration required, and the schema is consistent between the editor and
|
|
20
|
+
* the static renderer.
|
|
21
|
+
*
|
|
22
|
+
* Editor-only extensions (TableActionsExtension, TableHoverExtension,
|
|
23
|
+
* TableSelectionOverlay) are not included because they depend on the editor
|
|
24
|
+
* view and are not needed by the static renderer.
|
|
25
|
+
*/
|
|
26
|
+
const TableKit = index.Extension.create({
|
|
27
|
+
name: "tableKit",
|
|
28
|
+
addOptions() {
|
|
29
|
+
return {
|
|
30
|
+
table: {},
|
|
31
|
+
tableRow: {},
|
|
32
|
+
tableHeader: {},
|
|
33
|
+
tableCell: {},
|
|
34
|
+
tableCellStyle: {},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
addExtensions() {
|
|
38
|
+
const extensions = [];
|
|
39
|
+
if (this.options.table !== false) {
|
|
40
|
+
extensions.push(table.Table.configure(this.options.table || {}));
|
|
41
|
+
}
|
|
42
|
+
if (this.options.tableRow !== false) {
|
|
43
|
+
extensions.push(tableRow.TableRow);
|
|
44
|
+
}
|
|
45
|
+
if (this.options.tableHeader !== false) {
|
|
46
|
+
extensions.push(tableHeader.TableHeader);
|
|
47
|
+
}
|
|
48
|
+
if (this.options.tableCell !== false) {
|
|
49
|
+
extensions.push(tableCell.TableCell);
|
|
50
|
+
}
|
|
51
|
+
if (this.options.tableCellStyle !== false) {
|
|
52
|
+
extensions.push(tableCellStyle.TableCellStyle.configure(this.options.tableCellStyle || {}));
|
|
53
|
+
}
|
|
54
|
+
return extensions;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
exports.TableKit = TableKit;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/extension-table-cell/dist/index.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Table cell extension with base visual styles applied via HTMLAttributes.
|
|
7
|
+
*
|
|
8
|
+
* Cell-level styling attributes (alignment, background) are declared in
|
|
9
|
+
* TableCellStyle so they apply equally to tableCell and tableHeader and are
|
|
10
|
+
* available to both the editor and the static renderer.
|
|
11
|
+
*
|
|
12
|
+
* @see https://tiptap.dev/docs/editor/extensions/nodes/table-cell
|
|
13
|
+
*/
|
|
14
|
+
const TableCell = index.default.configure({
|
|
15
|
+
HTMLAttributes: {
|
|
16
|
+
class: "relative min-w-[1em] border border-border px-4 py-2 align-top break-words [overflow-wrap:break-word]",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.TableCell = TableCell;
|
|
@@ -102,7 +102,11 @@ function useActiveCellPos(editor, includeHover) {
|
|
|
102
102
|
if (!ed)
|
|
103
103
|
return null;
|
|
104
104
|
const hoverState = tableHoverExtension.tableHoverKey.getState(ed.state);
|
|
105
|
-
const hoverOrLockedPos = includeHover
|
|
105
|
+
const hoverOrLockedPos = includeHover
|
|
106
|
+
? (hoverState === null || hoverState === void 0 ? void 0 : hoverState.menuOpen)
|
|
107
|
+
? (_a = hoverState.lockedCell) === null || _a === void 0 ? void 0 : _a.pos
|
|
108
|
+
: (_b = hoverState === null || hoverState === void 0 ? void 0 : hoverState.cell) === null || _b === void 0 ? void 0 : _b.pos
|
|
109
|
+
: null;
|
|
106
110
|
return hoverOrLockedPos !== null && hoverOrLockedPos !== void 0 ? hoverOrLockedPos : findCellPosFromSelection(ed);
|
|
107
111
|
},
|
|
108
112
|
});
|
|
@@ -242,7 +246,11 @@ function RowMenu({ editor }) {
|
|
|
242
246
|
editor.chain().focus().duplicateRowAt(activeCellPos).run();
|
|
243
247
|
}, children: [jsxRuntime.jsx(copy.default, { className: "mr-2 size-4" }), "Duplicate row"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), jsxRuntime.jsxs(dropdownMenu.DropdownMenuSub, { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuSubTrigger, { children: [jsxRuntime.jsx(palette.default, { className: "mr-2 size-4" }), "Color"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSubContent, { children: COLORS.map((color) => (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
|
|
244
248
|
if (activeCellPos !== null)
|
|
245
|
-
editor
|
|
249
|
+
editor
|
|
250
|
+
.chain()
|
|
251
|
+
.focus()
|
|
252
|
+
.setRowBackgroundAt(activeCellPos, color.value || null)
|
|
253
|
+
.run();
|
|
246
254
|
}, children: [jsxRuntime.jsx("div", { className: "mr-2 size-4 rounded border", style: { backgroundColor: color.value || "transparent" } }), color.name] }, color.value || "default"))) })] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
|
|
247
255
|
if (activeCellPos !== null)
|
|
248
256
|
editor.chain().focus().clearRowAt(activeCellPos).run();
|
|
@@ -268,7 +276,11 @@ function ColumnMenu({ editor }) {
|
|
|
268
276
|
editor.chain().focus().duplicateColumnAt(activeCellPos).run();
|
|
269
277
|
}, children: [jsxRuntime.jsx(copy.default, { className: "mr-2 size-4" }), "Duplicate column"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), jsxRuntime.jsxs(dropdownMenu.DropdownMenuSub, { children: [jsxRuntime.jsxs(dropdownMenu.DropdownMenuSubTrigger, { children: [jsxRuntime.jsx(palette.default, { className: "mr-2 size-4" }), "Color"] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSubContent, { children: COLORS.map((color) => (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
|
|
270
278
|
if (activeCellPos !== null)
|
|
271
|
-
editor
|
|
279
|
+
editor
|
|
280
|
+
.chain()
|
|
281
|
+
.focus()
|
|
282
|
+
.setColumnBackgroundAt(activeCellPos, color.value || null)
|
|
283
|
+
.run();
|
|
272
284
|
}, children: [jsxRuntime.jsx("div", { className: "mr-2 size-4 rounded border", style: { backgroundColor: color.value || "transparent" } }), color.name] }, color.value || "default"))) })] }), jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}), jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
|
|
273
285
|
if (activeCellPos !== null)
|
|
274
286
|
editor.chain().focus().clearColumnAt(activeCellPos).run();
|
|
@@ -313,7 +325,11 @@ function CellBubbleMenu({ editor }) {
|
|
|
313
325
|
}, disabled: !canSplit, "aria-label": "Split cell", title: "Split cell", children: jsxRuntime.jsx(copy.default, { className: "size-4 rotate-180" }) }), jsxRuntime.jsx("div", { className: "mx-1 h-5 w-px bg-border" }), ALIGNMENT_OPTIONS.map(({ value, icon: Icon, label }) => (jsxRuntime.jsx(button.Button, { variant: "ghost", size: "icon-sm", className: utils.cn("size-7", activeAttrs.horizontalAlign === value && "bg-accent text-accent-foreground"), onClick: () => {
|
|
314
326
|
editor.chain().focus().setCellAlignmentAt(activeCellPos, value).run();
|
|
315
327
|
}, "aria-label": label, title: label, children: jsxRuntime.jsx(Icon, { className: "size-4" }) }, value))), jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsx(button.Button, { variant: "ghost", size: "icon-sm", className: utils.cn("size-7", activeAttrs.backgroundColor && "bg-accent text-accent-foreground"), "aria-label": "Cell color", title: "Cell color", children: jsxRuntime.jsx(palette.default, { className: "size-4" }) }) }), jsxRuntime.jsx(dropdownMenu.DropdownMenuContent, { side: "top", align: "end", className: "w-44", children: COLORS.map((color) => (jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: () => {
|
|
316
|
-
editor
|
|
328
|
+
editor
|
|
329
|
+
.chain()
|
|
330
|
+
.focus()
|
|
331
|
+
.setCellBackgroundAt(activeCellPos, color.value || null)
|
|
332
|
+
.run();
|
|
317
333
|
}, children: [jsxRuntime.jsx("div", { className: "mr-2 size-4 rounded border", style: { backgroundColor: color.value || "transparent" } }), color.name] }, color.value || "default"))) })] }), jsxRuntime.jsx("div", { className: "mx-1 h-5 w-px bg-border" }), jsxRuntime.jsx(button.Button, { variant: "ghost", size: "icon-sm", className: "size-7", onClick: () => {
|
|
318
334
|
editor.chain().focus().clearCellAt(activeCellPos).run();
|
|
319
335
|
}, "aria-label": "Clear cell contents", title: "Clear cell contents", children: jsxRuntime.jsx(x.default, { className: "size-4" }) })] }) }));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/extension-table-header/dist/index.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Table header cell extension with base visual styles applied via HTMLAttributes.
|
|
7
|
+
*
|
|
8
|
+
* Cell-level styling attributes (alignment, background) are declared in
|
|
9
|
+
* TableCellStyle so they apply equally to tableCell and tableHeader and are
|
|
10
|
+
* available to both the editor and the static renderer.
|
|
11
|
+
*
|
|
12
|
+
* @see https://tiptap.dev/docs/editor/extensions/nodes/table-header
|
|
13
|
+
*/
|
|
14
|
+
const TableHeader = index.default.configure({
|
|
15
|
+
HTMLAttributes: {
|
|
16
|
+
class: "relative min-w-[1em] border border-border px-4 py-2 text-left font-semibold bg-muted/50 align-top break-words [overflow-wrap:break-word]",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
exports.TableHeader = TableHeader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/extension-table-row/dist/index.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Table row extension without injected styles.
|
|
7
|
+
*
|
|
8
|
+
* Styling is controlled from the editor container.
|
|
9
|
+
*
|
|
10
|
+
* @see https://tiptap.dev/docs/editor/extensions/nodes/table-row
|
|
11
|
+
*/
|
|
12
|
+
const TableRow = index.default;
|
|
13
|
+
|
|
14
|
+
exports.TableRow = TableRow;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../../../../../node_modules/@tiptap/extension-table/dist/index.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Table extension configured with column resizing and base visual styles.
|
|
7
|
+
*
|
|
8
|
+
* Note: the `tableWrapper` div injected by TipTap's resize NodeView is not
|
|
9
|
+
* a schema node, so its spacing/overflow styles are still applied from the
|
|
10
|
+
* editor container. The styles here target the `<table>` element via
|
|
11
|
+
* renderHTML (HTML output) — the NodeView applies them via HTMLAttributes.
|
|
12
|
+
*
|
|
13
|
+
* @see https://tiptap.dev/docs/editor/extensions/nodes/table
|
|
14
|
+
*/
|
|
15
|
+
const Table = index.Table.configure({
|
|
16
|
+
resizable: true,
|
|
17
|
+
HTMLAttributes: {
|
|
18
|
+
class: "m-0 w-full table-fixed border-collapse text-sm",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.Table = Table;
|
|
@@ -22,10 +22,23 @@ var index$3 = require('../../../node_modules/@tiptap/extension-text-align/dist/i
|
|
|
22
22
|
var index$9 = require('../../../node_modules/@tiptap/extension-list/dist/index.js');
|
|
23
23
|
var index$a = require('../../../node_modules/@tiptap/extensions/dist/index.js');
|
|
24
24
|
var indent = require('./extensions/indent.js');
|
|
25
|
-
|
|
25
|
+
require('./extensions/table/table.js');
|
|
26
|
+
require('../../../node_modules/@tiptap/extension-table/dist/index.js');
|
|
27
|
+
require('./extensions/table/table-header.js');
|
|
28
|
+
require('./extensions/table/table-cell.js');
|
|
29
|
+
require('./extensions/table/table-cell-style.js');
|
|
30
|
+
var kit = require('./extensions/table/kit.js');
|
|
26
31
|
var tableActionsExtension = require('./extensions/table/table-actions-extension.js');
|
|
27
32
|
var tableSelectionOverlay = require('./extensions/table/table-selection-overlay.js');
|
|
28
33
|
var tableHoverExtension = require('./extensions/table/table-hover-extension.js');
|
|
34
|
+
require('react/jsx-runtime');
|
|
35
|
+
require('react');
|
|
36
|
+
require('react-dom');
|
|
37
|
+
require('../../../node_modules/prosemirror-tables/dist/index.js');
|
|
38
|
+
require('../dropdown-menu/dropdown-menu.js');
|
|
39
|
+
require('../../buttons/button/button.js');
|
|
40
|
+
require('../../popovers/popover/popover.js');
|
|
41
|
+
require('../../forms/input/input.js');
|
|
29
42
|
var heading = require('./extensions/heading.js');
|
|
30
43
|
var paragraph = require('./extensions/paragraph.js');
|
|
31
44
|
var blockquote = require('./extensions/blockquote.js');
|
|
@@ -36,11 +49,17 @@ var horizontalRule = require('./extensions/horizontal-rule.js');
|
|
|
36
49
|
var details = require('./extensions/details.js');
|
|
37
50
|
var detailsSummary = require('./extensions/details-summary.js');
|
|
38
51
|
var detailsContent = require('./extensions/details-content.js');
|
|
52
|
+
require('./extensions/code-block/index.js');
|
|
39
53
|
var code = require('./extensions/code.js');
|
|
40
54
|
var subscript = require('./extensions/subscript.js');
|
|
41
55
|
var superscript = require('./extensions/superscript.js');
|
|
42
|
-
var extension = require('./extensions/carousel/extension.js');
|
|
43
|
-
var
|
|
56
|
+
var extension$1 = require('./extensions/carousel/extension.js');
|
|
57
|
+
var editor = require('./extensions/carousel/editor.js');
|
|
58
|
+
require('../carousel/carousel.js');
|
|
59
|
+
require('../../../node_modules/tslib/tslib.es6.js');
|
|
60
|
+
require('../../forms/file-upload/file-upload.js');
|
|
61
|
+
var extension = require('./extensions/columns/extension.js');
|
|
62
|
+
var lowlightBase = require('./extensions/code-block/lowlight-base.js');
|
|
44
63
|
|
|
45
64
|
/**
|
|
46
65
|
* Core content and formatting extensions used by both editor and renderer.
|
|
@@ -64,8 +83,8 @@ const CORE_EXTENSIONS = [
|
|
|
64
83
|
details.Details,
|
|
65
84
|
detailsSummary.DetailsSummary,
|
|
66
85
|
detailsContent.DetailsContent,
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
extension.Columns,
|
|
87
|
+
extension.Column,
|
|
69
88
|
index$d.default,
|
|
70
89
|
// Inline marks (formatting)
|
|
71
90
|
index$e.default,
|
|
@@ -84,9 +103,9 @@ const CORE_EXTENSIONS = [
|
|
|
84
103
|
// Rich content
|
|
85
104
|
index$1.default,
|
|
86
105
|
index$2.default,
|
|
87
|
-
extension.Carousel,
|
|
88
|
-
|
|
89
|
-
|
|
106
|
+
extension$1.Carousel,
|
|
107
|
+
kit.TableKit,
|
|
108
|
+
lowlightBase.CodeBlockLowlightBase,
|
|
90
109
|
];
|
|
91
110
|
/**
|
|
92
111
|
* Default configurations for editor extensions.
|
|
@@ -157,7 +176,7 @@ const EDITOR_EXTENSIONS = [
|
|
|
157
176
|
index$a.TrailingNode,
|
|
158
177
|
index$5.default,
|
|
159
178
|
index$4.default,
|
|
160
|
-
|
|
179
|
+
editor.CarouselEditor,
|
|
161
180
|
tableActionsExtension.TableActionsExtension,
|
|
162
181
|
tableSelectionOverlay.TableSelectionOverlay,
|
|
163
182
|
tableHoverExtension.TableHoverExtension,
|