@prosekit/extensions 0.0.17 → 0.0.19
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.
@@ -1,12 +1,18 @@
|
|
1
1
|
import { CommandArgs } from '@prosekit/core';
|
2
|
+
import { DedentListOptions } from 'prosemirror-flat-list';
|
2
3
|
import { EditorState } from '@prosekit/pm/state';
|
3
4
|
import { Extension } from '@prosekit/core';
|
4
5
|
import { ExtensionTyping } from '@prosekit/core';
|
5
6
|
import type { HLJSApi } from 'highlight.js';
|
7
|
+
import { IndentListOptions } from 'prosemirror-flat-list';
|
8
|
+
import { ListAttributes } from 'prosemirror-flat-list';
|
9
|
+
import { NodeRange } from 'prosemirror-model';
|
6
10
|
import { Options } from 'tsup';
|
7
11
|
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
8
12
|
import { PluginKey } from '@prosekit/pm/state';
|
13
|
+
import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
|
9
14
|
import { Transaction } from '@prosekit/pm/state';
|
15
|
+
import { UnwrapListOptions } from 'prosemirror-flat-list';
|
10
16
|
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
11
17
|
|
12
18
|
declare class AutocompleteRule {
|
@@ -54,7 +60,9 @@ export declare function defaultIsValid({ state }: {
|
|
54
60
|
|
55
61
|
export declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
56
62
|
|
57
|
-
/**
|
63
|
+
/**
|
64
|
+
* @public
|
65
|
+
*/
|
58
66
|
export declare function defineBlockquote(): Extension< {
|
59
67
|
NODES: "blockquote";
|
60
68
|
}>;
|
@@ -63,7 +71,9 @@ export declare function defineBlockquoteSpec(): Extension< {
|
|
63
71
|
NODES: "blockquote";
|
64
72
|
}>;
|
65
73
|
|
66
|
-
/**
|
74
|
+
/**
|
75
|
+
* @public
|
76
|
+
*/
|
67
77
|
export declare function defineBold(): Extension< {
|
68
78
|
MARKS: "bold";
|
69
79
|
COMMAND_ARGS: {
|
@@ -90,7 +100,9 @@ export declare function defineCode(): Extension< {
|
|
90
100
|
MARKS: "code";
|
91
101
|
}>;
|
92
102
|
|
93
|
-
/**
|
103
|
+
/**
|
104
|
+
* @public
|
105
|
+
*/
|
94
106
|
export declare function defineCodeBlock(options?: {
|
95
107
|
hljs?: HLJSApi;
|
96
108
|
}): Extension< {
|
@@ -123,21 +135,23 @@ export declare function defineCodeSpec(): Extension< {
|
|
123
135
|
MARKS: "code";
|
124
136
|
}>;
|
125
137
|
|
126
|
-
/**
|
138
|
+
/**
|
139
|
+
* @public
|
140
|
+
*/
|
127
141
|
export declare function defineHeading(): Extension< {
|
128
142
|
NODES: "heading";
|
129
143
|
COMMAND_ARGS: {
|
130
|
-
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
131
144
|
setHeading: [attrs?: HeadingAttrs | undefined];
|
132
145
|
insertHeading: [attrs?: HeadingAttrs | undefined];
|
146
|
+
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
133
147
|
};
|
134
148
|
}>;
|
135
149
|
|
136
150
|
export declare function defineHeadingCommands(): Extension< {
|
137
151
|
COMMAND_ARGS: {
|
138
|
-
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
139
152
|
setHeading: [attrs?: HeadingAttrs | undefined];
|
140
153
|
insertHeading: [attrs?: HeadingAttrs | undefined];
|
154
|
+
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
141
155
|
};
|
142
156
|
}>;
|
143
157
|
|
@@ -149,7 +163,9 @@ export declare function defineHeadingSpec(): Extension< {
|
|
149
163
|
NODES: "heading";
|
150
164
|
}>;
|
151
165
|
|
152
|
-
/**
|
166
|
+
/**
|
167
|
+
* @public
|
168
|
+
*/
|
153
169
|
export declare function defineImage(): Extension< {
|
154
170
|
NODES: "image";
|
155
171
|
COMMAND_ARGS: {
|
@@ -167,7 +183,9 @@ export declare function defineImageSpec(): Extension< {
|
|
167
183
|
NODES: "image";
|
168
184
|
}>;
|
169
185
|
|
170
|
-
/**
|
186
|
+
/**
|
187
|
+
* @public
|
188
|
+
*/
|
171
189
|
export declare function defineItalic(): Extension< {
|
172
190
|
MARKS: "italic";
|
173
191
|
COMMAND_ARGS: {
|
@@ -175,7 +193,9 @@ toggleItalic: [];
|
|
175
193
|
};
|
176
194
|
}>;
|
177
195
|
|
178
|
-
/**
|
196
|
+
/**
|
197
|
+
* @public
|
198
|
+
*/
|
179
199
|
export declare function defineItalic_alias_1(): Extension< {
|
180
200
|
MARKS: "link";
|
181
201
|
COMMAND_ARGS: {
|
@@ -207,13 +227,43 @@ export declare function defineLinkSpec(): Extension< {
|
|
207
227
|
MARKS: "link";
|
208
228
|
}>;
|
209
229
|
|
210
|
-
/**
|
230
|
+
/**
|
231
|
+
* @public
|
232
|
+
*/
|
211
233
|
export declare function defineList(): Extension< {
|
212
234
|
NODES: "list";
|
235
|
+
COMMAND_ARGS: {
|
236
|
+
dedentList: [options?: DedentListOptions | undefined];
|
237
|
+
indentList: [options?: IndentListOptions | undefined];
|
238
|
+
moveList: [direction: "up" | "down"];
|
239
|
+
splitList: [];
|
240
|
+
toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
241
|
+
toggleList: [attrs: ListAttributes];
|
242
|
+
unwrapList: [options?: UnwrapListOptions | undefined];
|
243
|
+
wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
|
244
|
+
};
|
245
|
+
}>;
|
246
|
+
|
247
|
+
export declare function defineListCommands(): Extension< {
|
248
|
+
COMMAND_ARGS: {
|
249
|
+
dedentList: [options?: DedentListOptions | undefined];
|
250
|
+
indentList: [options?: IndentListOptions | undefined];
|
251
|
+
moveList: [direction: "up" | "down"];
|
252
|
+
splitList: [];
|
253
|
+
toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
254
|
+
toggleList: [attrs: ListAttributes];
|
255
|
+
unwrapList: [options?: UnwrapListOptions | undefined];
|
256
|
+
wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
|
257
|
+
};
|
213
258
|
}>;
|
214
259
|
|
215
260
|
export declare function defineListInputRules(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
216
261
|
|
262
|
+
/**
|
263
|
+
* Returns a extension that adds key bindings for list.
|
264
|
+
*
|
265
|
+
* @public
|
266
|
+
*/
|
217
267
|
export declare function defineListKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
218
268
|
|
219
269
|
export declare function defineListPlugins(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
@@ -256,7 +306,9 @@ export declare interface ImageAttrs {
|
|
256
306
|
src?: string | null;
|
257
307
|
}
|
258
308
|
|
259
|
-
/**
|
309
|
+
/**
|
310
|
+
* @public
|
311
|
+
*/
|
260
312
|
export declare interface LinkAttrs {
|
261
313
|
href: string;
|
262
314
|
}
|
@@ -58,14 +58,14 @@ function defineHeadingInputRule() {
|
|
58
58
|
}
|
59
59
|
function defineHeadingCommands() {
|
60
60
|
return defineCommands({
|
61
|
-
toggleHeading: (attrs) => {
|
62
|
-
return toggleNode({ type: "heading", attrs });
|
63
|
-
},
|
64
61
|
setHeading: (attrs) => {
|
65
62
|
return setBlockType({ type: "heading", attrs });
|
66
63
|
},
|
67
64
|
insertHeading: (attrs) => {
|
68
65
|
return insertNode({ type: "heading", attrs });
|
66
|
+
},
|
67
|
+
toggleHeading: (attrs) => {
|
68
|
+
return toggleNode({ type: "heading", attrs });
|
69
69
|
}
|
70
70
|
});
|
71
71
|
}
|
@@ -2,4 +2,5 @@ export { defineListSpec } from './_tsup-dts-rollup';
|
|
2
2
|
export { defineListPlugins } from './_tsup-dts-rollup';
|
3
3
|
export { defineListKeymap } from './_tsup-dts-rollup';
|
4
4
|
export { defineListInputRules } from './_tsup-dts-rollup';
|
5
|
+
export { defineListCommands } from './_tsup-dts-rollup';
|
5
6
|
export { defineList } from './_tsup-dts-rollup';
|
@@ -1,14 +1,25 @@
|
|
1
1
|
// src/list/index.ts
|
2
2
|
import {
|
3
|
+
Priority,
|
4
|
+
defineCommands,
|
3
5
|
defineInputRule,
|
4
6
|
defineKeymap,
|
5
7
|
defineNodeSpec,
|
6
8
|
definePlugin,
|
7
|
-
union
|
9
|
+
union,
|
10
|
+
withPriority
|
8
11
|
} from "@prosekit/core";
|
9
12
|
import {
|
13
|
+
createDedentListCommand,
|
14
|
+
createIndentListCommand,
|
10
15
|
createListPlugins,
|
11
16
|
createListSpec,
|
17
|
+
createMoveListCommand,
|
18
|
+
createSplitListCommand,
|
19
|
+
createToggleCollapsedCommand,
|
20
|
+
createToggleListCommand,
|
21
|
+
createUnwrapListCommand,
|
22
|
+
createWrapInListCommand,
|
12
23
|
listInputRules,
|
13
24
|
listKeymap
|
14
25
|
} from "prosemirror-flat-list";
|
@@ -24,16 +35,31 @@ function defineListKeymap() {
|
|
24
35
|
function defineListInputRules() {
|
25
36
|
return defineInputRule(() => listInputRules);
|
26
37
|
}
|
38
|
+
function defineListCommands() {
|
39
|
+
return defineCommands({
|
40
|
+
dedentList: createDedentListCommand,
|
41
|
+
indentList: createIndentListCommand,
|
42
|
+
moveList: createMoveListCommand,
|
43
|
+
splitList: createSplitListCommand,
|
44
|
+
toggleCollapsed: createToggleCollapsedCommand,
|
45
|
+
toggleList: createToggleListCommand,
|
46
|
+
unwrapList: createUnwrapListCommand,
|
47
|
+
wrapInList: createWrapInListCommand
|
48
|
+
});
|
49
|
+
}
|
27
50
|
function defineList() {
|
28
51
|
return union([
|
29
52
|
defineListSpec(),
|
30
53
|
defineListPlugins(),
|
31
|
-
|
32
|
-
|
54
|
+
// Use a high priority to override the default key bindings.
|
55
|
+
withPriority(defineListKeymap(), Priority.high),
|
56
|
+
defineListInputRules(),
|
57
|
+
defineListCommands()
|
33
58
|
]);
|
34
59
|
}
|
35
60
|
export {
|
36
61
|
defineList,
|
62
|
+
defineListCommands,
|
37
63
|
defineListInputRules,
|
38
64
|
defineListKeymap,
|
39
65
|
defineListPlugins,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/extensions",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.19",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -106,8 +106,8 @@
|
|
106
106
|
"dist"
|
107
107
|
],
|
108
108
|
"dependencies": {
|
109
|
-
"@prosekit/core": "^0.0.
|
110
|
-
"@prosekit/pm": "^0.0.
|
109
|
+
"@prosekit/core": "^0.0.17",
|
110
|
+
"@prosekit/pm": "^0.0.7",
|
111
111
|
"highlight.js": "^11.9.0",
|
112
112
|
"prosemirror-flat-list": "^0.4.3",
|
113
113
|
"prosemirror-highlightjs": "^0.9.1"
|
package/src/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {}
|