@harbour-enterprises/superdoc 0.21.0-next.4 → 0.21.0-next.5
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/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-DYQ6TKSD.cjs} +1 -1
- package/dist/chunks/{PdfViewer-D3zo7tPo.es.js → PdfViewer-p-D44U59.es.js} +1 -1
- package/dist/chunks/{index-MzW5BVNd.es.js → index-CDJb8aX-.es.js} +4 -3
- package/dist/chunks/{index-CfYf4T_z.cjs → index-CtZxITmf.cjs} +4 -3
- package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-Do6Vcsbv.cjs} +377 -118
- package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-HiSJrA0J.es.js} +377 -118
- package/dist/core/types/index.d.ts +8 -0
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +32 -27
- package/dist/super-editor/src/components/slash-menu/menuItems.d.ts +5 -1
- package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
- package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
- package/dist/super-editor/style.css +5 -0
- package/dist/super-editor/super-editor.es.js +377 -118
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +379 -119
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -2122,6 +2122,11 @@ on the right if it is inside shape textbox.
|
|
|
2122
2122
|
height: 12px;
|
|
2123
2123
|
width: 12px;
|
|
2124
2124
|
}
|
|
2125
|
+
.slash-menu-custom-item {
|
|
2126
|
+
display: flex;
|
|
2127
|
+
align-items: center;
|
|
2128
|
+
width: 100%;
|
|
2129
|
+
}
|
|
2125
2130
|
.popover {
|
|
2126
2131
|
background: white;
|
|
2127
2132
|
border-radius: 6px;
|
|
@@ -2424,46 +2429,46 @@ img[data-v-7dd69850] {
|
|
|
2424
2429
|
box-shadow: 0 0 5px hsla(0, 0%, 0%, 0.05);
|
|
2425
2430
|
}
|
|
2426
2431
|
|
|
2427
|
-
.superdoc[data-v-
|
|
2432
|
+
.superdoc[data-v-dbfba5b9] {
|
|
2428
2433
|
display: flex;
|
|
2429
2434
|
}
|
|
2430
|
-
.right-sidebar[data-v-
|
|
2435
|
+
.right-sidebar[data-v-dbfba5b9] {
|
|
2431
2436
|
min-width: 320px;
|
|
2432
2437
|
}
|
|
2433
|
-
.floating-comments[data-v-
|
|
2438
|
+
.floating-comments[data-v-dbfba5b9] {
|
|
2434
2439
|
min-width: 300px;
|
|
2435
2440
|
width: 300px;
|
|
2436
2441
|
}
|
|
2437
|
-
.superdoc__layers[data-v-
|
|
2442
|
+
.superdoc__layers[data-v-dbfba5b9] {
|
|
2438
2443
|
height: 100%;
|
|
2439
2444
|
position: relative;
|
|
2440
2445
|
box-sizing: border-box;
|
|
2441
2446
|
}
|
|
2442
|
-
.superdoc__document[data-v-
|
|
2447
|
+
.superdoc__document[data-v-dbfba5b9] {
|
|
2443
2448
|
width: 100%;
|
|
2444
2449
|
position: relative;
|
|
2445
2450
|
}
|
|
2446
|
-
.superdoc__sub-document[data-v-
|
|
2451
|
+
.superdoc__sub-document[data-v-dbfba5b9] {
|
|
2447
2452
|
width: 100%;
|
|
2448
2453
|
position: relative;
|
|
2449
2454
|
}
|
|
2450
|
-
.superdoc__selection-layer[data-v-
|
|
2455
|
+
.superdoc__selection-layer[data-v-dbfba5b9] {
|
|
2451
2456
|
position: absolute;
|
|
2452
2457
|
min-width: 100%;
|
|
2453
2458
|
min-height: 100%;
|
|
2454
2459
|
z-index: 10;
|
|
2455
2460
|
pointer-events: none;
|
|
2456
2461
|
}
|
|
2457
|
-
.superdoc__temp-selection[data-v-
|
|
2462
|
+
.superdoc__temp-selection[data-v-dbfba5b9] {
|
|
2458
2463
|
position: absolute;
|
|
2459
2464
|
}
|
|
2460
|
-
.superdoc__comments-layer[data-v-
|
|
2465
|
+
.superdoc__comments-layer[data-v-dbfba5b9] {
|
|
2461
2466
|
/* position: absolute; */
|
|
2462
2467
|
top: 0;
|
|
2463
2468
|
height: 100%;
|
|
2464
2469
|
position: relative;
|
|
2465
2470
|
}
|
|
2466
|
-
.superdoc__right-sidebar[data-v-
|
|
2471
|
+
.superdoc__right-sidebar[data-v-dbfba5b9] {
|
|
2467
2472
|
width: 320px;
|
|
2468
2473
|
min-width: 320px;
|
|
2469
2474
|
padding: 0 10px;
|
|
@@ -2473,14 +2478,14 @@ img[data-v-7dd69850] {
|
|
|
2473
2478
|
}
|
|
2474
2479
|
|
|
2475
2480
|
/* Tools styles */
|
|
2476
|
-
.tools[data-v-
|
|
2481
|
+
.tools[data-v-dbfba5b9] {
|
|
2477
2482
|
position: absolute;
|
|
2478
2483
|
z-index: 3;
|
|
2479
2484
|
display: flex;
|
|
2480
2485
|
flex-direction: column;
|
|
2481
2486
|
gap: 6px;
|
|
2482
2487
|
}
|
|
2483
|
-
.tools .tool-icon[data-v-
|
|
2488
|
+
.tools .tool-icon[data-v-dbfba5b9] {
|
|
2484
2489
|
font-size: 20px;
|
|
2485
2490
|
border-radius: 12px;
|
|
2486
2491
|
border: none;
|
|
@@ -2488,7 +2493,7 @@ img[data-v-7dd69850] {
|
|
|
2488
2493
|
background-color: #dbdbdb;
|
|
2489
2494
|
cursor: pointer;
|
|
2490
2495
|
}
|
|
2491
|
-
.tools-item[data-v-
|
|
2496
|
+
.tools-item[data-v-dbfba5b9] {
|
|
2492
2497
|
display: flex;
|
|
2493
2498
|
align-items: center;
|
|
2494
2499
|
justify-content: center;
|
|
@@ -2498,10 +2503,10 @@ img[data-v-7dd69850] {
|
|
|
2498
2503
|
border-radius: 12px;
|
|
2499
2504
|
cursor: pointer;
|
|
2500
2505
|
}
|
|
2501
|
-
.tools-item i[data-v-
|
|
2506
|
+
.tools-item i[data-v-dbfba5b9] {
|
|
2502
2507
|
cursor: pointer;
|
|
2503
2508
|
}
|
|
2504
|
-
.superdoc__tools-icon[data-v-
|
|
2509
|
+
.superdoc__tools-icon[data-v-dbfba5b9] {
|
|
2505
2510
|
width: 20px;
|
|
2506
2511
|
height: 20px;
|
|
2507
2512
|
flex-shrink: 0;
|
|
@@ -2516,15 +2521,15 @@ img[data-v-7dd69850] {
|
|
|
2516
2521
|
|
|
2517
2522
|
/* 834px is iPad screen size in portrait orientation */
|
|
2518
2523
|
@media (max-width: 834px) {
|
|
2519
|
-
.superdoc .superdoc__layers[data-v-
|
|
2524
|
+
.superdoc .superdoc__layers[data-v-dbfba5b9] {
|
|
2520
2525
|
margin: 0;
|
|
2521
2526
|
border: 0 !important;
|
|
2522
2527
|
box-shadow: none;
|
|
2523
2528
|
}
|
|
2524
|
-
.superdoc__sub-document[data-v-
|
|
2529
|
+
.superdoc__sub-document[data-v-dbfba5b9] {
|
|
2525
2530
|
max-width: 100%;
|
|
2526
2531
|
}
|
|
2527
|
-
.superdoc__right-sidebar[data-v-
|
|
2532
|
+
.superdoc__right-sidebar[data-v-dbfba5b9] {
|
|
2528
2533
|
padding: 10px;
|
|
2529
2534
|
width: 55px;
|
|
2530
2535
|
position: relative;
|
|
@@ -2532,7 +2537,7 @@ img[data-v-7dd69850] {
|
|
|
2532
2537
|
}
|
|
2533
2538
|
|
|
2534
2539
|
/* AI Writer styles */
|
|
2535
|
-
.ai-writer-container[data-v-
|
|
2540
|
+
.ai-writer-container[data-v-dbfba5b9] {
|
|
2536
2541
|
position: fixed;
|
|
2537
2542
|
z-index: 1000;
|
|
2538
2543
|
background: white;
|
|
@@ -2550,13 +2555,13 @@ img[data-v-7dd69850] {
|
|
|
2550
2555
|
} */
|
|
2551
2556
|
|
|
2552
2557
|
/* Tools styles */
|
|
2553
|
-
.tools[data-v-
|
|
2558
|
+
.tools[data-v-dbfba5b9] {
|
|
2554
2559
|
position: absolute;
|
|
2555
2560
|
z-index: 3;
|
|
2556
2561
|
display: flex;
|
|
2557
2562
|
gap: 6px;
|
|
2558
2563
|
}
|
|
2559
|
-
.tools .tool-icon[data-v-
|
|
2564
|
+
.tools .tool-icon[data-v-dbfba5b9] {
|
|
2560
2565
|
font-size: 20px;
|
|
2561
2566
|
border-radius: 12px;
|
|
2562
2567
|
border: none;
|
|
@@ -2564,7 +2569,7 @@ img[data-v-7dd69850] {
|
|
|
2564
2569
|
background-color: #dbdbdb;
|
|
2565
2570
|
cursor: pointer;
|
|
2566
2571
|
}
|
|
2567
|
-
.tools-item[data-v-
|
|
2572
|
+
.tools-item[data-v-dbfba5b9] {
|
|
2568
2573
|
display: flex;
|
|
2569
2574
|
align-items: center;
|
|
2570
2575
|
justify-content: center;
|
|
@@ -2575,18 +2580,18 @@ img[data-v-7dd69850] {
|
|
|
2575
2580
|
border-radius: 12px;
|
|
2576
2581
|
cursor: pointer;
|
|
2577
2582
|
}
|
|
2578
|
-
.tools-item i[data-v-
|
|
2583
|
+
.tools-item i[data-v-dbfba5b9] {
|
|
2579
2584
|
cursor: pointer;
|
|
2580
2585
|
}
|
|
2581
|
-
.superdoc__tools-icon[data-v-
|
|
2586
|
+
.superdoc__tools-icon[data-v-dbfba5b9] {
|
|
2582
2587
|
width: 20px;
|
|
2583
2588
|
height: 20px;
|
|
2584
2589
|
flex-shrink: 0;
|
|
2585
2590
|
}
|
|
2586
|
-
.ai-tool > svg[data-v-
|
|
2591
|
+
.ai-tool > svg[data-v-dbfba5b9] {
|
|
2587
2592
|
fill: transparent;
|
|
2588
2593
|
}
|
|
2589
|
-
.ai-tool[data-v-
|
|
2594
|
+
.ai-tool[data-v-dbfba5b9]::before {
|
|
2590
2595
|
content: '';
|
|
2591
2596
|
position: absolute;
|
|
2592
2597
|
width: 20px;
|
|
@@ -2607,7 +2612,7 @@ img[data-v-7dd69850] {
|
|
|
2607
2612
|
filter: brightness(1.2);
|
|
2608
2613
|
transition: filter 0.2s ease;
|
|
2609
2614
|
}
|
|
2610
|
-
.ai-tool[data-v-
|
|
2615
|
+
.ai-tool[data-v-dbfba5b9]:hover::before {
|
|
2611
2616
|
filter: brightness(1.3);
|
|
2612
2617
|
}
|
|
2613
2618
|
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* requiresClipboard?: boolean
|
|
15
15
|
* requiresTableParent?: boolean
|
|
16
16
|
* requiredSectionParent?: boolean,
|
|
17
|
-
* requiresModule?: string
|
|
17
|
+
* requiresModule?: string,
|
|
18
|
+
* render?: (context: Object) => HTMLElement,
|
|
19
|
+
* showWhen?: (context: Object) => boolean
|
|
18
20
|
* }>
|
|
19
21
|
* }>} Array of menu sections
|
|
20
22
|
*/
|
|
@@ -32,5 +34,7 @@ export function getItems(context: any): Array<{
|
|
|
32
34
|
requiresTableParent?: boolean;
|
|
33
35
|
requiredSectionParent?: boolean;
|
|
34
36
|
requiresModule?: string;
|
|
37
|
+
render?: (context: any) => HTMLElement;
|
|
38
|
+
showWhen?: (context: any) => boolean;
|
|
35
39
|
}>;
|
|
36
40
|
}>;
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test helper utilities for slash menu components
|
|
3
|
+
* Extracts shared patterns from utils.test.js, SlashMenu.test.js, and menuItems.test.js
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Creates a mock ProseMirror selection object with configurable properties
|
|
7
|
+
*/
|
|
8
|
+
export function createMockSelection(options?: {}): {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
empty: boolean;
|
|
12
|
+
$head: {
|
|
13
|
+
marks: import("vitest").Mock<() => {
|
|
14
|
+
type: {
|
|
15
|
+
name: any;
|
|
16
|
+
};
|
|
17
|
+
}[]>;
|
|
18
|
+
};
|
|
19
|
+
$from: {
|
|
20
|
+
depth: number;
|
|
21
|
+
node: import("vitest").Mock<() => {
|
|
22
|
+
type: {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
$to: {
|
|
28
|
+
depth: number;
|
|
29
|
+
node: import("vitest").Mock<() => {
|
|
30
|
+
type: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
constructor: {
|
|
36
|
+
near: import("vitest").Mock<() => {
|
|
37
|
+
from: number;
|
|
38
|
+
to: number;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Creates a mock ProseMirror state object with configurable properties
|
|
44
|
+
*/
|
|
45
|
+
export function createMockState(options?: {}): {
|
|
46
|
+
selection: {
|
|
47
|
+
from: number;
|
|
48
|
+
to: number;
|
|
49
|
+
empty: boolean;
|
|
50
|
+
$head: {
|
|
51
|
+
marks: import("vitest").Mock<() => {
|
|
52
|
+
type: {
|
|
53
|
+
name: any;
|
|
54
|
+
};
|
|
55
|
+
}[]>;
|
|
56
|
+
};
|
|
57
|
+
$from: {
|
|
58
|
+
depth: number;
|
|
59
|
+
node: import("vitest").Mock<() => {
|
|
60
|
+
type: {
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
$to: {
|
|
66
|
+
depth: number;
|
|
67
|
+
node: import("vitest").Mock<() => {
|
|
68
|
+
type: {
|
|
69
|
+
name: string;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
constructor: {
|
|
74
|
+
near: import("vitest").Mock<() => {
|
|
75
|
+
from: number;
|
|
76
|
+
to: number;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
doc: {
|
|
81
|
+
textBetween: import("vitest").Mock<() => string>;
|
|
82
|
+
nodeAt: import("vitest").Mock<() => {
|
|
83
|
+
type: {
|
|
84
|
+
name: string;
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
87
|
+
resolve: import("vitest").Mock<() => {}>;
|
|
88
|
+
};
|
|
89
|
+
schema: {
|
|
90
|
+
marks: {};
|
|
91
|
+
nodes: {
|
|
92
|
+
paragraph: {
|
|
93
|
+
name: string;
|
|
94
|
+
};
|
|
95
|
+
table: {
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
bulletList: {
|
|
99
|
+
name: string;
|
|
100
|
+
};
|
|
101
|
+
documentSection: {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
storedMarks: any;
|
|
107
|
+
history: {
|
|
108
|
+
undoDepth: number;
|
|
109
|
+
redoDepth: number;
|
|
110
|
+
};
|
|
111
|
+
tr: {
|
|
112
|
+
setMeta: import("vitest").Mock<() => any>;
|
|
113
|
+
setSelection: import("vitest").Mock<() => any>;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Creates a mock ProseMirror view object with configurable properties
|
|
118
|
+
*/
|
|
119
|
+
export function createMockView(options?: {}): {
|
|
120
|
+
state: {
|
|
121
|
+
selection: {
|
|
122
|
+
from: number;
|
|
123
|
+
to: number;
|
|
124
|
+
empty: boolean;
|
|
125
|
+
$head: {
|
|
126
|
+
marks: import("vitest").Mock<() => {
|
|
127
|
+
type: {
|
|
128
|
+
name: any;
|
|
129
|
+
};
|
|
130
|
+
}[]>;
|
|
131
|
+
};
|
|
132
|
+
$from: {
|
|
133
|
+
depth: number;
|
|
134
|
+
node: import("vitest").Mock<() => {
|
|
135
|
+
type: {
|
|
136
|
+
name: string;
|
|
137
|
+
};
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
$to: {
|
|
141
|
+
depth: number;
|
|
142
|
+
node: import("vitest").Mock<() => {
|
|
143
|
+
type: {
|
|
144
|
+
name: string;
|
|
145
|
+
};
|
|
146
|
+
}>;
|
|
147
|
+
};
|
|
148
|
+
constructor: {
|
|
149
|
+
near: import("vitest").Mock<() => {
|
|
150
|
+
from: number;
|
|
151
|
+
to: number;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
doc: {
|
|
156
|
+
textBetween: import("vitest").Mock<() => string>;
|
|
157
|
+
nodeAt: import("vitest").Mock<() => {
|
|
158
|
+
type: {
|
|
159
|
+
name: string;
|
|
160
|
+
};
|
|
161
|
+
}>;
|
|
162
|
+
resolve: import("vitest").Mock<() => {}>;
|
|
163
|
+
};
|
|
164
|
+
schema: {
|
|
165
|
+
marks: {};
|
|
166
|
+
nodes: {
|
|
167
|
+
paragraph: {
|
|
168
|
+
name: string;
|
|
169
|
+
};
|
|
170
|
+
table: {
|
|
171
|
+
name: string;
|
|
172
|
+
};
|
|
173
|
+
bulletList: {
|
|
174
|
+
name: string;
|
|
175
|
+
};
|
|
176
|
+
documentSection: {
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
storedMarks: any;
|
|
182
|
+
history: {
|
|
183
|
+
undoDepth: number;
|
|
184
|
+
redoDepth: number;
|
|
185
|
+
};
|
|
186
|
+
tr: {
|
|
187
|
+
setMeta: import("vitest").Mock<() => any>;
|
|
188
|
+
setSelection: import("vitest").Mock<() => any>;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
coordsAtPos: import("vitest").Mock<() => {
|
|
192
|
+
left: number;
|
|
193
|
+
top: number;
|
|
194
|
+
}>;
|
|
195
|
+
posAtCoords: import("vitest").Mock<() => {
|
|
196
|
+
pos: number;
|
|
197
|
+
}>;
|
|
198
|
+
dispatch: import("vitest").Mock<(...args: any[]) => any>;
|
|
199
|
+
focus: import("vitest").Mock<(...args: any[]) => any>;
|
|
200
|
+
dom: {
|
|
201
|
+
addEventListener: import("vitest").Mock<(...args: any[]) => any>;
|
|
202
|
+
removeEventListener: import("vitest").Mock<(...args: any[]) => any>;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Creates a mock editor object with configurable options
|
|
207
|
+
*/
|
|
208
|
+
export function createMockEditor(options?: {}): {
|
|
209
|
+
view: {
|
|
210
|
+
state: {
|
|
211
|
+
selection: {
|
|
212
|
+
from: number;
|
|
213
|
+
to: number;
|
|
214
|
+
empty: boolean;
|
|
215
|
+
$head: {
|
|
216
|
+
marks: import("vitest").Mock<() => {
|
|
217
|
+
type: {
|
|
218
|
+
name: any;
|
|
219
|
+
};
|
|
220
|
+
}[]>;
|
|
221
|
+
};
|
|
222
|
+
$from: {
|
|
223
|
+
depth: number;
|
|
224
|
+
node: import("vitest").Mock<() => {
|
|
225
|
+
type: {
|
|
226
|
+
name: string;
|
|
227
|
+
};
|
|
228
|
+
}>;
|
|
229
|
+
};
|
|
230
|
+
$to: {
|
|
231
|
+
depth: number;
|
|
232
|
+
node: import("vitest").Mock<() => {
|
|
233
|
+
type: {
|
|
234
|
+
name: string;
|
|
235
|
+
};
|
|
236
|
+
}>;
|
|
237
|
+
};
|
|
238
|
+
constructor: {
|
|
239
|
+
near: import("vitest").Mock<() => {
|
|
240
|
+
from: number;
|
|
241
|
+
to: number;
|
|
242
|
+
}>;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
doc: {
|
|
246
|
+
textBetween: import("vitest").Mock<() => string>;
|
|
247
|
+
nodeAt: import("vitest").Mock<() => {
|
|
248
|
+
type: {
|
|
249
|
+
name: string;
|
|
250
|
+
};
|
|
251
|
+
}>;
|
|
252
|
+
resolve: import("vitest").Mock<() => {}>;
|
|
253
|
+
};
|
|
254
|
+
schema: {
|
|
255
|
+
marks: {};
|
|
256
|
+
nodes: {
|
|
257
|
+
paragraph: {
|
|
258
|
+
name: string;
|
|
259
|
+
};
|
|
260
|
+
table: {
|
|
261
|
+
name: string;
|
|
262
|
+
};
|
|
263
|
+
bulletList: {
|
|
264
|
+
name: string;
|
|
265
|
+
};
|
|
266
|
+
documentSection: {
|
|
267
|
+
name: string;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
storedMarks: any;
|
|
272
|
+
history: {
|
|
273
|
+
undoDepth: number;
|
|
274
|
+
redoDepth: number;
|
|
275
|
+
};
|
|
276
|
+
tr: {
|
|
277
|
+
setMeta: import("vitest").Mock<() => any>;
|
|
278
|
+
setSelection: import("vitest").Mock<() => any>;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
coordsAtPos: import("vitest").Mock<() => {
|
|
282
|
+
left: number;
|
|
283
|
+
top: number;
|
|
284
|
+
}>;
|
|
285
|
+
posAtCoords: import("vitest").Mock<() => {
|
|
286
|
+
pos: number;
|
|
287
|
+
}>;
|
|
288
|
+
dispatch: import("vitest").Mock<(...args: any[]) => any>;
|
|
289
|
+
focus: import("vitest").Mock<(...args: any[]) => any>;
|
|
290
|
+
dom: {
|
|
291
|
+
addEventListener: import("vitest").Mock<(...args: any[]) => any>;
|
|
292
|
+
removeEventListener: import("vitest").Mock<(...args: any[]) => any>;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
options: {
|
|
296
|
+
documentMode: string;
|
|
297
|
+
isAiEnabled: boolean;
|
|
298
|
+
slashMenuConfig: any;
|
|
299
|
+
aiApiKey: any;
|
|
300
|
+
aiEndpoint: any;
|
|
301
|
+
};
|
|
302
|
+
isEditable: boolean;
|
|
303
|
+
commands: any;
|
|
304
|
+
on: import("vitest").Mock<(...args: any[]) => any>;
|
|
305
|
+
off: import("vitest").Mock<(...args: any[]) => any>;
|
|
306
|
+
emit: import("vitest").Mock<(...args: any[]) => any>;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Creates a mock editor context object for slash menu utilities
|
|
310
|
+
*/
|
|
311
|
+
export function createMockContext(options?: {}): {
|
|
312
|
+
editor: any;
|
|
313
|
+
cursorPosition: {
|
|
314
|
+
x: number;
|
|
315
|
+
y: number;
|
|
316
|
+
};
|
|
317
|
+
pos: number;
|
|
318
|
+
node: {
|
|
319
|
+
type: {
|
|
320
|
+
name: string;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
event: any;
|
|
324
|
+
selectedText: string;
|
|
325
|
+
hasSelection: boolean;
|
|
326
|
+
trigger: string;
|
|
327
|
+
clipboardContent: {
|
|
328
|
+
html: any;
|
|
329
|
+
text: any;
|
|
330
|
+
hasContent: boolean;
|
|
331
|
+
};
|
|
332
|
+
selectionStart: number;
|
|
333
|
+
selectionEnd: number;
|
|
334
|
+
isInTable: boolean;
|
|
335
|
+
isInList: boolean;
|
|
336
|
+
isInSectionNode: boolean;
|
|
337
|
+
currentNodeType: string;
|
|
338
|
+
activeMarks: any[];
|
|
339
|
+
isTrackedChange: boolean;
|
|
340
|
+
documentMode: string;
|
|
341
|
+
canUndo: boolean;
|
|
342
|
+
canRedo: boolean;
|
|
343
|
+
isEditable: boolean;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Sets up common mocks and returns cleanup functions
|
|
347
|
+
* Returns an object with mock functions and a cleanup function
|
|
348
|
+
*/
|
|
349
|
+
export function setupCommonMocks(): {
|
|
350
|
+
mocks: {
|
|
351
|
+
readFromClipboard: import("vitest").Mock<(...args: any[]) => any>;
|
|
352
|
+
selectionHasNodeOrMark: import("vitest").Mock<() => boolean>;
|
|
353
|
+
moveCursorToMouseEvent: import("vitest").Mock<(...args: any[]) => any>;
|
|
354
|
+
handleClipboardPaste: import("vitest").Mock<() => boolean>;
|
|
355
|
+
};
|
|
356
|
+
spies: {
|
|
357
|
+
docAddEventListener: import("vitest").MockInstance<{
|
|
358
|
+
<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
359
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
360
|
+
}>;
|
|
361
|
+
docRemoveEventListener: import("vitest").MockInstance<{
|
|
362
|
+
<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
363
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
364
|
+
}>;
|
|
365
|
+
};
|
|
366
|
+
cleanup: () => void;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Creates a beforeEach setup function with common mock resets
|
|
370
|
+
* Has a callback for any custom setup that needs to be done before each test
|
|
371
|
+
*/
|
|
372
|
+
export function createBeforeEachSetup(customSetup?: () => void): () => void;
|
|
373
|
+
/**
|
|
374
|
+
* Mounts a Vue component with common props and returns wrapper with helper methods
|
|
375
|
+
*/
|
|
376
|
+
export function mountSlashMenuComponent(component: any, options?: {}): {
|
|
377
|
+
wrapper: import("@vue/test-utils").VueWrapper<unknown, import("vue").ComponentPublicInstance<unknown, Omit<unknown, never>>>;
|
|
378
|
+
props: any;
|
|
379
|
+
openMenu(menuPosition?: {
|
|
380
|
+
left: string;
|
|
381
|
+
top: string;
|
|
382
|
+
}): Promise<void>;
|
|
383
|
+
closeMenu(): Promise<void>;
|
|
384
|
+
triggerKeydown(key: any, target?: string): Promise<void>;
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* Filters menu items by various criteria (helper for testing menu item filtering)
|
|
388
|
+
*/
|
|
389
|
+
export function filterMenuItems(sections: any, criteria?: {}): any;
|
|
390
|
+
/**
|
|
391
|
+
* Creates mock menu items for testing
|
|
392
|
+
*/
|
|
393
|
+
export function createMockMenuItems(count?: number, customItems?: any[]): {
|
|
394
|
+
id: string;
|
|
395
|
+
items: any[];
|
|
396
|
+
}[];
|
|
397
|
+
/**
|
|
398
|
+
* Creates a mock item with custom render function for testing
|
|
399
|
+
*/
|
|
400
|
+
export function createMockRenderItem(id?: string, renderFn?: any): {
|
|
401
|
+
id: string;
|
|
402
|
+
label: string;
|
|
403
|
+
render: any;
|
|
404
|
+
allowedTriggers: string[];
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Common assertions for editor mock objects
|
|
408
|
+
*/
|
|
409
|
+
export function assertEditorMockStructure(editor: any): void;
|
|
410
|
+
/**
|
|
411
|
+
* Common assertions for menu sections structure
|
|
412
|
+
*/
|
|
413
|
+
export function assertMenuSectionsStructure(sections: any): void;
|
|
414
|
+
/**
|
|
415
|
+
* Asserts that event listeners are properly set up
|
|
416
|
+
*/
|
|
417
|
+
export function assertEventListenersSetup(editor: any, documentSpies: any): void;
|
|
418
|
+
/**
|
|
419
|
+
* Asserts that event listeners are properly cleaned up
|
|
420
|
+
*/
|
|
421
|
+
export function assertEventListenersCleanup(editor: any, documentSpies: any): void;
|
|
422
|
+
export namespace SlashMenuConfigs {
|
|
423
|
+
namespace withAI {
|
|
424
|
+
let includeDefaultItems: boolean;
|
|
425
|
+
let customItems: any[];
|
|
426
|
+
}
|
|
427
|
+
namespace customOnly {
|
|
428
|
+
let includeDefaultItems_1: boolean;
|
|
429
|
+
export { includeDefaultItems_1 as includeDefaultItems };
|
|
430
|
+
let customItems_1: {
|
|
431
|
+
id: string;
|
|
432
|
+
items: {
|
|
433
|
+
id: string;
|
|
434
|
+
label: string;
|
|
435
|
+
allowedTriggers: string[];
|
|
436
|
+
action: import("vitest").Mock<(...args: any[]) => any>;
|
|
437
|
+
}[];
|
|
438
|
+
}[];
|
|
439
|
+
export { customItems_1 as customItems };
|
|
440
|
+
}
|
|
441
|
+
function withProvider(providerFn: any): {
|
|
442
|
+
includeDefaultItems: boolean;
|
|
443
|
+
menuProvider: any;
|
|
444
|
+
};
|
|
445
|
+
namespace withConditionalItems {
|
|
446
|
+
let includeDefaultItems_2: boolean;
|
|
447
|
+
export { includeDefaultItems_2 as includeDefaultItems };
|
|
448
|
+
let customItems_2: {
|
|
449
|
+
id: string;
|
|
450
|
+
items: ({
|
|
451
|
+
id: string;
|
|
452
|
+
label: string;
|
|
453
|
+
allowedTriggers: string[];
|
|
454
|
+
action: import("vitest").Mock<(...args: any[]) => any>;
|
|
455
|
+
showWhen?: undefined;
|
|
456
|
+
} | {
|
|
457
|
+
id: string;
|
|
458
|
+
label: string;
|
|
459
|
+
allowedTriggers: string[];
|
|
460
|
+
action: import("vitest").Mock<(...args: any[]) => any>;
|
|
461
|
+
showWhen: (context: any) => any;
|
|
462
|
+
})[];
|
|
463
|
+
}[];
|
|
464
|
+
export { customItems_2 as customItems };
|
|
465
|
+
}
|
|
466
|
+
}
|
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {Object} editor - The editor instance
|
|
5
5
|
* @param {MouseEvent} [event] - Optional mouse event (for context menu)
|
|
6
|
-
* @returns {Object} context -
|
|
6
|
+
* @returns {Promise<Object>} context - Enhanced editor context with comprehensive state information
|
|
7
7
|
*/
|
|
8
|
-
export function getEditorContext(editor: any, event?: MouseEvent): any
|
|
8
|
+
export function getEditorContext(editor: any, event?: MouseEvent): Promise<any>;
|
|
9
9
|
export function getPropsByItemId(itemId: string, props: any): any;
|
|
10
|
+
declare function getStructureFromResolvedPos(state: any, pos: any): {
|
|
11
|
+
isInTable: boolean;
|
|
12
|
+
isInList: boolean;
|
|
13
|
+
isInSectionNode: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function isCollaborationEnabled(editor: any): boolean;
|
|
16
|
+
export { getStructureFromResolvedPos as __getStructureFromResolvedPosForTest, isCollaborationEnabled as __isCollaborationEnabledForTest };
|
|
@@ -1748,6 +1748,11 @@ on the right if it is inside shape textbox.
|
|
|
1748
1748
|
height: 12px;
|
|
1749
1749
|
width: 12px;
|
|
1750
1750
|
}
|
|
1751
|
+
.slash-menu-custom-item {
|
|
1752
|
+
display: flex;
|
|
1753
|
+
align-items: center;
|
|
1754
|
+
width: 100%;
|
|
1755
|
+
}
|
|
1751
1756
|
.popover {
|
|
1752
1757
|
background: white;
|
|
1753
1758
|
border-radius: 6px;
|