@prosekit/extensions 0.7.15 → 0.7.16
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.
@@ -90,19 +90,31 @@ declare class AutocompleteRule {
|
|
90
90
|
export { AutocompleteRule }
|
91
91
|
export { AutocompleteRule as AutocompleteRule_alias_1 }
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
declare type BlockquoteCommandsExtension = Extension<{
|
94
|
+
Commands: {
|
95
|
+
setBlockquote: [];
|
96
|
+
insertBlockquote: [];
|
97
|
+
toggleBlockquote: [];
|
98
|
+
};
|
99
|
+
}>;
|
100
|
+
export { BlockquoteCommandsExtension }
|
101
|
+
export { BlockquoteCommandsExtension as BlockquoteCommandsExtension_alias_1 }
|
97
102
|
|
98
103
|
/**
|
99
104
|
* @internal
|
100
105
|
*/
|
101
|
-
export declare type
|
106
|
+
export declare type BlockquoteExtension = Union<[
|
107
|
+
BlockquoteSpecExtension,
|
108
|
+
BlockquoteCommandsExtension
|
109
|
+
]>;
|
110
|
+
|
111
|
+
declare type BlockquoteSpecExtension = Extension<{
|
102
112
|
Nodes: {
|
103
113
|
blockquote: Attrs;
|
104
114
|
};
|
105
115
|
}>;
|
116
|
+
export { BlockquoteSpecExtension }
|
117
|
+
export { BlockquoteSpecExtension as BlockquoteSpecExtension_alias_1 }
|
106
118
|
|
107
119
|
/**
|
108
120
|
* @internal
|
@@ -330,13 +342,31 @@ export declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
|
330
342
|
*/
|
331
343
|
export declare function defineBlockquote(): BlockquoteExtension;
|
332
344
|
|
345
|
+
/**
|
346
|
+
* @internal
|
347
|
+
*/
|
348
|
+
declare function defineBlockquoteCommands(): BlockquoteCommandsExtension;
|
349
|
+
export { defineBlockquoteCommands }
|
350
|
+
export { defineBlockquoteCommands as defineBlockquoteCommands_alias_1 }
|
351
|
+
|
333
352
|
/**
|
334
353
|
* Wraps the text block in a blockquote when `>` is typed at the start of a new
|
335
354
|
* line followed by a space.
|
336
355
|
*/
|
337
|
-
|
356
|
+
declare function defineBlockquoteInputRule(): PlainExtension;
|
357
|
+
export { defineBlockquoteInputRule }
|
358
|
+
export { defineBlockquoteInputRule as defineBlockquoteInputRule_alias_1 }
|
359
|
+
|
360
|
+
/**
|
361
|
+
* @internal
|
362
|
+
*/
|
363
|
+
declare function defineBlockquoteKeymap(): PlainExtension;
|
364
|
+
export { defineBlockquoteKeymap }
|
365
|
+
export { defineBlockquoteKeymap as defineBlockquoteKeymap_alias_1 }
|
338
366
|
|
339
|
-
|
367
|
+
declare function defineBlockquoteSpec(): BlockquoteSpecExtension;
|
368
|
+
export { defineBlockquoteSpec }
|
369
|
+
export { defineBlockquoteSpec as defineBlockquoteSpec_alias_1 }
|
340
370
|
|
341
371
|
/**
|
342
372
|
* @public
|
@@ -1,5 +1,8 @@
|
|
1
|
+
export { defineBlockquote } from './_tsup-dts-rollup';
|
2
|
+
export { BlockquoteExtension } from './_tsup-dts-rollup';
|
1
3
|
export { defineBlockquoteSpec } from './_tsup-dts-rollup';
|
2
4
|
export { defineBlockquoteInputRule } from './_tsup-dts-rollup';
|
3
|
-
export {
|
5
|
+
export { defineBlockquoteCommands_alias_1 as defineBlockquoteCommands } from './_tsup-dts-rollup';
|
6
|
+
export { defineBlockquoteKeymap } from './_tsup-dts-rollup';
|
4
7
|
export { BlockquoteSpecExtension } from './_tsup-dts-rollup';
|
5
|
-
export {
|
8
|
+
export { BlockquoteCommandsExtension_alias_1 as BlockquoteCommandsExtension } from './_tsup-dts-rollup';
|
@@ -3,10 +3,61 @@ import {
|
|
3
3
|
} from "./chunk-LAQZC3ZM.js";
|
4
4
|
|
5
5
|
// src/blockquote/index.ts
|
6
|
+
import { union } from "@prosekit/core";
|
7
|
+
|
8
|
+
// src/blockquote/commands.ts
|
6
9
|
import {
|
7
|
-
|
8
|
-
|
10
|
+
defineCommands,
|
11
|
+
insertNode,
|
12
|
+
toggleWrap,
|
13
|
+
wrap
|
9
14
|
} from "@prosekit/core";
|
15
|
+
function defineBlockquoteCommands() {
|
16
|
+
return defineCommands({
|
17
|
+
setBlockquote: () => {
|
18
|
+
return wrap({ type: "blockquote" });
|
19
|
+
},
|
20
|
+
insertBlockquote: () => {
|
21
|
+
return insertNode({ type: "blockquote" });
|
22
|
+
},
|
23
|
+
toggleBlockquote: () => {
|
24
|
+
return toggleWrap({ type: "blockquote" });
|
25
|
+
}
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
// src/blockquote/input-rule.ts
|
30
|
+
function defineBlockquoteInputRule() {
|
31
|
+
return defineWrappingInputRule({
|
32
|
+
regex: /^>\s/,
|
33
|
+
type: "blockquote"
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
// src/blockquote/keymap.ts
|
38
|
+
import { defineKeymap, isAtBlockStart, toggleWrap as toggleWrap2 } from "@prosekit/core";
|
39
|
+
import { joinBackward } from "@prosekit/pm/commands";
|
40
|
+
function toggleBlockquoteKeybinding() {
|
41
|
+
return toggleWrap2({ type: "blockquote" });
|
42
|
+
}
|
43
|
+
function backspaceUnsetBlockquote() {
|
44
|
+
return (state, dispatch, view) => {
|
45
|
+
const $pos = isAtBlockStart(state, view);
|
46
|
+
if (($pos == null ? void 0 : $pos.node(-1).type.name) === "blockquote") {
|
47
|
+
return joinBackward(state, dispatch, view);
|
48
|
+
}
|
49
|
+
return false;
|
50
|
+
};
|
51
|
+
}
|
52
|
+
function defineBlockquoteKeymap() {
|
53
|
+
return defineKeymap({
|
54
|
+
"mod-shift-b": toggleBlockquoteKeybinding(),
|
55
|
+
Backspace: backspaceUnsetBlockquote()
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
// src/blockquote/spec.ts
|
60
|
+
import { defineNodeSpec } from "@prosekit/core";
|
10
61
|
function defineBlockquoteSpec() {
|
11
62
|
return defineNodeSpec({
|
12
63
|
name: "blockquote",
|
@@ -19,17 +70,20 @@ function defineBlockquoteSpec() {
|
|
19
70
|
}
|
20
71
|
});
|
21
72
|
}
|
22
|
-
|
23
|
-
|
24
|
-
regex: /^>\s/,
|
25
|
-
type: "blockquote"
|
26
|
-
});
|
27
|
-
}
|
73
|
+
|
74
|
+
// src/blockquote/index.ts
|
28
75
|
function defineBlockquote() {
|
29
|
-
return union(
|
76
|
+
return union(
|
77
|
+
defineBlockquoteSpec(),
|
78
|
+
defineBlockquoteInputRule(),
|
79
|
+
defineBlockquoteCommands(),
|
80
|
+
defineBlockquoteKeymap()
|
81
|
+
);
|
30
82
|
}
|
31
83
|
export {
|
32
84
|
defineBlockquote,
|
85
|
+
defineBlockquoteCommands,
|
33
86
|
defineBlockquoteInputRule,
|
87
|
+
defineBlockquoteKeymap,
|
34
88
|
defineBlockquoteSpec
|
35
89
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/extensions",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.7.
|
4
|
+
"version": "0.7.16",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -210,7 +210,7 @@
|
|
210
210
|
"prosemirror-search": "^1.0.0",
|
211
211
|
"prosemirror-tables": "^1.5.0",
|
212
212
|
"shiki": "^1.15.2",
|
213
|
-
"@prosekit/core": "^0.7.
|
213
|
+
"@prosekit/core": "^0.7.11",
|
214
214
|
"@prosekit/pm": "^0.1.8"
|
215
215
|
},
|
216
216
|
"peerDependencies": {
|
@@ -236,10 +236,10 @@
|
|
236
236
|
"devDependencies": {
|
237
237
|
"@vitest/browser": "^2.0.5",
|
238
238
|
"just-pick": "^4.2.0",
|
239
|
-
"loro-crdt": "^0.16.
|
239
|
+
"loro-crdt": "^0.16.10",
|
240
240
|
"loro-prosemirror": "^0.0.7",
|
241
241
|
"tsup": "^8.2.4",
|
242
|
-
"type-fest": "^4.
|
242
|
+
"type-fest": "^4.26.0",
|
243
243
|
"typescript": "^5.5.4",
|
244
244
|
"vitest": "^2.0.5",
|
245
245
|
"y-prosemirror": "^1.2.12",
|