@prosekit/core 0.1.3 → 0.1.4
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-core.js +6 -4
- package/package.json +1 -1
package/dist/prosekit-core.js
CHANGED
@@ -37,6 +37,7 @@ function addMark(options) {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
// src/commands/insert-node.ts
|
40
|
+
import { TextSelection } from "@prosekit/pm/state";
|
40
41
|
import { insertPoint } from "@prosekit/pm/transform";
|
41
42
|
|
42
43
|
// src/utils/get-node-type.ts
|
@@ -69,6 +70,7 @@ function insertNode(options) {
|
|
69
70
|
return false;
|
70
71
|
if (dispatch) {
|
71
72
|
const tr = state.tr.insert(insertPos, node);
|
73
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos)));
|
72
74
|
dispatch(tr);
|
73
75
|
}
|
74
76
|
return true;
|
@@ -97,13 +99,13 @@ function removeMark(options) {
|
|
97
99
|
import "@prosekit/pm/state";
|
98
100
|
|
99
101
|
// src/utils/get-custom-selection.ts
|
100
|
-
import { TextSelection } from "@prosekit/pm/state";
|
102
|
+
import { TextSelection as TextSelection2 } from "@prosekit/pm/state";
|
101
103
|
function getCustomSelection(state, from, to) {
|
102
104
|
const pos = from != null ? from : to;
|
103
105
|
if (pos != null) {
|
104
106
|
const $from = state.doc.resolve(from != null ? from : pos);
|
105
107
|
const $to = state.doc.resolve(to != null ? to : pos);
|
106
|
-
return
|
108
|
+
return TextSelection2.between($from, $to);
|
107
109
|
}
|
108
110
|
return state.selection;
|
109
111
|
}
|
@@ -657,7 +659,7 @@ import { Mark, ProseMirrorNode } from "@prosekit/pm/model";
|
|
657
659
|
import {
|
658
660
|
AllSelection,
|
659
661
|
NodeSelection,
|
660
|
-
TextSelection as
|
662
|
+
TextSelection as TextSelection3
|
661
663
|
} from "@prosekit/pm/state";
|
662
664
|
function isProseMirrorNode(node) {
|
663
665
|
return node instanceof ProseMirrorNode;
|
@@ -666,7 +668,7 @@ function isMark(mark) {
|
|
666
668
|
return mark instanceof Mark;
|
667
669
|
}
|
668
670
|
function isTextSelection(sel) {
|
669
|
-
return sel instanceof
|
671
|
+
return sel instanceof TextSelection3;
|
670
672
|
}
|
671
673
|
function isNodeSelection(sel) {
|
672
674
|
return sel instanceof NodeSelection;
|