@prosekit/basic 0.5.4 → 0.6.1
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/prosekit-basic.d.ts +1 -3
- package/dist/prosekit-basic.js +1 -3
- package/dist/style.css +124 -84
- package/dist/typography.css +20 -18
- package/package.json +7 -7
package/dist/prosekit-basic.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { BoldExtension } from "@prosekit/extensions/bold";
|
|
|
4
4
|
import { CodeExtension } from "@prosekit/extensions/code";
|
|
5
5
|
import { CodeBlockExtension } from "@prosekit/extensions/code-block";
|
|
6
6
|
import { DocExtension } from "@prosekit/extensions/doc";
|
|
7
|
-
import { DropCursorExtension } from "@prosekit/extensions/drop-cursor";
|
|
8
7
|
import { GapCursorExtension } from "@prosekit/extensions/gap-cursor";
|
|
9
8
|
import { HardBreakExtension } from "@prosekit/extensions/hard-break";
|
|
10
9
|
import { HeadingExtension } from "@prosekit/extensions/heading";
|
|
@@ -26,7 +25,7 @@ import { VirtualSelectionExtension } from "@prosekit/extensions/virtual-selectio
|
|
|
26
25
|
/**
|
|
27
26
|
* @internal
|
|
28
27
|
*/
|
|
29
|
-
type BasicExtension = Union<[DocExtension, TextExtension, ParagraphExtension, HeadingExtension, ListExtension, BlockquoteExtension, ImageExtension, HorizontalRuleExtension, HardBreakExtension, TableExtension, CodeBlockExtension, ItalicExtension, BoldExtension, UnderlineExtension, StrikeExtension, CodeExtension, LinkExtension, BaseKeymapExtension, BaseCommandsExtension, HistoryExtension,
|
|
28
|
+
type BasicExtension = Union<[DocExtension, TextExtension, ParagraphExtension, HeadingExtension, ListExtension, BlockquoteExtension, ImageExtension, HorizontalRuleExtension, HardBreakExtension, TableExtension, CodeBlockExtension, ItalicExtension, BoldExtension, UnderlineExtension, StrikeExtension, CodeExtension, LinkExtension, BaseKeymapExtension, BaseCommandsExtension, HistoryExtension, GapCursorExtension, VirtualSelectionExtension, ModClickPreventionExtension]>;
|
|
30
29
|
/**
|
|
31
30
|
* Define a basic extension that includes some common functionality. You can
|
|
32
31
|
* copy this function and customize it to your needs.
|
|
@@ -53,7 +52,6 @@ type BasicExtension = Union<[DocExtension, TextExtension, ParagraphExtension, He
|
|
|
53
52
|
* - {@link defineBaseKeymap}
|
|
54
53
|
* - {@link defineBaseCommands}
|
|
55
54
|
* - {@link defineHistory}
|
|
56
|
-
* - {@link defineDropCursor}
|
|
57
55
|
* - {@link defineGapCursor}
|
|
58
56
|
* - {@link defineVirtualSelection}
|
|
59
57
|
* - {@link defineModClickPrevention}
|
package/dist/prosekit-basic.js
CHANGED
|
@@ -4,7 +4,6 @@ import { defineBold } from "@prosekit/extensions/bold";
|
|
|
4
4
|
import { defineCode } from "@prosekit/extensions/code";
|
|
5
5
|
import { defineCodeBlock } from "@prosekit/extensions/code-block";
|
|
6
6
|
import { defineDoc } from "@prosekit/extensions/doc";
|
|
7
|
-
import { defineDropCursor } from "@prosekit/extensions/drop-cursor";
|
|
8
7
|
import { defineGapCursor } from "@prosekit/extensions/gap-cursor";
|
|
9
8
|
import { defineHardBreak } from "@prosekit/extensions/hard-break";
|
|
10
9
|
import { defineHeading } from "@prosekit/extensions/heading";
|
|
@@ -48,7 +47,6 @@ import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
|
|
|
48
47
|
* - {@link defineBaseKeymap}
|
|
49
48
|
* - {@link defineBaseCommands}
|
|
50
49
|
* - {@link defineHistory}
|
|
51
|
-
* - {@link defineDropCursor}
|
|
52
50
|
* - {@link defineGapCursor}
|
|
53
51
|
* - {@link defineVirtualSelection}
|
|
54
52
|
* - {@link defineModClickPrevention}
|
|
@@ -56,7 +54,7 @@ import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
|
|
|
56
54
|
* @public
|
|
57
55
|
*/
|
|
58
56
|
function defineBasicExtension() {
|
|
59
|
-
return union(defineDoc(), defineText(), defineParagraph(), defineHeading(), defineList(), defineBlockquote(), defineImage(), defineHorizontalRule(), defineHardBreak(), defineTable(), defineCodeBlock(), defineItalic(), defineBold(), defineUnderline(), defineStrike(), defineCode(), defineLink(), defineBaseKeymap(), defineBaseCommands(), defineHistory(),
|
|
57
|
+
return union(defineDoc(), defineText(), defineParagraph(), defineHeading(), defineList(), defineBlockquote(), defineImage(), defineHorizontalRule(), defineHardBreak(), defineTable(), defineCodeBlock(), defineItalic(), defineBold(), defineUnderline(), defineStrike(), defineCode(), defineLink(), defineBaseKeymap(), defineBaseCommands(), defineHistory(), defineGapCursor(), defineVirtualSelection(), defineModClickPrevention());
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
//#endregion
|
package/dist/style.css
CHANGED
|
@@ -54,94 +54,134 @@ img.ProseMirror-separator {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
margin-bottom: 0;
|
|
62
|
-
margin-left: 32px;
|
|
63
|
-
margin-bottom: 0;
|
|
64
|
-
position: relative;
|
|
65
|
-
display: list-item;
|
|
66
|
-
list-style: none;
|
|
67
|
-
}
|
|
68
|
-
.prosemirror-flat-list.ProseMirror-selectednode {
|
|
69
|
-
outline: none;
|
|
70
|
-
}
|
|
71
|
-
.prosemirror-flat-list.ProseMirror-selectednode:after {
|
|
72
|
-
content: "";
|
|
73
|
-
position: absolute;
|
|
74
|
-
left: -32px;
|
|
75
|
-
right: -2px;
|
|
76
|
-
top: -2px;
|
|
77
|
-
bottom: -2px;
|
|
78
|
-
border: 2px solid #8cf;
|
|
79
|
-
pointer-events: none;
|
|
80
|
-
}
|
|
81
|
-
.prosemirror-flat-list[data-list-kind=bullet] {
|
|
82
|
-
list-style: disc;
|
|
83
|
-
}
|
|
84
|
-
.prosemirror-flat-list[data-list-kind=ordered] > * {
|
|
85
|
-
contain: style;
|
|
57
|
+
:root {
|
|
58
|
+
--prosekit-list-bullet-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='2.5' fill='currentColor'/%3E%3C/svg%3E");
|
|
59
|
+
--prosekit-list-toggle-open-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpolygon points='8,10 12,14 16,10' fill='currentColor'/%3E%3C/svg%3E");
|
|
60
|
+
--prosekit-list-toggle-closed-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpolygon points='10,8 14,12 10,16' fill='currentColor'/%3E%3C/svg%3E");
|
|
86
61
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
counter-increment: prosemirror-flat-list-counter;
|
|
95
|
-
}
|
|
96
|
-
.prosemirror-flat-list[data-list-kind=ordered]:first-child,
|
|
97
|
-
:not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered] {
|
|
98
|
-
counter-reset: prosemirror-flat-list-counter;
|
|
99
|
-
}
|
|
100
|
-
@supports (counter-set: prosemirror-flat-list-counter 1) {
|
|
101
|
-
[data-list-order]:is(.prosemirror-flat-list[data-list-kind=ordered]:first-child, :not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered]) {
|
|
102
|
-
counter-set: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
|
|
62
|
+
|
|
63
|
+
.prosemirror-flat-list {
|
|
64
|
+
& {
|
|
65
|
+
position: relative;
|
|
66
|
+
margin: 0;
|
|
67
|
+
padding: 0;
|
|
68
|
+
list-style: none;
|
|
103
69
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
70
|
+
|
|
71
|
+
& > .list-marker {
|
|
72
|
+
position: absolute;
|
|
73
|
+
left: 0;
|
|
74
|
+
width: 1.5em;
|
|
75
|
+
width: 1lh;
|
|
76
|
+
height: 1.5em;
|
|
77
|
+
height: 1lh;
|
|
78
|
+
text-align: center;
|
|
108
79
|
}
|
|
109
|
-
}
|
|
110
|
-
.prosemirror-flat-list[data-list-kind=task] > .list-marker {
|
|
111
|
-
position: absolute;
|
|
112
|
-
right: 100%;
|
|
113
|
-
text-align: center;
|
|
114
|
-
width: 1.5em;
|
|
115
|
-
width: 1lh;
|
|
116
|
-
}
|
|
117
|
-
:is(.prosemirror-flat-list[data-list-kind=task] > .list-marker),
|
|
118
|
-
:is(.prosemirror-flat-list[data-list-kind=task] > .list-marker) * {
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
}
|
|
121
|
-
.prosemirror-flat-list[data-list-kind=toggle] > .list-marker {
|
|
122
|
-
position: absolute;
|
|
123
|
-
right: 100%;
|
|
124
|
-
text-align: center;
|
|
125
|
-
width: 1.5em;
|
|
126
|
-
width: 1lh;
|
|
127
|
-
}
|
|
128
|
-
.prosemirror-flat-list[data-list-kind=toggle] > .list-marker::before {
|
|
129
|
-
content: "\23f7";
|
|
130
|
-
}
|
|
131
|
-
.prosemirror-flat-list[data-list-kind=toggle][data-list-collapsable][data-list-collapsed] > .list-marker::before {
|
|
132
|
-
content: "\23f5";
|
|
133
|
-
}
|
|
134
|
-
.prosemirror-flat-list[data-list-kind=toggle][data-list-collapsable] > .list-marker {
|
|
135
|
-
cursor: pointer;
|
|
136
|
-
}
|
|
137
|
-
.prosemirror-flat-list[data-list-kind=toggle]:not([data-list-collapsable]) > .list-marker {
|
|
138
|
-
opacity: 40%;
|
|
139
|
-
pointer-events: none;
|
|
140
|
-
}
|
|
141
|
-
.prosemirror-flat-list[data-list-kind=toggle][data-list-collapsable][data-list-collapsed] > .list-content > *:nth-child(n+2) {
|
|
142
|
-
display: none;
|
|
143
|
-
}
|
|
144
80
|
|
|
81
|
+
& > .list-content {
|
|
82
|
+
margin-left: 1.5em;
|
|
83
|
+
margin-left: 1lh;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&[data-list-kind="bullet"] > .list-marker,
|
|
87
|
+
&[data-list-kind="toggle"] > .list-marker {
|
|
88
|
+
background-color: currentColor;
|
|
89
|
+
mask-position: center;
|
|
90
|
+
mask-repeat: no-repeat;
|
|
91
|
+
mask-size: contain;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&[data-list-kind="bullet"] {
|
|
95
|
+
& > .list-marker {
|
|
96
|
+
mask-image: var(--prosekit-list-bullet-icon);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&[data-list-kind="toggle"] {
|
|
101
|
+
& > .list-marker {
|
|
102
|
+
mask-image: var(--prosekit-list-toggle-open-icon);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&[data-list-collapsable][data-list-collapsed] > .list-marker {
|
|
106
|
+
mask-image: var(--prosekit-list-toggle-closed-icon);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&[data-list-kind="ordered"] {
|
|
111
|
+
/*
|
|
112
|
+
Ensure that the counters in children don't escape, so that the sub lists
|
|
113
|
+
won't affect the counter of the parent list.
|
|
114
|
+
|
|
115
|
+
See also https://github.com/ocavue/prosemirror-flat-list/issues/23
|
|
116
|
+
*/
|
|
117
|
+
& > * {
|
|
118
|
+
contain: style;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&::before {
|
|
122
|
+
position: absolute;
|
|
123
|
+
right: calc(100% - 1.5em);
|
|
124
|
+
right: calc(100% - 1lh);
|
|
125
|
+
content: counter(prosemirror-flat-list-counter, decimal) ". ";
|
|
126
|
+
font-variant-numeric: tabular-nums;
|
|
127
|
+
}
|
|
128
|
+
counter-increment: prosemirror-flat-list-counter;
|
|
129
|
+
|
|
130
|
+
/*
|
|
131
|
+
Reset the counter for the first list node in the sequence.
|
|
132
|
+
*/
|
|
133
|
+
&:first-child,
|
|
134
|
+
:not(&) + & {
|
|
135
|
+
counter-reset: prosemirror-flat-list-counter;
|
|
136
|
+
|
|
137
|
+
/*
|
|
138
|
+
If the first list node has a custom order number, set the counter to that value.
|
|
139
|
+
*/
|
|
140
|
+
&[data-list-order] {
|
|
141
|
+
@supports (counter-set: prosemirror-flat-list-counter 1) {
|
|
142
|
+
counter-set: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
Safari older than version 17.2 doesn't support `counter-set`
|
|
147
|
+
*/
|
|
148
|
+
@supports not (counter-set: prosemirror-flat-list-counter 1) {
|
|
149
|
+
counter-increment: prosemirror-flat-list-counter var(--prosemirror-flat-list-order);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&[data-list-kind="task"] {
|
|
156
|
+
& > .list-marker {
|
|
157
|
+
&,
|
|
158
|
+
& * {
|
|
159
|
+
/* Make sure that the checkbox is at the center */
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&[data-list-kind="toggle"] {
|
|
171
|
+
&[data-list-collapsable] > .list-marker {
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
}
|
|
174
|
+
&:not([data-list-collapsable]) > .list-marker {
|
|
175
|
+
opacity: 40%;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* If collapsed, hide the second and futher children */
|
|
180
|
+
&[data-list-collapsable][data-list-collapsed] > .list-content > *:nth-child(n+2) {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
145
185
|
|
|
146
186
|
.ProseMirror .tableWrapper {
|
|
147
187
|
overflow-x: auto;
|
package/dist/typography.css
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--prosekit-node-selection-color: rgba(57, 136, 255, 0.2);
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.ProseMirror {
|
|
2
6
|
& {
|
|
3
7
|
/* Disable margin collapsing */
|
|
@@ -162,13 +166,13 @@
|
|
|
162
166
|
&:has(> div.list-content > h1) {
|
|
163
167
|
&::before,
|
|
164
168
|
& > .list-marker {
|
|
165
|
-
top:
|
|
169
|
+
top: 0.75em;
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
&:has(> div.list-content > h2) {
|
|
169
173
|
&::before,
|
|
170
174
|
& > .list-marker {
|
|
171
|
-
top: 0.
|
|
175
|
+
top: 0.5em;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
&:has(> div.list-content > h3) {
|
|
@@ -186,31 +190,17 @@
|
|
|
186
190
|
&:has(> div.list-content > h5) {
|
|
187
191
|
&::before,
|
|
188
192
|
& > .list-marker {
|
|
189
|
-
top: -0.
|
|
193
|
+
top: -0.2em;
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
196
|
&:has(> div.list-content > h6) {
|
|
193
197
|
&::before,
|
|
194
198
|
& > .list-marker {
|
|
195
|
-
top: -0.
|
|
199
|
+
top: -0.3em;
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
/*
|
|
201
|
-
In Chrome, when an editor is styled with a background color and a selected
|
|
202
|
-
node is dragged, the dragged element inherits this background color, along
|
|
203
|
-
with an additional shadow effect. This visual is not ideal, especially when
|
|
204
|
-
the dragged element lacks any margin or padding. To address this issue, we
|
|
205
|
-
adjust the z-index of the dragged element as a workaround, preventing it from
|
|
206
|
-
inheriting the background color.
|
|
207
|
-
|
|
208
|
-
See also https://stackoverflow.com/a/61812377
|
|
209
|
-
*/
|
|
210
|
-
.ProseMirror-selectednode {
|
|
211
|
-
z-index: calc(infinity);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
204
|
/*
|
|
215
205
|
Don't generate box for node view wrapper. This make it easier to style
|
|
216
206
|
the node views.
|
|
@@ -218,5 +208,17 @@
|
|
|
218
208
|
div[data-node-view-root="true"] {
|
|
219
209
|
display: contents;
|
|
220
210
|
}
|
|
211
|
+
|
|
212
|
+
& .ProseMirror-selectednode {
|
|
213
|
+
border-radius: 0.2rem;
|
|
214
|
+
outline-color: var(--prosekit-node-selection-color);
|
|
215
|
+
outline-style: solid;
|
|
216
|
+
outline-width: 0.3rem;
|
|
217
|
+
background-color: var(--prosekit-node-selection-color);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&.prosekit-dragging {
|
|
221
|
+
--prosekit-node-selection-color: transparent;
|
|
222
|
+
}
|
|
221
223
|
}
|
|
222
224
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosekit/basic",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "A quick starter for ProseKit",
|
|
7
7
|
"author": {
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"funding": "https://github.com/sponsors/ocavue",
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/prosekit/prosekit#readme",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/
|
|
16
|
+
"url": "git+https://github.com/prosekit/prosekit.git",
|
|
17
17
|
"directory": "packages/basic"
|
|
18
18
|
},
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/prosekit/prosekit/issues"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"ProseMirror"
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@prosekit/
|
|
44
|
+
"@prosekit/core": "^0.8.3",
|
|
45
45
|
"@prosekit/pm": "^0.1.11",
|
|
46
|
-
"@prosekit/
|
|
46
|
+
"@prosekit/extensions": "^0.11.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jsdom": "^21.1.7",
|
|
50
50
|
"happy-dom": "^18.0.1",
|
|
51
51
|
"jsdom": "^26.1.0",
|
|
52
|
-
"tsdown": "^0.
|
|
52
|
+
"tsdown": "^0.13.1",
|
|
53
53
|
"typescript": "~5.8.3",
|
|
54
54
|
"vitest": "^3.2.4",
|
|
55
55
|
"@prosekit/config-tsdown": "0.0.0",
|