@prosekit/core 0.1.4 → 0.1.6
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/_tsup-dts-rollup.d.ts +2 -0
- package/dist/prosekit-core.d.ts +1 -59
- package/dist/prosekit-core.js +25 -5
- package/package.json +4 -4
package/dist/prosekit-core.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { ProseKitError } from './_tsup-dts-rollup';
|
2
1
|
export { addMark } from './_tsup-dts-rollup';
|
3
2
|
export { insertNode } from './_tsup-dts-rollup';
|
4
3
|
export { removeMark } from './_tsup-dts-rollup';
|
@@ -10,6 +9,7 @@ export { createEditor } from './_tsup-dts-rollup';
|
|
10
9
|
export { EditorOptions } from './_tsup-dts-rollup';
|
11
10
|
export { union } from './_tsup-dts-rollup';
|
12
11
|
export { withPriority } from './_tsup-dts-rollup';
|
12
|
+
export { ProseKitError_alias_1 as ProseKitError } from './_tsup-dts-rollup';
|
13
13
|
export { defineBaseCommands } from './_tsup-dts-rollup';
|
14
14
|
export { defineCommands } from './_tsup-dts-rollup';
|
15
15
|
export { defineDefaultState } from './_tsup-dts-rollup';
|
@@ -64,61 +64,3 @@ export { isMark } from './_tsup-dts-rollup';
|
|
64
64
|
export { isNodeSelection } from './_tsup-dts-rollup';
|
65
65
|
export { isProseMirrorNode } from './_tsup-dts-rollup';
|
66
66
|
export { isTextSelection } from './_tsup-dts-rollup';
|
67
|
-
export { insertText } from './_tsup-dts-rollup';
|
68
|
-
export { selectAll } from './_tsup-dts-rollup';
|
69
|
-
export { wrap } from './_tsup-dts-rollup';
|
70
|
-
export { createNodeBuilder } from './_tsup-dts-rollup';
|
71
|
-
export { createMarkBuilder } from './_tsup-dts-rollup';
|
72
|
-
export { NodeChild } from './_tsup-dts-rollup';
|
73
|
-
export { NodeBuilder } from './_tsup-dts-rollup';
|
74
|
-
export { MarkBuilder } from './_tsup-dts-rollup';
|
75
|
-
export { applyAction } from './_tsup-dts-rollup';
|
76
|
-
export { insertNodeAction } from './_tsup-dts-rollup';
|
77
|
-
export { defineParagraphSpec } from './_tsup-dts-rollup';
|
78
|
-
export { UpdateHandler } from './_tsup-dts-rollup';
|
79
|
-
export { BaseExtension } from './_tsup-dts-rollup';
|
80
|
-
export { CommandPayload } from './_tsup-dts-rollup';
|
81
|
-
export { commandFacet } from './_tsup-dts-rollup';
|
82
|
-
export { getFacetCount } from './_tsup-dts-rollup';
|
83
|
-
export { FacetConverter } from './_tsup-dts-rollup';
|
84
|
-
export { FacetExtensionImpl } from './_tsup-dts-rollup';
|
85
|
-
export { updateExtension } from './_tsup-dts-rollup';
|
86
|
-
export { Payloads } from './_tsup-dts-rollup';
|
87
|
-
export { Converters } from './_tsup-dts-rollup';
|
88
|
-
export { SchemaPayload } from './_tsup-dts-rollup';
|
89
|
-
export { schemaFacet } from './_tsup-dts-rollup';
|
90
|
-
export { StatePayload } from './_tsup-dts-rollup';
|
91
|
-
export { stateFacet } from './_tsup-dts-rollup';
|
92
|
-
export { UnionExtensionImpl } from './_tsup-dts-rollup';
|
93
|
-
export { ViewPayload } from './_tsup-dts-rollup';
|
94
|
-
export { viewFacet } from './_tsup-dts-rollup';
|
95
|
-
export { assertTypeEqual } from './_tsup-dts-rollup';
|
96
|
-
export { CommandApplier } from './_tsup-dts-rollup';
|
97
|
-
export { CommandCreator } from './_tsup-dts-rollup';
|
98
|
-
export { CommandCreators } from './_tsup-dts-rollup';
|
99
|
-
export { ToCommandArgs } from './_tsup-dts-rollup';
|
100
|
-
export { ToCommandCreators } from './_tsup-dts-rollup';
|
101
|
-
export { ToCommandApplier } from './_tsup-dts-rollup';
|
102
|
-
export { ExceptEmptyValue } from './_tsup-dts-rollup';
|
103
|
-
export { ExtractNodesFromTyping } from './_tsup-dts-rollup';
|
104
|
-
export { ExtractMarksFromTyping } from './_tsup-dts-rollup';
|
105
|
-
export { ExtractCommandArgsFromTyping } from './_tsup-dts-rollup';
|
106
|
-
export { ExtractTyping } from './_tsup-dts-rollup';
|
107
|
-
export { ExtractCommandArgs } from './_tsup-dts-rollup';
|
108
|
-
export { ExtractKey } from './_tsup-dts-rollup';
|
109
|
-
export { voidFunction } from './_tsup-dts-rollup';
|
110
|
-
export { attrsMatch } from './_tsup-dts-rollup';
|
111
|
-
export { collectNodes } from './_tsup-dts-rollup';
|
112
|
-
export { NodeContent } from './_tsup-dts-rollup';
|
113
|
-
export { isMac } from './_tsup-dts-rollup';
|
114
|
-
export { getCustomSelection } from './_tsup-dts-rollup';
|
115
|
-
export { getBrowserDocument } from './_tsup-dts-rollup';
|
116
|
-
export { getBrowserWindow } from './_tsup-dts-rollup';
|
117
|
-
export { isMarkActive } from './_tsup-dts-rollup';
|
118
|
-
export { isNodeActive } from './_tsup-dts-rollup';
|
119
|
-
export { isNotNull } from './_tsup-dts-rollup';
|
120
|
-
export { objectEqual } from './_tsup-dts-rollup';
|
121
|
-
export { elementFromHTML } from './_tsup-dts-rollup';
|
122
|
-
export { uniqPush } from './_tsup-dts-rollup';
|
123
|
-
export { uniqRemove } from './_tsup-dts-rollup';
|
124
|
-
export { default_alias as default } from './_tsup-dts-rollup';
|
package/dist/prosekit-core.js
CHANGED
@@ -37,7 +37,7 @@ function addMark(options) {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
// src/commands/insert-node.ts
|
40
|
-
import
|
40
|
+
import "@prosekit/pm/state";
|
41
41
|
import { insertPoint } from "@prosekit/pm/transform";
|
42
42
|
|
43
43
|
// src/utils/get-node-type.ts
|
@@ -53,6 +53,15 @@ function getNodeType(schema, type) {
|
|
53
53
|
return type;
|
54
54
|
}
|
55
55
|
|
56
|
+
// src/utils/set-selection-around.ts
|
57
|
+
import { TextSelection } from "@prosekit/pm/state";
|
58
|
+
function setSelectionAround(tr, pos) {
|
59
|
+
const docSize = tr.doc.content.size;
|
60
|
+
const $pos = tr.doc.resolve(pos > docSize ? docSize : pos < 0 ? 0 : pos);
|
61
|
+
const selection = TextSelection.between($pos, $pos);
|
62
|
+
tr.setSelection(selection);
|
63
|
+
}
|
64
|
+
|
56
65
|
// src/commands/insert-node.ts
|
57
66
|
function insertNode(options) {
|
58
67
|
return (state, dispatch) => {
|
@@ -70,7 +79,7 @@ function insertNode(options) {
|
|
70
79
|
return false;
|
71
80
|
if (dispatch) {
|
72
81
|
const tr = state.tr.insert(insertPos, node);
|
73
|
-
|
82
|
+
setSelectionAround(tr, insertPos + node.nodeSize);
|
74
83
|
dispatch(tr);
|
75
84
|
}
|
76
85
|
return true;
|
@@ -1158,11 +1167,22 @@ function definePlugin(plugin) {
|
|
1158
1167
|
throw new TypeError("Invalid plugin");
|
1159
1168
|
}
|
1160
1169
|
var pluginFacet = Facet.define({
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1170
|
+
converter: () => {
|
1171
|
+
let inputs = [];
|
1172
|
+
const output = ({ schema }) => {
|
1173
|
+
const plugins = inputs.flatMap((func) => func({ schema }));
|
1164
1174
|
return { plugins };
|
1165
1175
|
};
|
1176
|
+
return {
|
1177
|
+
create: (payloads) => {
|
1178
|
+
inputs = payloads;
|
1179
|
+
return output;
|
1180
|
+
},
|
1181
|
+
update: (payloads) => {
|
1182
|
+
inputs = payloads;
|
1183
|
+
return output;
|
1184
|
+
}
|
1185
|
+
};
|
1166
1186
|
},
|
1167
1187
|
next: stateFacet
|
1168
1188
|
});
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.6",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -40,12 +40,12 @@
|
|
40
40
|
"dependencies": {
|
41
41
|
"@prosekit/pm": "^0.1.0",
|
42
42
|
"orderedmap": "^2.1.1",
|
43
|
-
"type-fest": "^4.8.
|
43
|
+
"type-fest": "^4.8.2"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@prosekit/dev": "*",
|
47
|
-
"tsup": "^
|
48
|
-
"typescript": "^5.
|
47
|
+
"tsup": "^8.0.1",
|
48
|
+
"typescript": "^5.3.2",
|
49
49
|
"vitest": "^0.34.6"
|
50
50
|
},
|
51
51
|
"scripts": {
|