prosemirror-view 1.23.7 → 1.23.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.23.7",
3
+ "version": "1.23.8",
4
4
  "description": "ProseMirror's view component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
package/src/domchange.js CHANGED
@@ -93,6 +93,7 @@ export function readDOMChange(view, from, to, typeOver, addedNodes) {
93
93
 
94
94
  let sel = view.state.selection
95
95
  let parse = parseBetween(view, from, to)
96
+
96
97
  // Chrome sometimes leaves the cursor before the inserted text when
97
98
  // composing after a cursor wrapper. This moves it forward.
98
99
  if (browser.chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from) {
@@ -138,9 +139,11 @@ export function readDOMChange(view, from, to, typeOver, addedNodes) {
138
139
  if (view.state.selection.from < view.state.selection.to &&
139
140
  change.start == change.endB &&
140
141
  view.state.selection instanceof TextSelection) {
141
- if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2) {
142
+ if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&
143
+ view.state.selection.from >= parse.from) {
142
144
  change.start = view.state.selection.from
143
- } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2) {
145
+ } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&
146
+ view.state.selection.to <= parse.to) {
144
147
  change.endB += (view.state.selection.to - change.endA)
145
148
  change.endA = view.state.selection.to
146
149
  }
package/src/viewdesc.js CHANGED
@@ -1426,10 +1426,13 @@ function findTextInFragment(frag, text, from, to) {
1426
1426
  if (!next.isText) break
1427
1427
  str += next.text
1428
1428
  }
1429
- if (pos >= from && childStart < to) {
1430
- let found = str.lastIndexOf(text, to - childStart - 1)
1429
+ if (pos >= from) {
1430
+ let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1
1431
1431
  if (found >= 0 && found + text.length + childStart >= from)
1432
1432
  return childStart + found
1433
+ if (from == to && str.length >= (to + text.length) - childStart &&
1434
+ str.slice(to - childStart, to - childStart + text.length) == text)
1435
+ return to
1433
1436
  }
1434
1437
  }
1435
1438
  return -1