@flexiui/svelte-rich-text 0.0.24 → 0.0.25
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/AudioPlayerSimple.svelte +7 -0
- package/dist/AudioPlayerSimple.svelte.d.ts +25 -0
- package/dist/RichText.svelte +110 -5
- package/dist/extensions/Audio.d.ts +29 -0
- package/dist/extensions/Audio.js +123 -0
- package/dist/extensions/AudioPlayer.svelte +622 -0
- package/dist/extensions/AudioPlayer.svelte.d.ts +20 -0
- package/dist/extensions/AudioPlayerWrapper.svelte +123 -0
- package/dist/extensions/AudioPlayerWrapper.svelte.d.ts +21 -0
- package/dist/extensions/MediaGrid/MediaGrid.d.ts +2 -0
- package/dist/extensions/MediaGrid/MediaGrid.js +90 -0
- package/dist/extensions/MediaGrid/MediaGrid.svelte +265 -0
- package/dist/extensions/MediaGrid/MediaGrid.svelte.d.ts +14 -0
- package/dist/extensions/MediaGrid/MediaGridItem.d.ts +2 -0
- package/dist/extensions/MediaGrid/MediaGridItem.js +24 -0
- package/dist/extensions/MediaGrid/MediaGridItem.svelte +484 -0
- package/dist/extensions/MediaGrid/MediaGridItem.svelte.d.ts +14 -0
- package/dist/extensions/MediaGrid/auth-service.d.ts +1 -0
- package/dist/extensions/MediaGrid/auth-service.js +11 -0
- package/dist/extensions/Table/CustomTableCell.d.ts +19 -0
- package/dist/extensions/Table/CustomTableCell.js +86 -0
- package/dist/extensions/Table/CustomTableHeader.d.ts +1 -0
- package/dist/extensions/Table/CustomTableHeader.js +33 -0
- package/dist/extensions/Table/TableCellControls.d.ts +0 -0
- package/dist/extensions/Table/TableCellControls.js +0 -0
- package/dist/extensions/Table/TableCellNodeView.svelte +576 -0
- package/dist/extensions/Table/TableCellNodeView.svelte.d.ts +14 -0
- package/dist/extensions/Table/TableCellSelection.d.ts +12 -0
- package/dist/extensions/Table/TableCellSelection.js +35 -0
- package/dist/extensions/audioStore.d.ts +1 -0
- package/dist/extensions/audioStore.js +2 -0
- package/dist/extensions/extensions.d.ts +7 -0
- package/dist/extensions/extensions.js +86 -0
- package/dist/styles.css +182 -0
- package/package.json +1 -1
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { deleteRow } from "prosemirror-tables";
|
|
3
|
+
import {
|
|
4
|
+
computePosition,
|
|
5
|
+
offset,
|
|
6
|
+
autoUpdate,
|
|
7
|
+
size,
|
|
8
|
+
autoPlacement,
|
|
9
|
+
type Placement,
|
|
10
|
+
} from "@floating-ui/dom";
|
|
11
|
+
import { NodeViewWrapper, NodeViewContent } from "svelte-tiptap";
|
|
12
|
+
import { h, type NodeViewProps } from "@tiptap/core";
|
|
13
|
+
import { onMount } from "svelte";
|
|
14
|
+
|
|
15
|
+
const { node, selected, getPos, editor } = $props<{
|
|
16
|
+
node: NodeViewProps["node"];
|
|
17
|
+
selected: NodeViewProps["selected"];
|
|
18
|
+
getPos: NodeViewProps["getPos"];
|
|
19
|
+
editor: NodeViewProps["editor"];
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
let wrapper: HTMLElement = $state(null) as HTMLElement;
|
|
23
|
+
let isFirstCell = $state(false);
|
|
24
|
+
let isFirstRow = $state(false);
|
|
25
|
+
|
|
26
|
+
let tooltipVisible = $state(false);
|
|
27
|
+
let tooltipX = $state(0);
|
|
28
|
+
let tooltipY = $state(0);
|
|
29
|
+
let tooltip: HTMLDivElement = $state(null) as HTMLDivElement;
|
|
30
|
+
let cleanup: () => void;
|
|
31
|
+
|
|
32
|
+
onMount(() => {
|
|
33
|
+
const td = wrapper.closest("td, th");
|
|
34
|
+
if (!td) return;
|
|
35
|
+
|
|
36
|
+
const tr = td.parentElement;
|
|
37
|
+
const table = td.closest("table");
|
|
38
|
+
|
|
39
|
+
// ✅ primera celda de la fila (botón lateral)
|
|
40
|
+
if (tr && tr.firstElementChild === td) {
|
|
41
|
+
isFirstCell = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ✅ celda dentro de la primera fila (botón superior)
|
|
45
|
+
if (table && table.querySelector("tr:first-child") === tr) {
|
|
46
|
+
isFirstRow = true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
editor.on("update", ({ transaction }) => {
|
|
50
|
+
console.log({ NODETYPE: node.type.name });
|
|
51
|
+
if (node.type.name !== "tableCell" && node.type.name !== "tableHeader")
|
|
52
|
+
return;
|
|
53
|
+
|
|
54
|
+
const nodeEl = editor.view.nodeDOM(getPos());
|
|
55
|
+
console.log(nodeEl);
|
|
56
|
+
|
|
57
|
+
console.log("update", transaction);
|
|
58
|
+
|
|
59
|
+
const attrs = node.attrs;
|
|
60
|
+
const { colspan, rowspan, colwidth } = attrs;
|
|
61
|
+
|
|
62
|
+
if (colspan) {
|
|
63
|
+
td.setAttribute("colspan", colspan);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (rowspan) {
|
|
67
|
+
td.setAttribute("rowspan", rowspan);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (colwidth) {
|
|
71
|
+
td.setAttribute("colwidth", colwidth);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (td) {
|
|
75
|
+
const tr = td.parentElement;
|
|
76
|
+
const table = td.closest("table");
|
|
77
|
+
|
|
78
|
+
// ✅ primera celda de la fila (botón lateral)
|
|
79
|
+
if (tr && tr.firstElementChild === td) {
|
|
80
|
+
isFirstCell = true;
|
|
81
|
+
} else {
|
|
82
|
+
isFirstCell = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ✅ celda dentro de la primera fila (botón superior)
|
|
86
|
+
if (table && table.querySelector("tr:first-child") === tr) {
|
|
87
|
+
isFirstRow = true;
|
|
88
|
+
} else {
|
|
89
|
+
isFirstRow = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
let currentTriggerEl: HTMLElement | null = $state(null);
|
|
96
|
+
let currentDropdownType: string | null = $state(null);
|
|
97
|
+
let prevGripSelectionIsInFirstRow: boolean | null = $state(null);
|
|
98
|
+
|
|
99
|
+
function showTooltip(
|
|
100
|
+
el: HTMLElement,
|
|
101
|
+
type: "row-dropdown" | "column-dropdown"
|
|
102
|
+
) {
|
|
103
|
+
// Si ya está abierto en el mismo elemento → cerrar pero mantener selección
|
|
104
|
+
if (tooltipVisible && currentTriggerEl === el) {
|
|
105
|
+
hideTooltip({ keepSelection: true }); // 👈 mantener selección
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Si hay otro abierto → cerrar sin mantener
|
|
110
|
+
if (tooltipVisible && currentTriggerEl && currentTriggerEl !== el) {
|
|
111
|
+
hideTooltip();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
currentTriggerEl = el;
|
|
115
|
+
currentDropdownType = type;
|
|
116
|
+
tooltipVisible = true;
|
|
117
|
+
|
|
118
|
+
document.body.append(tooltip);
|
|
119
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
120
|
+
cleanup = autoUpdate(el, tooltip, () => updatePosition(el));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function hideTooltip({ keepSelection = false } = {}) {
|
|
124
|
+
tooltipVisible = false;
|
|
125
|
+
tooltip?.remove();
|
|
126
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
127
|
+
cleanup && cleanup();
|
|
128
|
+
currentTriggerEl = null;
|
|
129
|
+
|
|
130
|
+
// 🧠 Si no queremos mantener la selección, la limpiamos
|
|
131
|
+
if (!keepSelection) {
|
|
132
|
+
editor.commands.deleteSelection(); // limpiar selección visual
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 🔁 Resetear storage siempre
|
|
136
|
+
editor.storage.tableCell.customTableSelection = null;
|
|
137
|
+
editor.storage.tableCell.gripSelectionIsInFirstRow = null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function handleClickOutside(e: MouseEvent) {
|
|
141
|
+
const target = e.target as Node;
|
|
142
|
+
if (!tooltip) return;
|
|
143
|
+
|
|
144
|
+
// Si hace click dentro del tooltip → no cerramos
|
|
145
|
+
if (tooltip.contains(target)) return;
|
|
146
|
+
|
|
147
|
+
// Si hace click en el botón que abrió el tooltip → ya lo gestiona showTooltip()
|
|
148
|
+
if (currentTriggerEl && currentTriggerEl.contains(target)) return;
|
|
149
|
+
|
|
150
|
+
// En cualquier otro caso → cerrar (manteniendo la selección)
|
|
151
|
+
hideTooltip({ keepSelection: true });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function updatePosition(el: HTMLElement) {
|
|
155
|
+
let placement: Placement = "left";
|
|
156
|
+
let offsetValue = 4;
|
|
157
|
+
if (currentDropdownType === "column-dropdown") {
|
|
158
|
+
placement = "top";
|
|
159
|
+
offsetValue = 4;
|
|
160
|
+
}
|
|
161
|
+
computePosition(el, tooltip, {
|
|
162
|
+
placement,
|
|
163
|
+
middleware: [
|
|
164
|
+
offset(offsetValue),
|
|
165
|
+
size({
|
|
166
|
+
apply({ rects, elements }) {
|
|
167
|
+
// Object.assign(elements.floating.style, {
|
|
168
|
+
// height: `${rects.reference.height}px`,
|
|
169
|
+
// // minHeight: `64px`,
|
|
170
|
+
// });
|
|
171
|
+
},
|
|
172
|
+
}),
|
|
173
|
+
// autoPlacement({
|
|
174
|
+
// allowedPlacements: ["left-start", "bottom-end",],
|
|
175
|
+
// }),
|
|
176
|
+
],
|
|
177
|
+
}).then(({ x, y }) => {
|
|
178
|
+
tooltipX = x;
|
|
179
|
+
tooltipY = y;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<NodeViewWrapper class="fl-table-cell-wrapper">
|
|
185
|
+
<div contenteditable="false" bind:this={wrapper}>
|
|
186
|
+
{#if isFirstCell}
|
|
187
|
+
<button
|
|
188
|
+
class="grip-row"
|
|
189
|
+
aria-label="Row options"
|
|
190
|
+
type="button"
|
|
191
|
+
onclick={(e) => {
|
|
192
|
+
editor.commands.deleteSelection();
|
|
193
|
+
editor?.chain().focus().selectRow(getPos()).run();
|
|
194
|
+
showTooltip(e.target as HTMLElement, "row-dropdown");
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
</button>
|
|
198
|
+
{/if}
|
|
199
|
+
|
|
200
|
+
{#if isFirstRow}
|
|
201
|
+
<button
|
|
202
|
+
class="grip-col"
|
|
203
|
+
aria-label="Column options"
|
|
204
|
+
type="button"
|
|
205
|
+
onclick={(e) => {
|
|
206
|
+
editor.commands.deleteSelection();
|
|
207
|
+
editor?.chain().focus().selectColumn(getPos()).run();
|
|
208
|
+
showTooltip(e.target as HTMLElement, "column-dropdown");
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
211
|
+
</button>
|
|
212
|
+
{/if}
|
|
213
|
+
<!-- <button onclick={() => {editor?.chain().focus().selectRow(getPos()).run();}}>Select Row</button>
|
|
214
|
+
<button onclick={() => {editor?.chain().focus().selectColumn(getPos()).run();}}>Select Column</button>
|
|
215
|
+
<button onclick={() => {editor?.chain().focus().deleteRow().run();}}>Delete Row</button>
|
|
216
|
+
<button onclick={() => {editor?.chain().focus().deleteColumn().run();}}>Delete Column</button> -->
|
|
217
|
+
</div>
|
|
218
|
+
<NodeViewContent class="fl-table-cell-content" />
|
|
219
|
+
|
|
220
|
+
<div
|
|
221
|
+
class="fl-toolbar-dropdown-panel fl-toolbar-dropdown-panel--table"
|
|
222
|
+
bind:this={tooltip}
|
|
223
|
+
style="display: {tooltipVisible
|
|
224
|
+
? 'flex'
|
|
225
|
+
: 'none'}; left: {tooltipX}px; top: {tooltipY}px;"
|
|
226
|
+
>
|
|
227
|
+
{#if currentDropdownType === "row-dropdown"}
|
|
228
|
+
<div class="table-dropdown-options">
|
|
229
|
+
<button
|
|
230
|
+
class="table-dropdown-option"
|
|
231
|
+
onclick={() => editor?.chain().focus().addRowBefore().run()}
|
|
232
|
+
aria-label="Insert row above"
|
|
233
|
+
tabindex="-1"
|
|
234
|
+
style=""
|
|
235
|
+
>
|
|
236
|
+
<div
|
|
237
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;"
|
|
238
|
+
>
|
|
239
|
+
<div
|
|
240
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
241
|
+
>
|
|
242
|
+
<div
|
|
243
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
244
|
+
>
|
|
245
|
+
<svg
|
|
246
|
+
aria-hidden="true"
|
|
247
|
+
role="graphics-symbol"
|
|
248
|
+
viewBox="0 0 20 20"
|
|
249
|
+
height="18"
|
|
250
|
+
width="18"
|
|
251
|
+
fill="currentColor"
|
|
252
|
+
class="arrowStraightUp"
|
|
253
|
+
style="display: block;flex-shrink: 0;"
|
|
254
|
+
><path
|
|
255
|
+
d="M9.792 2.41a.6.6 0 0 0-.234.148l-5.4 5.4a.625.625 0 1 0 .884.884l4.333-4.333V17a.625.625 0 1 0 1.25 0V4.509l4.333 4.333a.625.625 0 1 0 .884-.884l-5.4-5.4a.62.62 0 0 0-.65-.147"
|
|
256
|
+
></path></svg
|
|
257
|
+
>
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
261
|
+
<div
|
|
262
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
263
|
+
>
|
|
264
|
+
Insert above
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</button>
|
|
269
|
+
|
|
270
|
+
<button
|
|
271
|
+
class="table-dropdown-option"
|
|
272
|
+
type="button"
|
|
273
|
+
onclick={() => editor?.chain().focus().addRowAfter().run()}
|
|
274
|
+
tabindex="-1"
|
|
275
|
+
>
|
|
276
|
+
<div
|
|
277
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;/* padding-inline: 8px; */"
|
|
278
|
+
>
|
|
279
|
+
<div
|
|
280
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
281
|
+
>
|
|
282
|
+
<div
|
|
283
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
284
|
+
>
|
|
285
|
+
<svg
|
|
286
|
+
aria-hidden="true"
|
|
287
|
+
role="graphics-symbol"
|
|
288
|
+
viewBox="0 0 20 20"
|
|
289
|
+
height="18"
|
|
290
|
+
width="18"
|
|
291
|
+
class="arrowStraightUp"
|
|
292
|
+
fill="currentColor"
|
|
293
|
+
style="display: block;flex-shrink: 0;transform: scaleY(-1);"
|
|
294
|
+
><path
|
|
295
|
+
d="M9.792 2.41a.6.6 0 0 0-.234.148l-5.4 5.4a.625.625 0 1 0 .884.884l4.333-4.333V17a.625.625 0 1 0 1.25 0V4.509l4.333 4.333a.625.625 0 1 0 .884-.884l-5.4-5.4a.62.62 0 0 0-.65-.147"
|
|
296
|
+
></path></svg
|
|
297
|
+
>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
302
|
+
<div
|
|
303
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
304
|
+
>
|
|
305
|
+
Insert bellow
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</button>
|
|
310
|
+
|
|
311
|
+
<button
|
|
312
|
+
class="table-dropdown-option"
|
|
313
|
+
type="button"
|
|
314
|
+
onclick={() => {
|
|
315
|
+
hideTooltip();
|
|
316
|
+
editor?.chain().focus().deleteRow().run();
|
|
317
|
+
}}
|
|
318
|
+
tabindex="-1"
|
|
319
|
+
>
|
|
320
|
+
<div
|
|
321
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;/* padding-inline: 8px; */"
|
|
322
|
+
>
|
|
323
|
+
<div
|
|
324
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
325
|
+
>
|
|
326
|
+
<div
|
|
327
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
328
|
+
>
|
|
329
|
+
<svg
|
|
330
|
+
aria-hidden="true"
|
|
331
|
+
role="graphics-symbol"
|
|
332
|
+
viewBox="0 0 20 20"
|
|
333
|
+
height="18"
|
|
334
|
+
width="18"
|
|
335
|
+
class="trash"
|
|
336
|
+
fill="currentColor"
|
|
337
|
+
style="display: block;flex-shrink: 0;"
|
|
338
|
+
><path
|
|
339
|
+
d="M8.806 8.505a.55.55 0 0 0-1.1 0v5.979a.55.55 0 1 0 1.1 0zm3.488 0a.55.55 0 0 0-1.1 0v5.979a.55.55 0 1 0 1.1 0z"
|
|
340
|
+
></path><path
|
|
341
|
+
d="M6.386 3.925v1.464H3.523a.625.625 0 1 0 0 1.25h.897l.393 8.646A2.425 2.425 0 0 0 7.236 17.6h5.528a2.425 2.425 0 0 0 2.422-2.315l.393-8.646h.898a.625.625 0 1 0 0-1.25h-2.863V3.925c0-.842-.683-1.525-1.525-1.525H7.91c-.842 0-1.524.683-1.524 1.525M7.91 3.65h4.18c.15 0 .274.123.274.275v1.464H7.636V3.925c0-.152.123-.275.274-.275m-.9 2.99h7.318l-.39 8.588a1.175 1.175 0 0 1-1.174 1.122H7.236a1.175 1.175 0 0 1-1.174-1.122l-.39-8.589z"
|
|
342
|
+
></path></svg
|
|
343
|
+
>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
348
|
+
<div
|
|
349
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
350
|
+
>
|
|
351
|
+
Delete
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
</button>
|
|
356
|
+
</div>
|
|
357
|
+
{/if}
|
|
358
|
+
|
|
359
|
+
{#if currentDropdownType === "column-dropdown"}
|
|
360
|
+
<div class="table-dropdown-options">
|
|
361
|
+
<button
|
|
362
|
+
type="button"
|
|
363
|
+
class="table-dropdown-option"
|
|
364
|
+
onclick={() => {
|
|
365
|
+
editor?.chain().focus().addColumnBefore().run();
|
|
366
|
+
}}
|
|
367
|
+
aria-label="Insert col before"
|
|
368
|
+
tabindex="-1"
|
|
369
|
+
style=""
|
|
370
|
+
>
|
|
371
|
+
<div
|
|
372
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;"
|
|
373
|
+
>
|
|
374
|
+
<div
|
|
375
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
376
|
+
>
|
|
377
|
+
<div
|
|
378
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
379
|
+
>
|
|
380
|
+
<svg
|
|
381
|
+
aria-hidden="true"
|
|
382
|
+
role="graphics-symbol"
|
|
383
|
+
viewBox="0 0 20 20"
|
|
384
|
+
class="arrowStraightLeft directional-icon"
|
|
385
|
+
width="18"
|
|
386
|
+
height="18"
|
|
387
|
+
fill="currentColor"
|
|
388
|
+
style="display: block;flex-shrink: 0;"
|
|
389
|
+
>
|
|
390
|
+
<path
|
|
391
|
+
d="M2.411 9.79a.6.6 0 0 1 .147-.232l5.4-5.4a.625.625 0 1 1 .884.884L4.509 9.375H17a.625.625 0 1 1 0 1.25H4.509l4.333 4.333a.625.625 0 1 1-.884.884l-5.4-5.4a.62.62 0 0 1-.147-.651"
|
|
392
|
+
></path>
|
|
393
|
+
</svg>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
398
|
+
<div
|
|
399
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
400
|
+
>
|
|
401
|
+
Insert left
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
</button>
|
|
406
|
+
|
|
407
|
+
<button
|
|
408
|
+
class="table-dropdown-option"
|
|
409
|
+
aria-label="Insert col after"
|
|
410
|
+
type="button"
|
|
411
|
+
onclick={() => editor?.chain().focus().addColumnAfter().run()}
|
|
412
|
+
tabindex="-1"
|
|
413
|
+
>
|
|
414
|
+
<div
|
|
415
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;/* padding-inline: 8px; */"
|
|
416
|
+
>
|
|
417
|
+
<div
|
|
418
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
419
|
+
>
|
|
420
|
+
<div
|
|
421
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
422
|
+
>
|
|
423
|
+
<svg
|
|
424
|
+
aria-hidden="true"
|
|
425
|
+
role="graphics-symbol"
|
|
426
|
+
viewBox="0 0 20 20"
|
|
427
|
+
class="arrowStraightRight directional-icon"
|
|
428
|
+
width="18"
|
|
429
|
+
height="18"
|
|
430
|
+
fill="currentColor"
|
|
431
|
+
style="display: block; flex-shrink: 0;"
|
|
432
|
+
><path
|
|
433
|
+
d="m17.442 9.558-5.4-5.4a.625.625 0 0 0-.884.884l4.333 4.333H3a.625.625 0 1 0 0 1.25h12.491l-4.333 4.333a.625.625 0 1 0 .884.884l5.4-5.4a.62.62 0 0 0 0-.884"
|
|
434
|
+
></path></svg
|
|
435
|
+
>
|
|
436
|
+
</div>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
440
|
+
<div
|
|
441
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
442
|
+
>
|
|
443
|
+
Insert right
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</button>
|
|
448
|
+
|
|
449
|
+
<button
|
|
450
|
+
class="table-dropdown-option"
|
|
451
|
+
aria-label="Delete column"
|
|
452
|
+
type="button"
|
|
453
|
+
onclick={() => {
|
|
454
|
+
hideTooltip();
|
|
455
|
+
editor?.chain().focus().deleteColumn().run();
|
|
456
|
+
editor.commands.deleteSelection();
|
|
457
|
+
}}
|
|
458
|
+
tabindex="-1"
|
|
459
|
+
>
|
|
460
|
+
<div
|
|
461
|
+
style="display: flex;align-items: center;gap: 7px;line-height: 120%;width: 100%;user-select: none;min-height: 28px;font-size: 14px;/* padding-inline: 8px; */"
|
|
462
|
+
>
|
|
463
|
+
<div
|
|
464
|
+
style="display: flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px;"
|
|
465
|
+
>
|
|
466
|
+
<div
|
|
467
|
+
style="display: flex; align-items: center; justify-content: center; color: var(--c-icoPri);"
|
|
468
|
+
>
|
|
469
|
+
<svg
|
|
470
|
+
aria-hidden="true"
|
|
471
|
+
role="graphics-symbol"
|
|
472
|
+
viewBox="0 0 20 20"
|
|
473
|
+
height="18"
|
|
474
|
+
width="18"
|
|
475
|
+
class="trash"
|
|
476
|
+
fill="currentColor"
|
|
477
|
+
style="display: block;flex-shrink: 0;"
|
|
478
|
+
><path
|
|
479
|
+
d="M8.806 8.505a.55.55 0 0 0-1.1 0v5.979a.55.55 0 1 0 1.1 0zm3.488 0a.55.55 0 0 0-1.1 0v5.979a.55.55 0 1 0 1.1 0z"
|
|
480
|
+
></path><path
|
|
481
|
+
d="M6.386 3.925v1.464H3.523a.625.625 0 1 0 0 1.25h.897l.393 8.646A2.425 2.425 0 0 0 7.236 17.6h5.528a2.425 2.425 0 0 0 2.422-2.315l.393-8.646h.898a.625.625 0 1 0 0-1.25h-2.863V3.925c0-.842-.683-1.525-1.525-1.525H7.91c-.842 0-1.524.683-1.524 1.525M7.91 3.65h4.18c.15 0 .274.123.274.275v1.464H7.636V3.925c0-.152.123-.275.274-.275m-.9 2.99h7.318l-.39 8.588a1.175 1.175 0 0 1-1.174 1.122H7.236a1.175 1.175 0 0 1-1.174-1.122l-.39-8.589z"
|
|
482
|
+
></path></svg
|
|
483
|
+
>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
<div style="margin-inline: 0px; min-width: 0px; flex: 1 1 auto;">
|
|
488
|
+
<div
|
|
489
|
+
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
490
|
+
>
|
|
491
|
+
Delete
|
|
492
|
+
</div>
|
|
493
|
+
</div>
|
|
494
|
+
</div>
|
|
495
|
+
</button>
|
|
496
|
+
</div>
|
|
497
|
+
{/if}
|
|
498
|
+
</div>
|
|
499
|
+
</NodeViewWrapper>
|
|
500
|
+
|
|
501
|
+
<style>
|
|
502
|
+
.grip-row {
|
|
503
|
+
position: absolute;
|
|
504
|
+
left: -12px;
|
|
505
|
+
width: 11px;
|
|
506
|
+
top: 0;
|
|
507
|
+
height: 100%;
|
|
508
|
+
display: flex;
|
|
509
|
+
align-items: center;
|
|
510
|
+
justify-content: center;
|
|
511
|
+
padding: 0;
|
|
512
|
+
color: #ffffff;
|
|
513
|
+
background: #3c3c3c;
|
|
514
|
+
border: none;
|
|
515
|
+
outline: 1px solid #6e6e6e;
|
|
516
|
+
z-index: 5;
|
|
517
|
+
|
|
518
|
+
&:after {
|
|
519
|
+
content: "";
|
|
520
|
+
position: absolute;
|
|
521
|
+
height: 10px;
|
|
522
|
+
border-right: 2px dotted;
|
|
523
|
+
width: 1px;
|
|
524
|
+
color: currentColor;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.grip-col {
|
|
529
|
+
position: absolute;
|
|
530
|
+
top: -12px;
|
|
531
|
+
height: 11px;
|
|
532
|
+
display: flex;
|
|
533
|
+
align-items: center;
|
|
534
|
+
justify-content: center;
|
|
535
|
+
line-height: 0;
|
|
536
|
+
width: 100%;
|
|
537
|
+
left: 0;
|
|
538
|
+
font-size: 9px;
|
|
539
|
+
letter-spacing: 2px;
|
|
540
|
+
padding: 0;
|
|
541
|
+
color: #ffffff;
|
|
542
|
+
background: #3c3c3c;
|
|
543
|
+
border: none;
|
|
544
|
+
outline: 1px solid #6e6e6e;
|
|
545
|
+
z-index: 5;
|
|
546
|
+
|
|
547
|
+
&:after {
|
|
548
|
+
content: "";
|
|
549
|
+
position: absolute;
|
|
550
|
+
height: 1px;
|
|
551
|
+
border-bottom: 2px dotted;
|
|
552
|
+
width: 10px;
|
|
553
|
+
color: currentColor;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.table-dropdown-options {
|
|
558
|
+
width: 100%;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.table-dropdown-option {
|
|
562
|
+
user-select: none;
|
|
563
|
+
cursor: pointer;
|
|
564
|
+
width: 100%;
|
|
565
|
+
display: flex;
|
|
566
|
+
border-radius: 8px;
|
|
567
|
+
border: none;
|
|
568
|
+
background: #ffffff00;
|
|
569
|
+
text-align: left;
|
|
570
|
+
transition: background 0.2s ease-in-out;
|
|
571
|
+
|
|
572
|
+
&:hover {
|
|
573
|
+
background: #91919146;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type TableCellNodeViewProps = typeof __propDef.props;
|
|
10
|
+
export type TableCellNodeViewEvents = typeof __propDef.events;
|
|
11
|
+
export type TableCellNodeViewSlots = typeof __propDef.slots;
|
|
12
|
+
export default class TableCellNodeView extends SvelteComponentTyped<TableCellNodeViewProps, TableCellNodeViewEvents, TableCellNodeViewSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
tableCellSelection: {
|
|
5
|
+
/** Selecciona toda la fila a partir de la posición de una celda */
|
|
6
|
+
selectRow: (cellPos: number) => ReturnType;
|
|
7
|
+
/** Selecciona toda la columna a partir de la posición de una celda */
|
|
8
|
+
selectColumn: (cellPos: number) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const TableCellSelection: Extension<any, any>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { CellSelection } from '@tiptap/pm/tables';
|
|
3
|
+
export const TableCellSelection = Extension.create({
|
|
4
|
+
name: 'tableCellSelection',
|
|
5
|
+
addCommands() {
|
|
6
|
+
return {
|
|
7
|
+
selectRow: (cellPos) => ({ tr, state, dispatch }) => {
|
|
8
|
+
try {
|
|
9
|
+
const $pos = state.doc.resolve(cellPos);
|
|
10
|
+
const selection = CellSelection.rowSelection($pos);
|
|
11
|
+
if (dispatch)
|
|
12
|
+
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
console.warn('No se pudo seleccionar la fila:', err);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
selectColumn: (cellPos) => ({ tr, state, dispatch }) => {
|
|
21
|
+
try {
|
|
22
|
+
const $pos = state.doc.resolve(cellPos);
|
|
23
|
+
const selection = CellSelection.colSelection($pos);
|
|
24
|
+
if (dispatch)
|
|
25
|
+
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
console.warn('No se pudo seleccionar la columna:', err);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const activeAudioId: import("svelte/store").Writable<string>;
|