@prosekit/extensions 0.7.24 → 0.9.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/commit/style.css +2 -1
- package/dist/commit/style.js +0 -0
- package/dist/enter-rule-RdhEA900.js +96 -0
- package/dist/gap-cursor/style.css +8 -5
- package/dist/gap-cursor/style.js +0 -0
- package/dist/input-rule-Gji4N7Oe.js +93 -0
- package/dist/list/style.css +7 -7
- package/dist/list/style.js +0 -0
- package/dist/loro/style.css +21 -17
- package/dist/loro/style.js +0 -0
- package/dist/mark-rule-wEOcDt6i.js +160 -0
- package/dist/placeholder/style.css +5 -5
- package/dist/placeholder/style.js +0 -0
- package/dist/prosekit-extensions-autocomplete.d.ts +33 -3
- package/dist/prosekit-extensions-autocomplete.js +122 -174
- package/dist/prosekit-extensions-blockquote.d.ts +51 -8
- package/dist/prosekit-extensions-blockquote.js +64 -78
- package/dist/prosekit-extensions-bold.d.ts +61 -8
- package/dist/prosekit-extensions-bold.js +61 -73
- package/dist/prosekit-extensions-code-block.d.ts +172 -20
- package/dist/prosekit-extensions-code-block.js +201 -184
- package/dist/prosekit-extensions-code.d.ts +61 -8
- package/dist/prosekit-extensions-code.js +44 -55
- package/dist/prosekit-extensions-commit.d.ts +53 -4
- package/dist/prosekit-extensions-commit.js +142 -183
- package/dist/prosekit-extensions-doc.d.ts +22 -0
- package/dist/prosekit-extensions-doc.js +16 -0
- package/dist/prosekit-extensions-drop-cursor.d.ts +34 -3
- package/dist/prosekit-extensions-drop-cursor.js +14 -8
- package/dist/prosekit-extensions-enter-rule.d.ts +106 -5
- package/dist/prosekit-extensions-enter-rule.js +3 -8
- package/dist/prosekit-extensions-file.d.ts +126 -8
- package/dist/prosekit-extensions-file.js +111 -132
- package/dist/prosekit-extensions-gap-cursor.d.ts +29 -2
- package/dist/prosekit-extensions-gap-cursor.js +21 -9
- package/dist/prosekit-extensions-hard-break.d.ts +58 -0
- package/dist/prosekit-extensions-hard-break.js +58 -0
- package/dist/prosekit-extensions-heading.d.ts +69 -9
- package/dist/prosekit-extensions-heading.js +121 -95
- package/dist/prosekit-extensions-horizontal-rule.d.ts +41 -8
- package/dist/prosekit-extensions-horizontal-rule.js +53 -71
- package/dist/prosekit-extensions-image.d.ts +53 -7
- package/dist/prosekit-extensions-image.js +71 -62
- package/dist/prosekit-extensions-input-rule.d.ts +134 -6
- package/dist/prosekit-extensions-input-rule.js +3 -14
- package/dist/prosekit-extensions-italic.d.ts +61 -8
- package/dist/prosekit-extensions-italic.js +51 -63
- package/dist/prosekit-extensions-link.d.ts +65 -10
- package/dist/prosekit-extensions-link.js +95 -100
- package/dist/prosekit-extensions-list.d.ts +114 -17
- package/dist/prosekit-extensions-list.js +115 -158
- package/dist/prosekit-extensions-loro.d.ts +78 -11
- package/dist/prosekit-extensions-loro.js +49 -77
- package/dist/prosekit-extensions-mark-rule.d.ts +41 -2
- package/dist/prosekit-extensions-mark-rule.js +3 -6
- package/dist/prosekit-extensions-mention.d.ts +40 -4
- package/dist/prosekit-extensions-mention.js +52 -50
- package/dist/prosekit-extensions-mod-click-prevention.d.ts +20 -2
- package/dist/prosekit-extensions-mod-click-prevention.js +20 -16
- package/dist/prosekit-extensions-paragraph.d.ts +65 -0
- package/dist/prosekit-extensions-paragraph.js +60 -0
- package/dist/prosekit-extensions-placeholder.d.ts +32 -2
- package/dist/prosekit-extensions-placeholder.js +39 -56
- package/dist/prosekit-extensions-readonly.d.ts +13 -1
- package/dist/prosekit-extensions-readonly.js +13 -14
- package/dist/prosekit-extensions-search.d.ts +77 -3
- package/dist/prosekit-extensions-search.js +48 -47
- package/dist/prosekit-extensions-strike.d.ts +50 -8
- package/dist/prosekit-extensions-strike.js +44 -49
- package/dist/prosekit-extensions-table.d.ts +237 -26
- package/dist/prosekit-extensions-table.js +3 -34
- package/dist/prosekit-extensions-text-align.d.ts +72 -8
- package/dist/prosekit-extensions-text-align.js +63 -44
- package/dist/prosekit-extensions-text.d.ts +22 -0
- package/dist/prosekit-extensions-text.js +15 -0
- package/dist/prosekit-extensions-underline.d.ts +46 -7
- package/dist/prosekit-extensions-underline.js +33 -37
- package/dist/prosekit-extensions-virtual-selection.d.ts +24 -2
- package/dist/prosekit-extensions-virtual-selection.js +49 -52
- package/dist/prosekit-extensions-yjs.d.ts +99 -14
- package/dist/prosekit-extensions-yjs.js +88 -131
- package/dist/prosekit-extensions.d.ts +1 -1
- package/dist/search/style.css +5 -5
- package/dist/search/style.js +0 -0
- package/dist/shiki-highlighter-chunk-Cd3WeOKL.d.ts +19 -0
- package/dist/shiki-highlighter-chunk.d.ts +2 -0
- package/dist/shiki-highlighter-chunk.js +34 -43
- package/dist/table/style.css +18 -17
- package/dist/table/style.js +0 -0
- package/dist/table-DnVliJ6E.js +287 -0
- package/dist/virtual-selection/style.css +2 -2
- package/dist/virtual-selection/style.js +0 -0
- package/dist/yjs/style.css +15 -17
- package/dist/yjs/style.js +0 -0
- package/package.json +103 -52
- package/dist/_tsup-dts-rollup.d.ts +0 -2500
- package/dist/chunk-6UYLCVBX.js +0 -185
- package/dist/chunk-BV3SHIMW.js +0 -98
- package/dist/chunk-D54VSLLS.js +0 -105
- package/dist/chunk-HFAZX2J3.js +0 -306
@@ -1,195 +1,143 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
defineFacetPayload,
|
5
|
-
pluginFacet
|
6
|
-
} from "@prosekit/core";
|
1
|
+
import { OBJECT_REPLACEMENT_CHARACTER, defineFacet, defineFacetPayload, pluginFacet } from "@prosekit/core";
|
2
|
+
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
3
|
+
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
7
4
|
|
8
|
-
|
9
|
-
import { OBJECT_REPLACEMENT_CHARACTER } from "@prosekit/core";
|
10
|
-
import {
|
11
|
-
Plugin
|
12
|
-
} from "@prosekit/pm/state";
|
13
|
-
import {
|
14
|
-
Decoration,
|
15
|
-
DecorationSet
|
16
|
-
} from "@prosekit/pm/view";
|
17
|
-
|
18
|
-
// src/autocomplete/autocomplete-helpers.ts
|
19
|
-
import {
|
20
|
-
PluginKey
|
21
|
-
} from "@prosekit/pm/state";
|
5
|
+
//#region src/autocomplete/autocomplete-helpers.ts
|
22
6
|
function defaultCanMatch({ state }) {
|
23
|
-
|
7
|
+
return state.selection.empty && !isInsideCode(state.selection.$from);
|
24
8
|
}
|
25
9
|
function isInsideCode($pos) {
|
26
|
-
|
27
|
-
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
return $pos.marks().some((mark) => mark.type.name === "code");
|
10
|
+
for (let d = $pos.depth; d > 0; d--) if ($pos.node(d).type.spec.code) return true;
|
11
|
+
return $pos.marks().some((mark) => mark.type.name === "code");
|
32
12
|
}
|
33
13
|
function getPluginState(state) {
|
34
|
-
|
14
|
+
return pluginKey.getState(state);
|
35
15
|
}
|
36
16
|
function getTrMeta(tr) {
|
37
|
-
|
17
|
+
return tr.getMeta(pluginKey);
|
38
18
|
}
|
39
19
|
function setTrMeta(tr, meta) {
|
40
|
-
|
20
|
+
return tr.setMeta(pluginKey, meta);
|
41
21
|
}
|
42
|
-
|
43
|
-
"prosekit-autocomplete"
|
44
|
-
);
|
22
|
+
const pluginKey = new PluginKey("prosekit-autocomplete");
|
45
23
|
|
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
|
-
ignoreMatch
|
112
|
-
});
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}),
|
116
|
-
props: {
|
117
|
-
decorations: (state) => {
|
118
|
-
const pluginState = getPluginState(state);
|
119
|
-
if (pluginState?.active && pluginState.matching) {
|
120
|
-
const { from, to } = pluginState.matching;
|
121
|
-
const deco = Decoration.inline(from, to, {
|
122
|
-
class: "prosemirror-prediction-match"
|
123
|
-
});
|
124
|
-
return DecorationSet.create(state.doc, [deco]);
|
125
|
-
}
|
126
|
-
return null;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
});
|
24
|
+
//#endregion
|
25
|
+
//#region src/autocomplete/autocomplete-plugin.ts
|
26
|
+
function createAutocompletePlugin({ getRules }) {
|
27
|
+
return new Plugin({
|
28
|
+
key: pluginKey,
|
29
|
+
state: {
|
30
|
+
init: () => {
|
31
|
+
return {
|
32
|
+
ignores: [],
|
33
|
+
matching: null
|
34
|
+
};
|
35
|
+
},
|
36
|
+
apply: (tr, prevValue, oldState, newState) => {
|
37
|
+
const meta = getTrMeta(tr);
|
38
|
+
if (!tr.docChanged && oldState.selection.eq(newState.selection) && !meta) return prevValue;
|
39
|
+
if (meta) {
|
40
|
+
let ignores = prevValue.ignores;
|
41
|
+
if (!ignores.includes(meta.ignore)) ignores = [...ignores, meta.ignore];
|
42
|
+
return {
|
43
|
+
matching: null,
|
44
|
+
ignores
|
45
|
+
};
|
46
|
+
}
|
47
|
+
const ignoreSet = new Set(prevValue.ignores.map((pos) => tr.mapping.map(pos)));
|
48
|
+
let matching = calcPluginStateMatching(newState, getRules());
|
49
|
+
if (matching && ignoreSet.has(matching.from)) matching = null;
|
50
|
+
return {
|
51
|
+
matching,
|
52
|
+
ignores: Array.from(ignoreSet)
|
53
|
+
};
|
54
|
+
}
|
55
|
+
},
|
56
|
+
view: () => ({ update: (view, prevState) => {
|
57
|
+
const prevValue = getPluginState(prevState);
|
58
|
+
const currValue = getPluginState(view.state);
|
59
|
+
if (prevValue?.matching && prevValue.matching.rule !== currValue?.matching?.rule) prevValue.matching.rule.onLeave?.();
|
60
|
+
if (currValue?.matching && !currValue.ignores.includes(currValue.matching.from)) {
|
61
|
+
const { from, to, match, rule } = currValue.matching;
|
62
|
+
const textContent = view.state.doc.textBetween(from, to, null, OBJECT_REPLACEMENT_CHARACTER);
|
63
|
+
const deleteMatch = () => {
|
64
|
+
if (view.state.doc.textBetween(from, to, null, OBJECT_REPLACEMENT_CHARACTER) === textContent) view.dispatch(view.state.tr.delete(from, to));
|
65
|
+
};
|
66
|
+
const ignoreMatch = () => {
|
67
|
+
view.dispatch(setTrMeta(view.state.tr, { ignore: from }));
|
68
|
+
};
|
69
|
+
rule.onMatch({
|
70
|
+
state: view.state,
|
71
|
+
match,
|
72
|
+
from,
|
73
|
+
to,
|
74
|
+
deleteMatch,
|
75
|
+
ignoreMatch
|
76
|
+
});
|
77
|
+
}
|
78
|
+
} }),
|
79
|
+
props: { decorations: (state) => {
|
80
|
+
const pluginState = getPluginState(state);
|
81
|
+
if (pluginState?.matching) {
|
82
|
+
const { from, to } = pluginState.matching;
|
83
|
+
const deco = Decoration.inline(from, to, { class: "prosemirror-prediction-match" });
|
84
|
+
return DecorationSet.create(state.doc, [deco]);
|
85
|
+
}
|
86
|
+
return null;
|
87
|
+
} }
|
88
|
+
});
|
130
89
|
}
|
131
|
-
|
132
|
-
function
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
return {
|
152
|
-
active: true,
|
153
|
-
ignore: null,
|
154
|
-
matching: {
|
155
|
-
rule,
|
156
|
-
match,
|
157
|
-
from,
|
158
|
-
to: $pos.pos
|
159
|
-
}
|
160
|
-
};
|
161
|
-
}
|
162
|
-
return { active: false, ignore: null, matching: null };
|
90
|
+
const MAX_MATCH = 200;
|
91
|
+
function calcPluginStateMatching(state, rules) {
|
92
|
+
const $pos = state.selection.$from;
|
93
|
+
const parentOffset = $pos.parentOffset;
|
94
|
+
const textBefore = $pos.parent.textBetween(Math.max(0, parentOffset - MAX_MATCH), parentOffset, null, OBJECT_REPLACEMENT_CHARACTER);
|
95
|
+
for (const rule of rules) {
|
96
|
+
if (!rule.canMatch({ state })) continue;
|
97
|
+
rule.regex.lastIndex = 0;
|
98
|
+
const match = rule.regex.exec(textBefore);
|
99
|
+
if (!match) continue;
|
100
|
+
const to = $pos.pos;
|
101
|
+
const from = to - textBefore.length + match.index;
|
102
|
+
return {
|
103
|
+
rule,
|
104
|
+
match,
|
105
|
+
from,
|
106
|
+
to
|
107
|
+
};
|
108
|
+
}
|
109
|
+
return null;
|
163
110
|
}
|
164
111
|
|
165
|
-
|
112
|
+
//#endregion
|
113
|
+
//#region src/autocomplete/autocomplete.ts
|
166
114
|
function defineAutocomplete(rule) {
|
167
|
-
|
115
|
+
return defineFacetPayload(autocompleteFacet, [rule]);
|
168
116
|
}
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
117
|
+
const autocompleteFacet = defineFacet({
|
118
|
+
reduce: () => {
|
119
|
+
let rules = [];
|
120
|
+
const getRules = () => rules;
|
121
|
+
const plugin = createAutocompletePlugin({ getRules });
|
122
|
+
return function reducer(inputs) {
|
123
|
+
rules = inputs;
|
124
|
+
return plugin;
|
125
|
+
};
|
126
|
+
},
|
127
|
+
parent: pluginFacet,
|
128
|
+
singleton: true
|
181
129
|
});
|
182
130
|
|
183
|
-
|
131
|
+
//#endregion
|
132
|
+
//#region src/autocomplete/autocomplete-rule.ts
|
184
133
|
var AutocompleteRule = class {
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
};
|
192
|
-
export {
|
193
|
-
AutocompleteRule,
|
194
|
-
defineAutocomplete
|
134
|
+
constructor(options) {
|
135
|
+
this.regex = options.regex;
|
136
|
+
this.onMatch = options.onEnter;
|
137
|
+
this.onLeave = options.onLeave;
|
138
|
+
this.canMatch = options.canMatch ?? defaultCanMatch;
|
139
|
+
}
|
195
140
|
};
|
141
|
+
|
142
|
+
//#endregion
|
143
|
+
export { AutocompleteRule, defineAutocomplete };
|
@@ -1,8 +1,51 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
2
|
+
import { Attrs } from "@prosekit/pm/model";
|
3
|
+
|
4
|
+
//#region src/blockquote/blockquote-commands.d.ts
|
5
|
+
type BlockquoteCommandsExtension = Extension<{
|
6
|
+
Commands: {
|
7
|
+
setBlockquote: [];
|
8
|
+
insertBlockquote: [];
|
9
|
+
toggleBlockquote: [];
|
10
|
+
};
|
11
|
+
}>;
|
12
|
+
/**
|
13
|
+
* @internal
|
14
|
+
*/
|
15
|
+
declare function defineBlockquoteCommands(): BlockquoteCommandsExtension; //#endregion
|
16
|
+
//#region src/blockquote/blockquote-spec.d.ts
|
17
|
+
type BlockquoteSpecExtension = Extension<{
|
18
|
+
Nodes: {
|
19
|
+
blockquote: Attrs;
|
20
|
+
};
|
21
|
+
}>;
|
22
|
+
declare function defineBlockquoteSpec(): BlockquoteSpecExtension;
|
23
|
+
|
24
|
+
//#endregion
|
25
|
+
//#region src/blockquote/blockquote.d.ts
|
26
|
+
/**
|
27
|
+
* @internal
|
28
|
+
*/
|
29
|
+
type BlockquoteExtension = Union<[BlockquoteSpecExtension, BlockquoteCommandsExtension]>;
|
30
|
+
/**
|
31
|
+
* @public
|
32
|
+
*/
|
33
|
+
declare function defineBlockquote(): BlockquoteExtension;
|
34
|
+
|
35
|
+
//#endregion
|
36
|
+
//#region src/blockquote/blockquote-input-rule.d.ts
|
37
|
+
/**
|
38
|
+
* Wraps the text block in a blockquote when `>` is typed at the start of a new
|
39
|
+
* line followed by a space.
|
40
|
+
*/
|
41
|
+
declare function defineBlockquoteInputRule(): PlainExtension;
|
42
|
+
|
43
|
+
//#endregion
|
44
|
+
//#region src/blockquote/blockquote-keymap.d.ts
|
45
|
+
/**
|
46
|
+
* @internal
|
47
|
+
*/
|
48
|
+
declare function defineBlockquoteKeymap(): PlainExtension;
|
49
|
+
|
50
|
+
//#endregion
|
51
|
+
export { BlockquoteCommandsExtension, BlockquoteExtension, BlockquoteSpecExtension, defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
|
@@ -1,97 +1,83 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
} from "
|
4
|
-
|
5
|
-
// src/blockquote/blockquote.ts
|
6
|
-
import {
|
7
|
-
union
|
8
|
-
} from "@prosekit/core";
|
1
|
+
import { defineWrappingInputRule } from "./input-rule-Gji4N7Oe.js";
|
2
|
+
import { defineCommands, defineKeymap, defineNodeSpec, insertNode, isAtBlockStart, toggleWrap, union, wrap } from "@prosekit/core";
|
3
|
+
import { joinBackward } from "@prosekit/pm/commands";
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
toggleWrap,
|
15
|
-
wrap
|
16
|
-
} from "@prosekit/core";
|
5
|
+
//#region src/blockquote/blockquote-commands.ts
|
6
|
+
/**
|
7
|
+
* @internal
|
8
|
+
*/
|
17
9
|
function defineBlockquoteCommands() {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
10
|
+
return defineCommands({
|
11
|
+
setBlockquote: () => {
|
12
|
+
return wrap({ type: "blockquote" });
|
13
|
+
},
|
14
|
+
insertBlockquote: () => {
|
15
|
+
return insertNode({ type: "blockquote" });
|
16
|
+
},
|
17
|
+
toggleBlockquote: () => {
|
18
|
+
return toggleWrap({ type: "blockquote" });
|
19
|
+
}
|
20
|
+
});
|
29
21
|
}
|
30
22
|
|
31
|
-
|
23
|
+
//#endregion
|
24
|
+
//#region src/blockquote/blockquote-input-rule.ts
|
25
|
+
/**
|
26
|
+
* Wraps the text block in a blockquote when `>` is typed at the start of a new
|
27
|
+
* line followed by a space.
|
28
|
+
*/
|
32
29
|
function defineBlockquoteInputRule() {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
return defineWrappingInputRule({
|
31
|
+
regex: /^>\s/,
|
32
|
+
type: "blockquote"
|
33
|
+
});
|
37
34
|
}
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
defineKeymap,
|
42
|
-
isAtBlockStart,
|
43
|
-
toggleWrap as toggleWrap2
|
44
|
-
} from "@prosekit/core";
|
45
|
-
import { joinBackward } from "@prosekit/pm/commands";
|
36
|
+
//#endregion
|
37
|
+
//#region src/blockquote/blockquote-keymap.ts
|
46
38
|
function toggleBlockquoteKeybinding() {
|
47
|
-
|
39
|
+
return toggleWrap({ type: "blockquote" });
|
48
40
|
}
|
49
41
|
function backspaceUnsetBlockquote() {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
return false;
|
56
|
-
};
|
42
|
+
return (state, dispatch, view) => {
|
43
|
+
const $pos = isAtBlockStart(state, view);
|
44
|
+
if ($pos?.node(-1).type.name === "blockquote") return joinBackward(state, dispatch, view);
|
45
|
+
return false;
|
46
|
+
};
|
57
47
|
}
|
48
|
+
/**
|
49
|
+
* @internal
|
50
|
+
*/
|
58
51
|
function defineBlockquoteKeymap() {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
52
|
+
return defineKeymap({
|
53
|
+
"mod-shift-b": toggleBlockquoteKeybinding(),
|
54
|
+
"Backspace": backspaceUnsetBlockquote()
|
55
|
+
});
|
63
56
|
}
|
64
57
|
|
65
|
-
|
66
|
-
|
67
|
-
defineNodeSpec
|
68
|
-
} from "@prosekit/core";
|
58
|
+
//#endregion
|
59
|
+
//#region src/blockquote/blockquote-spec.ts
|
69
60
|
function defineBlockquoteSpec() {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
61
|
+
return defineNodeSpec({
|
62
|
+
name: "blockquote",
|
63
|
+
content: "block+",
|
64
|
+
group: "block",
|
65
|
+
defining: true,
|
66
|
+
parseDOM: [{ tag: "blockquote" }],
|
67
|
+
toDOM() {
|
68
|
+
return ["blockquote", 0];
|
69
|
+
}
|
70
|
+
});
|
80
71
|
}
|
81
72
|
|
82
|
-
|
73
|
+
//#endregion
|
74
|
+
//#region src/blockquote/blockquote.ts
|
75
|
+
/**
|
76
|
+
* @public
|
77
|
+
*/
|
83
78
|
function defineBlockquote() {
|
84
|
-
|
85
|
-
defineBlockquoteSpec(),
|
86
|
-
defineBlockquoteInputRule(),
|
87
|
-
defineBlockquoteCommands(),
|
88
|
-
defineBlockquoteKeymap()
|
89
|
-
);
|
79
|
+
return union(defineBlockquoteSpec(), defineBlockquoteInputRule(), defineBlockquoteCommands(), defineBlockquoteKeymap());
|
90
80
|
}
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
defineBlockquoteInputRule,
|
95
|
-
defineBlockquoteKeymap,
|
96
|
-
defineBlockquoteSpec
|
97
|
-
};
|
81
|
+
|
82
|
+
//#endregion
|
83
|
+
export { defineBlockquote, defineBlockquoteCommands, defineBlockquoteInputRule, defineBlockquoteKeymap, defineBlockquoteSpec };
|
@@ -1,8 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
import { Extension, PlainExtension, Union } from "@prosekit/core";
|
2
|
+
import { Attrs } from "@prosekit/pm/model";
|
3
|
+
|
4
|
+
//#region src/bold/bold-commands.d.ts
|
5
|
+
/**
|
6
|
+
* @internal
|
7
|
+
*/
|
8
|
+
/**
|
9
|
+
* @internal
|
10
|
+
*/
|
11
|
+
type BoldCommandsExtension = Extension<{
|
12
|
+
Commands: {
|
13
|
+
toggleBold: [];
|
14
|
+
};
|
15
|
+
}>;
|
16
|
+
/**
|
17
|
+
* @internal
|
18
|
+
*/
|
19
|
+
declare function defineBoldCommands(): BoldCommandsExtension;
|
20
|
+
//#endregion
|
21
|
+
//#region src/bold/bold-spec.d.ts
|
22
|
+
/**
|
23
|
+
* @internal
|
24
|
+
*/
|
25
|
+
type BoldSpecExtension = Extension<{
|
26
|
+
Marks: {
|
27
|
+
bold: Attrs;
|
28
|
+
};
|
29
|
+
}>;
|
30
|
+
/**
|
31
|
+
* @internal
|
32
|
+
*/
|
33
|
+
declare function defineBoldSpec(): BoldSpecExtension;
|
34
|
+
|
35
|
+
//#endregion
|
36
|
+
//#region src/bold/bold.d.ts
|
37
|
+
/**
|
38
|
+
* @internal
|
39
|
+
*/
|
40
|
+
type BoldExtension = Union<[BoldSpecExtension, BoldCommandsExtension]>;
|
41
|
+
/**
|
42
|
+
* @public
|
43
|
+
*/
|
44
|
+
declare function defineBold(): BoldExtension;
|
45
|
+
|
46
|
+
//#endregion
|
47
|
+
//#region src/bold/bold-input-rule.d.ts
|
48
|
+
/**
|
49
|
+
* @internal
|
50
|
+
*/
|
51
|
+
declare function defineBoldInputRule(): PlainExtension;
|
52
|
+
|
53
|
+
//#endregion
|
54
|
+
//#region src/bold/bold-keymap.d.ts
|
55
|
+
/**
|
56
|
+
* @internal
|
57
|
+
*/
|
58
|
+
declare function defineBoldKeymap(): PlainExtension;
|
59
|
+
|
60
|
+
//#endregion
|
61
|
+
export { BoldCommandsExtension, BoldExtension, BoldSpecExtension, defineBold, defineBoldCommands, defineBoldInputRule, defineBoldKeymap, defineBoldSpec };
|