@prosekit/basic 0.4.1 → 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 +65 -2
- package/dist/prosekit-basic.js +61 -98
- package/dist/style.css +44 -48
- package/dist/style.js +0 -0
- package/dist/typography.css +221 -159
- package/dist/typography.js +0 -0
- package/package.json +21 -11
- package/dist/_tsup-dts-rollup.d.ts +0 -89
package/dist/prosekit-basic.d.ts
CHANGED
@@ -1,2 +1,65 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { BaseCommandsExtension, BaseKeymapExtension, HistoryExtension, Union } from "@prosekit/core";
|
2
|
+
import { BlockquoteExtension } from "@prosekit/extensions/blockquote";
|
3
|
+
import { BoldExtension } from "@prosekit/extensions/bold";
|
4
|
+
import { CodeExtension } from "@prosekit/extensions/code";
|
5
|
+
import { CodeBlockExtension } from "@prosekit/extensions/code-block";
|
6
|
+
import { DocExtension } from "@prosekit/extensions/doc";
|
7
|
+
import { DropCursorExtension } from "@prosekit/extensions/drop-cursor";
|
8
|
+
import { GapCursorExtension } from "@prosekit/extensions/gap-cursor";
|
9
|
+
import { HardBreakExtension } from "@prosekit/extensions/hard-break";
|
10
|
+
import { HeadingExtension } from "@prosekit/extensions/heading";
|
11
|
+
import { HorizontalRuleExtension } from "@prosekit/extensions/horizontal-rule";
|
12
|
+
import { ImageExtension } from "@prosekit/extensions/image";
|
13
|
+
import { ItalicExtension } from "@prosekit/extensions/italic";
|
14
|
+
import { LinkExtension } from "@prosekit/extensions/link";
|
15
|
+
import { ListExtension } from "@prosekit/extensions/list";
|
16
|
+
import { ModClickPreventionExtension } from "@prosekit/extensions/mod-click-prevention";
|
17
|
+
import { ParagraphExtension } from "@prosekit/extensions/paragraph";
|
18
|
+
import { StrikeExtension } from "@prosekit/extensions/strike";
|
19
|
+
import { TableExtension } from "@prosekit/extensions/table";
|
20
|
+
import { TextExtension } from "@prosekit/extensions/text";
|
21
|
+
import { UnderlineExtension } from "@prosekit/extensions/underline";
|
22
|
+
import { VirtualSelectionExtension } from "@prosekit/extensions/virtual-selection";
|
23
|
+
|
24
|
+
//#region src/index.d.ts
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @internal
|
28
|
+
*/
|
29
|
+
type BasicExtension = Union<[DocExtension, TextExtension, ParagraphExtension, HeadingExtension, ListExtension, BlockquoteExtension, ImageExtension, HorizontalRuleExtension, HardBreakExtension, TableExtension, CodeBlockExtension, ItalicExtension, BoldExtension, UnderlineExtension, StrikeExtension, CodeExtension, LinkExtension, BaseKeymapExtension, BaseCommandsExtension, HistoryExtension, DropCursorExtension, GapCursorExtension, VirtualSelectionExtension, ModClickPreventionExtension]>;
|
30
|
+
/**
|
31
|
+
* Define a basic extension that includes some common functionality. You can
|
32
|
+
* copy this function and customize it to your needs.
|
33
|
+
*
|
34
|
+
* It's a combination of the following extension functions:
|
35
|
+
*
|
36
|
+
* - {@link defineDoc}
|
37
|
+
* - {@link defineText}
|
38
|
+
* - {@link defineParagraph}
|
39
|
+
* - {@link defineHeading}
|
40
|
+
* - {@link defineList}
|
41
|
+
* - {@link defineBlockquote}
|
42
|
+
* - {@link defineImage}
|
43
|
+
* - {@link defineHorizontalRule}
|
44
|
+
* - {@link defineHardBreak}
|
45
|
+
* - {@link defineTable}
|
46
|
+
* - {@link defineCodeBlock}
|
47
|
+
* - {@link defineItalic}
|
48
|
+
* - {@link defineBold}
|
49
|
+
* - {@link defineUnderline}
|
50
|
+
* - {@link defineStrike}
|
51
|
+
* - {@link defineCode}
|
52
|
+
* - {@link defineLink}
|
53
|
+
* - {@link defineBaseKeymap}
|
54
|
+
* - {@link defineBaseCommands}
|
55
|
+
* - {@link defineHistory}
|
56
|
+
* - {@link defineDropCursor}
|
57
|
+
* - {@link defineGapCursor}
|
58
|
+
* - {@link defineVirtualSelection}
|
59
|
+
* - {@link defineModClickPrevention}
|
60
|
+
*
|
61
|
+
* @public
|
62
|
+
*/
|
63
|
+
declare function defineBasicExtension(): BasicExtension;
|
64
|
+
//#endregion
|
65
|
+
export { BasicExtension, defineBasicExtension };
|
package/dist/prosekit-basic.js
CHANGED
@@ -1,100 +1,63 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
} from "@prosekit/
|
8
|
-
import {
|
9
|
-
|
10
|
-
} from "@prosekit/extensions/
|
11
|
-
import {
|
12
|
-
|
13
|
-
} from "@prosekit/extensions/
|
14
|
-
import {
|
15
|
-
|
16
|
-
} from "@prosekit/extensions/
|
17
|
-
import {
|
18
|
-
|
19
|
-
} from "@prosekit/extensions/
|
20
|
-
import {
|
21
|
-
|
22
|
-
} from "@prosekit/extensions/
|
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
|
-
} from "@prosekit/extensions/table";
|
59
|
-
import {
|
60
|
-
defineText
|
61
|
-
} from "@prosekit/extensions/text";
|
62
|
-
import {
|
63
|
-
defineUnderline
|
64
|
-
} from "@prosekit/extensions/underline";
|
65
|
-
import {
|
66
|
-
defineVirtualSelection
|
67
|
-
} from "@prosekit/extensions/virtual-selection";
|
1
|
+
import { defineBaseCommands, defineBaseKeymap, defineHistory, union } from "@prosekit/core";
|
2
|
+
import { defineBlockquote } from "@prosekit/extensions/blockquote";
|
3
|
+
import { defineBold } from "@prosekit/extensions/bold";
|
4
|
+
import { defineCode } from "@prosekit/extensions/code";
|
5
|
+
import { defineCodeBlock } from "@prosekit/extensions/code-block";
|
6
|
+
import { defineDoc } from "@prosekit/extensions/doc";
|
7
|
+
import { defineDropCursor } from "@prosekit/extensions/drop-cursor";
|
8
|
+
import { defineGapCursor } from "@prosekit/extensions/gap-cursor";
|
9
|
+
import { defineHardBreak } from "@prosekit/extensions/hard-break";
|
10
|
+
import { defineHeading } from "@prosekit/extensions/heading";
|
11
|
+
import { defineHorizontalRule } from "@prosekit/extensions/horizontal-rule";
|
12
|
+
import { defineImage } from "@prosekit/extensions/image";
|
13
|
+
import { defineItalic } from "@prosekit/extensions/italic";
|
14
|
+
import { defineLink } from "@prosekit/extensions/link";
|
15
|
+
import { defineList } from "@prosekit/extensions/list";
|
16
|
+
import { defineModClickPrevention } from "@prosekit/extensions/mod-click-prevention";
|
17
|
+
import { defineParagraph } from "@prosekit/extensions/paragraph";
|
18
|
+
import { defineStrike } from "@prosekit/extensions/strike";
|
19
|
+
import { defineTable } from "@prosekit/extensions/table";
|
20
|
+
import { defineText } from "@prosekit/extensions/text";
|
21
|
+
import { defineUnderline } from "@prosekit/extensions/underline";
|
22
|
+
import { defineVirtualSelection } from "@prosekit/extensions/virtual-selection";
|
23
|
+
|
24
|
+
//#region src/index.ts
|
25
|
+
/**
|
26
|
+
* Define a basic extension that includes some common functionality. You can
|
27
|
+
* copy this function and customize it to your needs.
|
28
|
+
*
|
29
|
+
* It's a combination of the following extension functions:
|
30
|
+
*
|
31
|
+
* - {@link defineDoc}
|
32
|
+
* - {@link defineText}
|
33
|
+
* - {@link defineParagraph}
|
34
|
+
* - {@link defineHeading}
|
35
|
+
* - {@link defineList}
|
36
|
+
* - {@link defineBlockquote}
|
37
|
+
* - {@link defineImage}
|
38
|
+
* - {@link defineHorizontalRule}
|
39
|
+
* - {@link defineHardBreak}
|
40
|
+
* - {@link defineTable}
|
41
|
+
* - {@link defineCodeBlock}
|
42
|
+
* - {@link defineItalic}
|
43
|
+
* - {@link defineBold}
|
44
|
+
* - {@link defineUnderline}
|
45
|
+
* - {@link defineStrike}
|
46
|
+
* - {@link defineCode}
|
47
|
+
* - {@link defineLink}
|
48
|
+
* - {@link defineBaseKeymap}
|
49
|
+
* - {@link defineBaseCommands}
|
50
|
+
* - {@link defineHistory}
|
51
|
+
* - {@link defineDropCursor}
|
52
|
+
* - {@link defineGapCursor}
|
53
|
+
* - {@link defineVirtualSelection}
|
54
|
+
* - {@link defineModClickPrevention}
|
55
|
+
*
|
56
|
+
* @public
|
57
|
+
*/
|
68
58
|
function defineBasicExtension() {
|
69
|
-
|
70
|
-
// Nodes
|
71
|
-
defineDoc(),
|
72
|
-
defineText(),
|
73
|
-
defineParagraph(),
|
74
|
-
defineHeading(),
|
75
|
-
defineList(),
|
76
|
-
defineBlockquote(),
|
77
|
-
defineImage(),
|
78
|
-
defineHorizontalRule(),
|
79
|
-
defineTable(),
|
80
|
-
defineCodeBlock(),
|
81
|
-
// Marks
|
82
|
-
defineItalic(),
|
83
|
-
defineBold(),
|
84
|
-
defineUnderline(),
|
85
|
-
defineStrike(),
|
86
|
-
defineCode(),
|
87
|
-
defineLink(),
|
88
|
-
// Others
|
89
|
-
defineBaseKeymap(),
|
90
|
-
defineBaseCommands(),
|
91
|
-
defineHistory(),
|
92
|
-
defineDropCursor(),
|
93
|
-
defineGapCursor(),
|
94
|
-
defineVirtualSelection(),
|
95
|
-
defineModClickPrevention()
|
96
|
-
);
|
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());
|
97
60
|
}
|
98
|
-
|
99
|
-
|
100
|
-
};
|
61
|
+
|
62
|
+
//#endregion
|
63
|
+
export { defineBasicExtension };
|
package/dist/style.css
CHANGED
@@ -1,58 +1,60 @@
|
|
1
|
-
/* ../../node_modules/.pnpm/prosemirror-view@1.38.1/node_modules/prosemirror-view/style/prosemirror.css */
|
2
1
|
.ProseMirror {
|
3
2
|
position: relative;
|
4
3
|
}
|
4
|
+
|
5
5
|
.ProseMirror {
|
6
6
|
word-wrap: break-word;
|
7
7
|
white-space: pre-wrap;
|
8
8
|
white-space: break-spaces;
|
9
9
|
-webkit-font-variant-ligatures: none;
|
10
10
|
font-variant-ligatures: none;
|
11
|
-
font-feature-settings: "liga" 0;
|
11
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
12
12
|
}
|
13
|
+
|
13
14
|
.ProseMirror pre {
|
14
15
|
white-space: pre-wrap;
|
15
16
|
}
|
17
|
+
|
16
18
|
.ProseMirror li {
|
17
19
|
position: relative;
|
18
20
|
}
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
.ProseMirror-hideselection
|
23
|
-
|
24
|
-
|
25
|
-
.ProseMirror-
|
26
|
-
|
27
|
-
}
|
28
|
-
.ProseMirror [draggable][contenteditable=false] {
|
29
|
-
user-select: text;
|
30
|
-
}
|
21
|
+
|
22
|
+
.ProseMirror-hideselection *::selection { background: transparent; }
|
23
|
+
.ProseMirror-hideselection *::-moz-selection { background: transparent; }
|
24
|
+
.ProseMirror-hideselection { caret-color: transparent; }
|
25
|
+
|
26
|
+
/* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */
|
27
|
+
.ProseMirror [draggable][contenteditable=false] { user-select: text }
|
28
|
+
|
31
29
|
.ProseMirror-selectednode {
|
32
30
|
outline: 2px solid #8cf;
|
33
31
|
}
|
32
|
+
|
33
|
+
/* Make sure li selections wrap around markers */
|
34
|
+
|
34
35
|
li.ProseMirror-selectednode {
|
35
36
|
outline: none;
|
36
37
|
}
|
38
|
+
|
37
39
|
li.ProseMirror-selectednode:after {
|
38
40
|
content: "";
|
39
41
|
position: absolute;
|
40
42
|
left: -32px;
|
41
|
-
right: -2px;
|
42
|
-
top: -2px;
|
43
|
-
bottom: -2px;
|
43
|
+
right: -2px; top: -2px; bottom: -2px;
|
44
44
|
border: 2px solid #8cf;
|
45
45
|
pointer-events: none;
|
46
46
|
}
|
47
|
+
|
48
|
+
/* Protect against generic img rules */
|
49
|
+
|
47
50
|
img.ProseMirror-separator {
|
48
51
|
display: inline !important;
|
49
52
|
border: none !important;
|
50
53
|
margin: 0 !important;
|
51
54
|
}
|
52
55
|
|
53
|
-
/* ../pm/src/view/style/prosemirror.css */
|
54
56
|
|
55
|
-
/*
|
57
|
+
/* src/style.css */
|
56
58
|
.prosemirror-flat-list {
|
57
59
|
padding: 0;
|
58
60
|
margin-top: 0;
|
@@ -79,9 +81,6 @@ img.ProseMirror-separator {
|
|
79
81
|
.prosemirror-flat-list[data-list-kind=bullet] {
|
80
82
|
list-style: disc;
|
81
83
|
}
|
82
|
-
.prosemirror-flat-list[data-list-kind=ordered] {
|
83
|
-
counter-increment: prosemirror-flat-list-counter;
|
84
|
-
}
|
85
84
|
.prosemirror-flat-list[data-list-kind=ordered] > * {
|
86
85
|
contain: style;
|
87
86
|
}
|
@@ -91,6 +90,9 @@ img.ProseMirror-separator {
|
|
91
90
|
font-variant-numeric: tabular-nums;
|
92
91
|
content: counter(prosemirror-flat-list-counter, decimal) ". ";
|
93
92
|
}
|
93
|
+
.prosemirror-flat-list[data-list-kind=ordered] {
|
94
|
+
counter-increment: prosemirror-flat-list-counter;
|
95
|
+
}
|
94
96
|
.prosemirror-flat-list[data-list-kind=ordered]:first-child,
|
95
97
|
:not(.prosemirror-flat-list[data-list-kind=ordered]) + .prosemirror-flat-list[data-list-kind=ordered] {
|
96
98
|
counter-reset: prosemirror-flat-list-counter;
|
@@ -112,8 +114,8 @@ img.ProseMirror-separator {
|
|
112
114
|
width: 1.5em;
|
113
115
|
width: 1lh;
|
114
116
|
}
|
115
|
-
.prosemirror-flat-list[data-list-kind=task] > .list-marker,
|
116
|
-
.prosemirror-flat-list[data-list-kind=task] > .list-marker * {
|
117
|
+
:is(.prosemirror-flat-list[data-list-kind=task] > .list-marker),
|
118
|
+
:is(.prosemirror-flat-list[data-list-kind=task] > .list-marker) * {
|
117
119
|
cursor: pointer;
|
118
120
|
}
|
119
121
|
.prosemirror-flat-list[data-list-kind=toggle] > .list-marker {
|
@@ -140,34 +142,32 @@ img.ProseMirror-separator {
|
|
140
142
|
display: none;
|
141
143
|
}
|
142
144
|
|
143
|
-
/* ../extensions/src/list/style.css */
|
144
145
|
|
145
|
-
/* ../extensions/src/table/style.css */
|
146
146
|
.ProseMirror .tableWrapper {
|
147
147
|
overflow-x: auto;
|
148
148
|
}
|
149
149
|
.ProseMirror table {
|
150
|
-
border-collapse: collapse;
|
151
|
-
table-layout: fixed;
|
152
150
|
width: 100%;
|
153
151
|
overflow: hidden;
|
152
|
+
border-collapse: collapse;
|
153
|
+
table-layout: fixed;
|
154
154
|
}
|
155
155
|
.ProseMirror td,
|
156
156
|
.ProseMirror th {
|
157
|
-
vertical-align: top;
|
158
157
|
box-sizing: border-box;
|
159
158
|
position: relative;
|
160
|
-
border-width: 1px;
|
161
|
-
padding-left: 0.75rem;
|
162
159
|
padding-right: 0.75rem;
|
160
|
+
padding-left: 0.75rem;
|
161
|
+
border-width: 1px;
|
162
|
+
vertical-align: top;
|
163
163
|
}
|
164
164
|
.ProseMirror .column-resize-handle {
|
165
|
+
z-index: 20;
|
165
166
|
position: absolute;
|
166
|
-
right: -2px;
|
167
167
|
top: 0;
|
168
|
+
right: -2px;
|
168
169
|
bottom: 0;
|
169
170
|
width: 4px;
|
170
|
-
z-index: 20;
|
171
171
|
background-color: HighlightText;
|
172
172
|
pointer-events: none;
|
173
173
|
}
|
@@ -176,31 +176,25 @@ img.ProseMirror-separator {
|
|
176
176
|
cursor: col-resize;
|
177
177
|
}
|
178
178
|
.ProseMirror .selectedCell {
|
179
|
-
--color:
|
180
|
-
210,
|
181
|
-
100%,
|
182
|
-
56%;
|
183
|
-
background-color: hsla(var(--color), 20%);
|
179
|
+
--color: 210, 100%, 56%;
|
184
180
|
border: 1px double hsl(var(--color));
|
181
|
+
background-color: hsla(var(--color), 20%);
|
185
182
|
}
|
186
183
|
|
187
|
-
/* ../extensions/src/placeholder/style.css */
|
188
184
|
.prosekit-placeholder::before {
|
189
185
|
position: absolute;
|
190
|
-
opacity: 30%;
|
191
|
-
pointer-events: none;
|
192
186
|
height: 0;
|
193
187
|
content: attr(data-placeholder);
|
188
|
+
opacity: 30%;
|
189
|
+
pointer-events: none;
|
194
190
|
}
|
195
191
|
|
196
|
-
/* ../extensions/src/virtual-selection/style.css */
|
197
192
|
.prosekit-virtual-selection {
|
193
|
+
border-radius: 2px;
|
198
194
|
background-color: #8888884d;
|
199
195
|
box-shadow: 0 0 0 2px #8888884d;
|
200
|
-
border-radius: 2px;
|
201
196
|
}
|
202
197
|
|
203
|
-
/* ../extensions/src/commit/style.css */
|
204
198
|
.prosekit-commit-deletion {
|
205
199
|
background-color: #e5534b80;
|
206
200
|
text-decoration: line-through;
|
@@ -209,28 +203,30 @@ img.ProseMirror-separator {
|
|
209
203
|
background-color: #53e54b80;
|
210
204
|
}
|
211
205
|
|
212
|
-
/* ../extensions/src/gap-cursor/style.css */
|
213
206
|
.ProseMirror-gapcursor {
|
214
207
|
display: none;
|
215
|
-
pointer-events: none;
|
216
208
|
position: relative;
|
209
|
+
pointer-events: none;
|
217
210
|
}
|
211
|
+
|
218
212
|
.ProseMirror-gapcursor:after {
|
219
|
-
content: "";
|
220
213
|
display: block;
|
221
214
|
position: absolute;
|
222
215
|
top: -2px;
|
223
216
|
width: 20px;
|
224
217
|
border-top: 1px solid currentColor;
|
218
|
+
content: "";
|
225
219
|
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
226
220
|
}
|
221
|
+
|
227
222
|
@keyframes ProseMirror-cursor-blink {
|
228
223
|
to {
|
229
224
|
visibility: hidden;
|
230
225
|
}
|
231
226
|
}
|
227
|
+
|
232
228
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
233
229
|
display: block;
|
234
230
|
}
|
235
231
|
|
236
|
-
|
232
|
+
|
package/dist/style.js
ADDED
File without changes
|
package/dist/typography.css
CHANGED
@@ -1,160 +1,222 @@
|
|
1
|
-
/* src/typography.css */
|
2
1
|
div.ProseMirror {
|
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
|
-
|
159
|
-
|
160
|
-
|
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
|
+
}
|
221
|
+
}
|
222
|
+
|
File without changes
|
package/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/basic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.5.1",
|
5
5
|
"private": false,
|
6
|
+
"description": "A quick starter for ProseKit",
|
6
7
|
"author": {
|
7
8
|
"name": "ocavue",
|
8
9
|
"email": "ocavue@gmail.com"
|
@@ -40,21 +41,30 @@
|
|
40
41
|
"dist"
|
41
42
|
],
|
42
43
|
"dependencies": {
|
43
|
-
"@prosekit/
|
44
|
-
"@prosekit/
|
45
|
-
"@prosekit/pm": "^0.1.
|
44
|
+
"@prosekit/extensions": "^0.9.1",
|
45
|
+
"@prosekit/core": "^0.8.1",
|
46
|
+
"@prosekit/pm": "^0.1.10"
|
46
47
|
},
|
47
48
|
"devDependencies": {
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"vitest": "
|
53
|
-
|
49
|
+
"tsdown": "^0.12.4",
|
50
|
+
"typescript": "~5.8.3",
|
51
|
+
"vitest": "^3.1.4",
|
52
|
+
"@prosekit/config-tsdown": "0.0.0",
|
53
|
+
"@prosekit/config-vitest": "0.0.0"
|
54
|
+
},
|
55
|
+
"publishConfig": {
|
56
|
+
"dev": {}
|
57
|
+
},
|
58
|
+
"dev": {
|
59
|
+
"entry": {
|
60
|
+
"prosekit-basic": "./src/index.ts",
|
61
|
+
"style": "./src/style.css",
|
62
|
+
"typography": "./src/typography.css"
|
63
|
+
}
|
54
64
|
},
|
55
65
|
"scripts": {
|
56
66
|
"build:tsc": "tsc -b tsconfig.json",
|
57
|
-
"build:
|
67
|
+
"build:tsdown": "tsdown"
|
58
68
|
},
|
59
69
|
"types": "./dist/prosekit-basic.d.ts",
|
60
70
|
"typesVersions": {
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import { BaseCommandsExtension } from '@prosekit/core';
|
2
|
-
import { BaseKeymapExtension } from '@prosekit/core';
|
3
|
-
import { BlockquoteExtension } from '@prosekit/extensions/blockquote';
|
4
|
-
import { BoldExtension } from '@prosekit/extensions/bold';
|
5
|
-
import { CodeBlockExtension } from '@prosekit/extensions/code-block';
|
6
|
-
import { CodeExtension } from '@prosekit/extensions/code';
|
7
|
-
import { DocExtension } from '@prosekit/extensions/doc';
|
8
|
-
import { DropCursorExtension } from '@prosekit/extensions/drop-cursor';
|
9
|
-
import { GapCursorExtension } from '@prosekit/extensions/gap-cursor';
|
10
|
-
import { HeadingExtension } from '@prosekit/extensions/heading';
|
11
|
-
import { HistoryExtension } from '@prosekit/core';
|
12
|
-
import { HorizontalRuleExtension } from '@prosekit/extensions/horizontal-rule';
|
13
|
-
import { ImageExtension } from '@prosekit/extensions/image';
|
14
|
-
import { ItalicExtension } from '@prosekit/extensions/italic';
|
15
|
-
import { LinkExtension } from '@prosekit/extensions/link';
|
16
|
-
import { ListExtension } from '@prosekit/extensions/list';
|
17
|
-
import { ModClickPreventionExtension } from '@prosekit/extensions/mod-click-prevention';
|
18
|
-
import { ParagraphExtension } from '@prosekit/extensions/paragraph';
|
19
|
-
import { StrikeExtension } from '@prosekit/extensions/strike';
|
20
|
-
import { TableExtension } from '@prosekit/extensions/table';
|
21
|
-
import { TextExtension } from '@prosekit/extensions/text';
|
22
|
-
import { UnderlineExtension } from '@prosekit/extensions/underline';
|
23
|
-
import { Union } from '@prosekit/core';
|
24
|
-
import { VirtualSelectionExtension } from '@prosekit/extensions/virtual-selection';
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @internal
|
28
|
-
*/
|
29
|
-
export declare type BasicExtension = Union<[
|
30
|
-
DocExtension,
|
31
|
-
TextExtension,
|
32
|
-
ParagraphExtension,
|
33
|
-
HeadingExtension,
|
34
|
-
ListExtension,
|
35
|
-
BlockquoteExtension,
|
36
|
-
ImageExtension,
|
37
|
-
HorizontalRuleExtension,
|
38
|
-
TableExtension,
|
39
|
-
CodeBlockExtension,
|
40
|
-
ItalicExtension,
|
41
|
-
BoldExtension,
|
42
|
-
UnderlineExtension,
|
43
|
-
StrikeExtension,
|
44
|
-
CodeExtension,
|
45
|
-
LinkExtension,
|
46
|
-
BaseKeymapExtension,
|
47
|
-
BaseCommandsExtension,
|
48
|
-
HistoryExtension,
|
49
|
-
DropCursorExtension,
|
50
|
-
GapCursorExtension,
|
51
|
-
VirtualSelectionExtension,
|
52
|
-
ModClickPreventionExtension
|
53
|
-
]>;
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Define a basic extension that includes some common functionality. You can
|
57
|
-
* copy this function and customize it to your needs.
|
58
|
-
*
|
59
|
-
* It's a combination of the following extension functions:
|
60
|
-
*
|
61
|
-
* - {@link defineDoc}
|
62
|
-
* - {@link defineText}
|
63
|
-
* - {@link defineParagraph}
|
64
|
-
* - {@link defineHeading}
|
65
|
-
* - {@link defineList}
|
66
|
-
* - {@link defineBlockquote}
|
67
|
-
* - {@link defineImage}
|
68
|
-
* - {@link defineHorizontalRule}
|
69
|
-
* - {@link defineTable}
|
70
|
-
* - {@link defineCodeBlock}
|
71
|
-
* - {@link defineItalic}
|
72
|
-
* - {@link defineBold}
|
73
|
-
* - {@link defineUnderline}
|
74
|
-
* - {@link defineStrike}
|
75
|
-
* - {@link defineCode}
|
76
|
-
* - {@link defineLink}
|
77
|
-
* - {@link defineBaseKeymap}
|
78
|
-
* - {@link defineBaseCommands}
|
79
|
-
* - {@link defineHistory}
|
80
|
-
* - {@link defineDropCursor}
|
81
|
-
* - {@link defineGapCursor}
|
82
|
-
* - {@link defineVirtualSelection}
|
83
|
-
* - {@link defineModClickPrevention}
|
84
|
-
*
|
85
|
-
* @public
|
86
|
-
*/
|
87
|
-
export declare function defineBasicExtension(): BasicExtension;
|
88
|
-
|
89
|
-
export { }
|