@nerd-bible/wordgard 0.6.2-beta3 → 0.6.2-beta4
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/command.js +1 -1
- package/dist/doc.js +2 -0
- package/dist/editor.js +3 -2
- package/package.json +1 -1
package/dist/command.js
CHANGED
|
@@ -740,7 +740,7 @@ const insertText = ({ state }, { from, to, insert, userEvent }) => {
|
|
|
740
740
|
let marks = (from == selection.from && to == selection.to && state.sel.activeMarks) ||
|
|
741
741
|
state.doc.resolve(from).marks(state.doc.resolve(to));
|
|
742
742
|
return {
|
|
743
|
-
changes: { from, to, insert: [Leaf.
|
|
743
|
+
changes: { from, to, insert: insert ? [Leaf.text(insert, marks)] : undefined, fit: true },
|
|
744
744
|
scrollIntoView: true,
|
|
745
745
|
selection: (cx, changes) => GardSelection.near(cx, changes.mapPos(to, 1), -1),
|
|
746
746
|
userEvent
|
package/dist/doc.js
CHANGED
|
@@ -1207,6 +1207,8 @@ class Leaf extends BaseTag {
|
|
|
1207
1207
|
return Leaf.Text.of(this.param.slice(Math.max(from, 0), Math.max(0, to)), this.marks);
|
|
1208
1208
|
}
|
|
1209
1209
|
static text(text, marks = Mark.none) {
|
|
1210
|
+
if (!text)
|
|
1211
|
+
throw new Error("Cannot create empty text nodes");
|
|
1210
1212
|
return Leaf.Text.of(text, marks);
|
|
1211
1213
|
}
|
|
1212
1214
|
toString() {
|
package/dist/editor.js
CHANGED
|
@@ -4494,7 +4494,8 @@ const baseHandlers = {
|
|
|
4494
4494
|
wg.inputState.pendingInputEvent = null;
|
|
4495
4495
|
let change;
|
|
4496
4496
|
if (compositionInputTypes.has(event.inputType) || event.inputType == "insertText") {
|
|
4497
|
-
|
|
4497
|
+
let text = pending.data || "";
|
|
4498
|
+
change = { from: pending.domRange.from, to: pending.domRange.to, insert: text ? [Leaf.text(text)] : undefined };
|
|
4498
4499
|
}
|
|
4499
4500
|
else if (isDeletionInputEvent(event.inputType)) {
|
|
4500
4501
|
change = { from: pending.domRange.from, to: pending.domRange.to };
|
|
@@ -7407,7 +7408,7 @@ function ensureAnchor(regexp) {
|
|
|
7407
7408
|
}
|
|
7408
7409
|
function applyString(text) {
|
|
7409
7410
|
return (state, match) => ({
|
|
7410
|
-
changes: { from: match[0].from.pos, to: match[0].to.pos, insert: [Leaf.text(text)] },
|
|
7411
|
+
changes: { from: match[0].from.pos, to: match[0].to.pos, insert: text ? [Leaf.text(text)] : undefined },
|
|
7411
7412
|
annotations: history.isolate.of(true)
|
|
7412
7413
|
});
|
|
7413
7414
|
}
|