@prosekit/basic 0.5.4 → 0.6.0
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 +4 -18
- package/package.json +5 -5
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
|
@@ -162,13 +162,13 @@
|
|
|
162
162
|
&:has(> div.list-content > h1) {
|
|
163
163
|
&::before,
|
|
164
164
|
& > .list-marker {
|
|
165
|
-
top:
|
|
165
|
+
top: 0.75em;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
&:has(> div.list-content > h2) {
|
|
169
169
|
&::before,
|
|
170
170
|
& > .list-marker {
|
|
171
|
-
top: 0.
|
|
171
|
+
top: 0.5em;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
&:has(> div.list-content > h3) {
|
|
@@ -186,31 +186,17 @@
|
|
|
186
186
|
&:has(> div.list-content > h5) {
|
|
187
187
|
&::before,
|
|
188
188
|
& > .list-marker {
|
|
189
|
-
top: -0.
|
|
189
|
+
top: -0.2em;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
&:has(> div.list-content > h6) {
|
|
193
193
|
&::before,
|
|
194
194
|
& > .list-marker {
|
|
195
|
-
top: -0.
|
|
195
|
+
top: -0.3em;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
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
200
|
/*
|
|
215
201
|
Don't generate box for node view wrapper. This make it easier to style
|
|
216
202
|
the node views.
|
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.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "A quick starter for ProseKit",
|
|
7
7
|
"author": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@prosekit/
|
|
45
|
-
"@prosekit/
|
|
46
|
-
"@prosekit/
|
|
44
|
+
"@prosekit/core": "^0.8.3",
|
|
45
|
+
"@prosekit/extensions": "^0.11.0",
|
|
46
|
+
"@prosekit/pm": "^0.1.11"
|
|
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",
|