@tiptap/core 2.0.0-beta.173 → 2.0.0-beta.174
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 +10 -11
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +10 -11
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +10 -11
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/setTextSelection.ts +1 -1
- 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, }) => {
|
|
@@ -1192,7 +1191,7 @@
|
|
|
1192
1191
|
? { from: position, to: position }
|
|
1193
1192
|
: position;
|
|
1194
1193
|
const minPos = prosemirrorState.TextSelection.atStart(doc).from;
|
|
1195
|
-
const maxPos = doc.
|
|
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);
|