@prosekit/basic 0.5.0 → 0.5.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 -4
- package/dist/prosekit-basic.js +1 -29
- package/dist/style.css +22 -27
- package/dist/typography.css +219 -157
- package/package.json +6 -6
package/dist/prosekit-basic.d.ts
CHANGED
@@ -22,9 +22,7 @@ import { UnderlineExtension } from "@prosekit/extensions/underline";
|
|
22
22
|
import { VirtualSelectionExtension } from "@prosekit/extensions/virtual-selection";
|
23
23
|
|
24
24
|
//#region src/index.d.ts
|
25
|
-
|
26
|
-
* @internal
|
27
|
-
*/
|
25
|
+
|
28
26
|
/**
|
29
27
|
* @internal
|
30
28
|
*/
|
@@ -63,6 +61,5 @@ type BasicExtension = Union<[DocExtension, TextExtension, ParagraphExtension, He
|
|
63
61
|
* @public
|
64
62
|
*/
|
65
63
|
declare function defineBasicExtension(): BasicExtension;
|
66
|
-
|
67
64
|
//#endregion
|
68
65
|
export { BasicExtension, defineBasicExtension };
|
package/dist/prosekit-basic.js
CHANGED
@@ -56,35 +56,7 @@ import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
|
|
56
56
|
* @public
|
57
57
|
*/
|
58
58
|
function defineBasicExtension() {
|
59
|
-
return union(
|
60
|
-
// Nodes
|
61
|
-
defineDoc(),
|
62
|
-
defineText(),
|
63
|
-
defineParagraph(),
|
64
|
-
defineHeading(),
|
65
|
-
defineList(),
|
66
|
-
defineBlockquote(),
|
67
|
-
defineImage(),
|
68
|
-
defineHorizontalRule(),
|
69
|
-
defineHardBreak(),
|
70
|
-
defineTable(),
|
71
|
-
defineCodeBlock(),
|
72
|
-
// Marks
|
73
|
-
defineItalic(),
|
74
|
-
defineBold(),
|
75
|
-
defineUnderline(),
|
76
|
-
defineStrike(),
|
77
|
-
defineCode(),
|
78
|
-
defineLink(),
|
79
|
-
// Others
|
80
|
-
defineBaseKeymap(),
|
81
|
-
defineBaseCommands(),
|
82
|
-
defineHistory(),
|
83
|
-
defineDropCursor(),
|
84
|
-
defineGapCursor(),
|
85
|
-
defineVirtualSelection(),
|
86
|
-
defineModClickPrevention()
|
87
|
-
);
|
59
|
+
return union(defineDoc(), defineText(), defineParagraph(), defineHeading(), defineList(), defineBlockquote(), defineImage(), defineHorizontalRule(), defineHardBreak(), defineTable(), defineCodeBlock(), defineItalic(), defineBold(), defineUnderline(), defineStrike(), defineCode(), defineLink(), defineBaseKeymap(), defineBaseCommands(), defineHistory(), defineDropCursor(), defineGapCursor(), defineVirtualSelection(), defineModClickPrevention());
|
88
60
|
}
|
89
61
|
|
90
62
|
//#endregion
|
package/dist/style.css
CHANGED
@@ -146,56 +146,52 @@ img.ProseMirror-separator {
|
|
146
146
|
.ProseMirror .tableWrapper {
|
147
147
|
overflow-x: auto;
|
148
148
|
}
|
149
|
-
|
150
149
|
.ProseMirror table {
|
151
|
-
border-collapse: collapse;
|
152
|
-
table-layout: fixed;
|
153
150
|
width: 100%;
|
154
151
|
overflow: hidden;
|
152
|
+
border-collapse: collapse;
|
153
|
+
table-layout: fixed;
|
155
154
|
}
|
156
|
-
|
157
|
-
.ProseMirror
|
155
|
+
.ProseMirror td,
|
156
|
+
.ProseMirror th {
|
158
157
|
box-sizing: border-box;
|
159
|
-
vertical-align: top;
|
160
|
-
border-width: 1px;
|
161
|
-
padding-left: .75rem;
|
162
|
-
padding-right: .75rem;
|
163
158
|
position: relative;
|
159
|
+
padding-right: 0.75rem;
|
160
|
+
padding-left: 0.75rem;
|
161
|
+
border-width: 1px;
|
162
|
+
vertical-align: top;
|
164
163
|
}
|
165
|
-
|
166
164
|
.ProseMirror .column-resize-handle {
|
167
165
|
z-index: 20;
|
168
|
-
pointer-events: none;
|
169
|
-
background-color: highlighttext;
|
170
|
-
width: 4px;
|
171
166
|
position: absolute;
|
172
167
|
top: 0;
|
173
|
-
bottom: 0;
|
174
168
|
right: -2px;
|
169
|
+
bottom: 0;
|
170
|
+
width: 4px;
|
171
|
+
background-color: HighlightText;
|
172
|
+
pointer-events: none;
|
175
173
|
}
|
176
|
-
|
177
174
|
.ProseMirror.resize-cursor {
|
178
175
|
cursor: ew-resize;
|
179
176
|
cursor: col-resize;
|
180
177
|
}
|
181
|
-
|
182
178
|
.ProseMirror .selectedCell {
|
183
179
|
--color: 210, 100%, 56%;
|
184
180
|
border: 1px double hsl(var(--color));
|
185
181
|
background-color: hsla(var(--color), 20%);
|
186
182
|
}
|
187
183
|
|
188
|
-
.prosekit-placeholder
|
184
|
+
.prosekit-placeholder::before {
|
185
|
+
position: absolute;
|
186
|
+
height: 0;
|
189
187
|
content: attr(data-placeholder);
|
190
|
-
opacity:
|
188
|
+
opacity: 30%;
|
191
189
|
pointer-events: none;
|
192
|
-
height: 0;
|
193
|
-
position: absolute;
|
194
190
|
}
|
195
191
|
|
196
192
|
.prosekit-virtual-selection {
|
197
|
-
background-color: #8888884d;
|
198
193
|
border-radius: 2px;
|
194
|
+
background-color: #8888884d;
|
199
195
|
box-shadow: 0 0 0 2px #8888884d;
|
200
196
|
}
|
201
197
|
|
@@ -203,25 +199,24 @@ img.ProseMirror-separator {
|
|
203
199
|
background-color: #e5534b80;
|
204
200
|
text-decoration: line-through;
|
205
201
|
}
|
206
|
-
|
207
202
|
.prosekit-commit-addition {
|
208
203
|
background-color: #53e54b80;
|
209
204
|
}
|
210
205
|
|
211
206
|
.ProseMirror-gapcursor {
|
212
|
-
pointer-events: none;
|
213
207
|
display: none;
|
214
208
|
position: relative;
|
209
|
+
pointer-events: none;
|
215
210
|
}
|
216
211
|
|
217
212
|
.ProseMirror-gapcursor:after {
|
218
|
-
content: "";
|
219
|
-
border-top: 1px solid;
|
220
|
-
width: 20px;
|
221
|
-
animation: 1.1s steps(2, start) infinite ProseMirror-cursor-blink;
|
222
213
|
display: block;
|
223
214
|
position: absolute;
|
224
215
|
top: -2px;
|
216
|
+
width: 20px;
|
217
|
+
border-top: 1px solid currentColor;
|
218
|
+
content: "";
|
219
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
225
220
|
}
|
226
221
|
|
227
222
|
@keyframes ProseMirror-cursor-blink {
|
package/dist/typography.css
CHANGED
@@ -1,160 +1,222 @@
|
|
1
1
|
div.ProseMirror {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
}
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
2
|
+
& {
|
3
|
+
/* Disable margin collapsing */
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
}
|
7
|
+
|
8
|
+
& {
|
9
|
+
/* Set the default line height as same as block handle's height */
|
10
|
+
line-height: 1.5;
|
11
|
+
}
|
12
|
+
|
13
|
+
& p:first-child,
|
14
|
+
& h1:first-child,
|
15
|
+
& h2:first-child,
|
16
|
+
& h3:first-child,
|
17
|
+
& h4:first-child,
|
18
|
+
& h5:first-child,
|
19
|
+
& h6:first-child {
|
20
|
+
margin-top: 0;
|
21
|
+
}
|
22
|
+
|
23
|
+
& p:last-child,
|
24
|
+
& h1:last-child,
|
25
|
+
& h2:last-child,
|
26
|
+
& h3:last-child,
|
27
|
+
& h4:last-child,
|
28
|
+
& h5:last-child,
|
29
|
+
& h6:last-child {
|
30
|
+
margin-bottom: 0;
|
31
|
+
}
|
32
|
+
|
33
|
+
& h1,
|
34
|
+
& h2,
|
35
|
+
& h3,
|
36
|
+
& h4,
|
37
|
+
& h5,
|
38
|
+
& h6 {
|
39
|
+
padding-top: 0;
|
40
|
+
padding-bottom: 0;
|
41
|
+
border-style: none;
|
42
|
+
font-weight: 600;
|
43
|
+
line-height: 1.25;
|
44
|
+
}
|
45
|
+
|
46
|
+
& a {
|
47
|
+
font-weight: 500;
|
48
|
+
text-decoration: underline;
|
49
|
+
}
|
50
|
+
|
51
|
+
& p,
|
52
|
+
& ul,
|
53
|
+
& ol,
|
54
|
+
& pre {
|
55
|
+
margin: 0;
|
56
|
+
padding: 0.5rem 0;
|
57
|
+
line-height: 1.5;
|
58
|
+
}
|
59
|
+
|
60
|
+
& blockquote {
|
61
|
+
padding-left: 1em;
|
62
|
+
border-left: 0.25em solid hsl(0 0% 60% / 0.4);
|
63
|
+
}
|
64
|
+
|
65
|
+
& h1 {
|
66
|
+
margin: 1rem 0;
|
67
|
+
font-size: 2.25em;
|
68
|
+
}
|
69
|
+
|
70
|
+
& h2 {
|
71
|
+
margin: 1.75em 0 0.5em;
|
72
|
+
font-size: 1.75em;
|
73
|
+
}
|
74
|
+
|
75
|
+
& h3 {
|
76
|
+
margin: 1.5em 0 0.5em;
|
77
|
+
font-size: 1.375em;
|
78
|
+
}
|
79
|
+
|
80
|
+
& h4 {
|
81
|
+
margin: 1em 0;
|
82
|
+
font-size: 1.125em;
|
83
|
+
}
|
84
|
+
|
85
|
+
& h5 {
|
86
|
+
margin: 0.5em 0;
|
87
|
+
}
|
88
|
+
|
89
|
+
& h6 {
|
90
|
+
opacity: 0.8;
|
91
|
+
}
|
92
|
+
|
93
|
+
& img,
|
94
|
+
& video {
|
95
|
+
width: min-content;
|
96
|
+
max-width: 100%;
|
97
|
+
margin: 0;
|
98
|
+
}
|
99
|
+
|
100
|
+
& code {
|
101
|
+
font-weight: 600;
|
102
|
+
font-size: 0.875em;
|
103
|
+
}
|
104
|
+
|
105
|
+
& pre {
|
106
|
+
margin: 0.5rem 0;
|
107
|
+
padding: 2rem 2rem;
|
108
|
+
overflow-x: auto;
|
109
|
+
border: 1px solid hsl(0 0% 50% / 0.2);
|
110
|
+
border-radius: 0.375rem;
|
111
|
+
/* CSS variables `prosemirror-highlight` and `prosemirror-highlight-bg` are set by package `prosemirror-highlight` */
|
112
|
+
background-color: var(--prosemirror-highlight-bg, inherit);
|
113
|
+
color: var(--prosemirror-highlight, inherit);
|
114
|
+
}
|
115
|
+
|
116
|
+
& pre,
|
117
|
+
& code {
|
118
|
+
white-space: pre;
|
119
|
+
word-break: normal;
|
120
|
+
word-spacing: normal;
|
121
|
+
word-wrap: normal;
|
122
|
+
hyphens: none;
|
123
|
+
tab-size: 4;
|
124
|
+
}
|
125
|
+
|
126
|
+
& pre code {
|
127
|
+
font-weight: inherit;
|
128
|
+
}
|
129
|
+
|
130
|
+
& hr {
|
131
|
+
margin: 2em 0;
|
132
|
+
border-width: 1px;
|
133
|
+
}
|
134
|
+
|
135
|
+
& .prosekit-horizontal-rule {
|
136
|
+
margin: 1em 0;
|
137
|
+
padding: 1em 0;
|
138
|
+
/* Set a small line-height so that the block handle can align to the middle
|
139
|
+
of the horizontal rule */
|
140
|
+
line-height: 1px;
|
141
|
+
|
142
|
+
& hr {
|
143
|
+
margin: 0;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
& .tableWrapper {
|
148
|
+
margin-top: 0.5em;
|
149
|
+
margin-bottom: 1em;
|
150
|
+
}
|
151
|
+
|
152
|
+
& .prosemirror-flat-list {
|
153
|
+
/* Use the same line-height as <p> */
|
154
|
+
line-height: 1.5;
|
155
|
+
|
156
|
+
&::before,
|
157
|
+
& > .list-marker {
|
158
|
+
/* Use the same padding as <p> */
|
159
|
+
top: 0.5rem;
|
160
|
+
}
|
161
|
+
|
162
|
+
&:has(> div.list-content > h1) {
|
163
|
+
&::before,
|
164
|
+
& > .list-marker {
|
165
|
+
top: 1em;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
&:has(> div.list-content > h2) {
|
169
|
+
&::before,
|
170
|
+
& > .list-marker {
|
171
|
+
top: 0.6em;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
&:has(> div.list-content > h3) {
|
175
|
+
&::before,
|
176
|
+
& > .list-marker {
|
177
|
+
top: 0.25em;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
&:has(> div.list-content > h4) {
|
181
|
+
&::before,
|
182
|
+
& > .list-marker {
|
183
|
+
top: 0;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
&:has(> div.list-content > h5) {
|
187
|
+
&::before,
|
188
|
+
& > .list-marker {
|
189
|
+
top: -0.1em;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
&:has(> div.list-content > h6) {
|
193
|
+
&::before,
|
194
|
+
& > .list-marker {
|
195
|
+
top: -0.1em;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
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
|
+
/*
|
215
|
+
Don't generate box for node view wrapper. This make it easier to style
|
216
|
+
the node views.
|
217
|
+
*/
|
218
|
+
div[data-node-view-root="true"] {
|
219
|
+
display: contents;
|
220
|
+
}
|
159
221
|
}
|
160
222
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/basic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.5.
|
4
|
+
"version": "0.5.1",
|
5
5
|
"private": false,
|
6
6
|
"description": "A quick starter for ProseKit",
|
7
7
|
"author": {
|
@@ -41,16 +41,16 @@
|
|
41
41
|
"dist"
|
42
42
|
],
|
43
43
|
"dependencies": {
|
44
|
+
"@prosekit/extensions": "^0.9.1",
|
44
45
|
"@prosekit/core": "^0.8.1",
|
45
|
-
"@prosekit/extensions": "^0.9.0",
|
46
46
|
"@prosekit/pm": "^0.1.10"
|
47
47
|
},
|
48
48
|
"devDependencies": {
|
49
|
-
"tsdown": "^0.
|
49
|
+
"tsdown": "^0.12.4",
|
50
50
|
"typescript": "~5.8.3",
|
51
|
-
"vitest": "^3.1.
|
52
|
-
"@prosekit/config-
|
53
|
-
"@prosekit/config-
|
51
|
+
"vitest": "^3.1.4",
|
52
|
+
"@prosekit/config-tsdown": "0.0.0",
|
53
|
+
"@prosekit/config-vitest": "0.0.0"
|
54
54
|
},
|
55
55
|
"publishConfig": {
|
56
56
|
"dev": {}
|