@tiptap/core 2.0.0-beta.172 → 2.0.0-beta.175
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/tiptap-core.cjs.js +11 -14
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +11 -14
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +11 -14
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/setTextSelection.ts +2 -2
- package/src/extensions/keymap.ts +0 -2
- package/src/helpers/resolveFocusPosition.ts +18 -10
package/dist/tiptap-core.umd.js
CHANGED
|
@@ -506,21 +506,20 @@
|
|
|
506
506
|
if (!position) {
|
|
507
507
|
return null;
|
|
508
508
|
}
|
|
509
|
+
const selectionAtStart = prosemirrorState.Selection.atStart(doc);
|
|
510
|
+
const selectionAtEnd = prosemirrorState.Selection.atEnd(doc);
|
|
509
511
|
if (position === 'start' || position === true) {
|
|
510
|
-
return
|
|
512
|
+
return selectionAtStart;
|
|
511
513
|
}
|
|
512
514
|
if (position === 'end') {
|
|
513
|
-
return
|
|
515
|
+
return selectionAtEnd;
|
|
514
516
|
}
|
|
517
|
+
const minPos = selectionAtStart.from;
|
|
518
|
+
const maxPos = selectionAtEnd.to;
|
|
515
519
|
if (position === 'all') {
|
|
516
|
-
return prosemirrorState.TextSelection.create(doc, 0, doc.content.size);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
const minPos = prosemirrorState.Selection.atStart(doc).from;
|
|
520
|
-
const maxPos = prosemirrorState.Selection.atEnd(doc).to;
|
|
521
|
-
const resolvedFrom = minMax(position, minPos, maxPos);
|
|
522
|
-
const resolvedEnd = minMax(position, minPos, maxPos);
|
|
523
|
-
return prosemirrorState.TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
520
|
+
return prosemirrorState.TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
|
|
521
|
+
}
|
|
522
|
+
return prosemirrorState.TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
524
523
|
}
|
|
525
524
|
|
|
526
525
|
const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
|
|
@@ -1191,8 +1190,8 @@
|
|
|
1191
1190
|
const { from, to } = typeof position === 'number'
|
|
1192
1191
|
? { from: position, to: position }
|
|
1193
1192
|
: position;
|
|
1194
|
-
const minPos =
|
|
1195
|
-
const maxPos =
|
|
1193
|
+
const minPos = prosemirrorState.TextSelection.atStart(doc).from;
|
|
1194
|
+
const maxPos = prosemirrorState.TextSelection.atEnd(doc).to;
|
|
1196
1195
|
const resolvedFrom = minMax(from, minPos, maxPos);
|
|
1197
1196
|
const resolvedEnd = minMax(to, minPos, maxPos);
|
|
1198
1197
|
const selection = prosemirrorState.TextSelection.create(doc, resolvedFrom, resolvedEnd);
|
|
@@ -2097,8 +2096,6 @@
|
|
|
2097
2096
|
};
|
|
2098
2097
|
const pcKeymap = {
|
|
2099
2098
|
...baseKeymap,
|
|
2100
|
-
Home: () => this.editor.commands.selectTextblockStart(),
|
|
2101
|
-
End: () => this.editor.commands.selectTextblockEnd(),
|
|
2102
2099
|
};
|
|
2103
2100
|
const macKeymap = {
|
|
2104
2101
|
...baseKeymap,
|