@codemirror/view 6.11.0 → 6.11.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.11.1 (2023-05-09)
2
+
3
+ ### Bug fixes
4
+
5
+ Don't preserve the DOM around a composition that spans multiple lines.
1
6
  ## 6.11.0 (2023-05-03)
2
7
 
3
8
  ### New features
package/dist/index.cjs CHANGED
@@ -3019,15 +3019,17 @@ function computeCompositionDeco(view, changes) {
3019
3019
  let newFrom = changes.mapPos(from, 1), newTo = Math.max(newFrom, changes.mapPos(to, -1));
3020
3020
  let { state } = view, text = node.nodeType == 3 ? node.nodeValue :
3021
3021
  new DOMReader([], state).readRange(node.firstChild, null).text;
3022
+ if (text.indexOf(LineBreakPlaceholder) > -1)
3023
+ return Decoration.none; // Don't try to preserve multi-line compositions
3022
3024
  if (newTo - newFrom < text.length) {
3023
- if (state.doc.sliceString(newFrom, Math.min(state.doc.length, newFrom + text.length), LineBreakPlaceholder) == text)
3025
+ if (state.doc.sliceString(newFrom, Math.min(state.doc.length, newFrom + text.length)) == text)
3024
3026
  newTo = newFrom + text.length;
3025
- else if (state.doc.sliceString(Math.max(0, newTo - text.length), newTo, LineBreakPlaceholder) == text)
3027
+ else if (state.doc.sliceString(Math.max(0, newTo - text.length), newTo) == text)
3026
3028
  newFrom = newTo - text.length;
3027
3029
  else
3028
3030
  return Decoration.none;
3029
3031
  }
3030
- else if (state.doc.sliceString(newFrom, newTo, LineBreakPlaceholder) != text) {
3032
+ else if (state.doc.sliceString(newFrom, newTo) != text) {
3031
3033
  return Decoration.none;
3032
3034
  }
3033
3035
  let topView = ContentView.get(node);
package/dist/index.js CHANGED
@@ -3013,15 +3013,17 @@ function computeCompositionDeco(view, changes) {
3013
3013
  let newFrom = changes.mapPos(from, 1), newTo = Math.max(newFrom, changes.mapPos(to, -1));
3014
3014
  let { state } = view, text = node.nodeType == 3 ? node.nodeValue :
3015
3015
  new DOMReader([], state).readRange(node.firstChild, null).text;
3016
+ if (text.indexOf(LineBreakPlaceholder) > -1)
3017
+ return Decoration.none; // Don't try to preserve multi-line compositions
3016
3018
  if (newTo - newFrom < text.length) {
3017
- if (state.doc.sliceString(newFrom, Math.min(state.doc.length, newFrom + text.length), LineBreakPlaceholder) == text)
3019
+ if (state.doc.sliceString(newFrom, Math.min(state.doc.length, newFrom + text.length)) == text)
3018
3020
  newTo = newFrom + text.length;
3019
- else if (state.doc.sliceString(Math.max(0, newTo - text.length), newTo, LineBreakPlaceholder) == text)
3021
+ else if (state.doc.sliceString(Math.max(0, newTo - text.length), newTo) == text)
3020
3022
  newFrom = newTo - text.length;
3021
3023
  else
3022
3024
  return Decoration.none;
3023
3025
  }
3024
- else if (state.doc.sliceString(newFrom, newTo, LineBreakPlaceholder) != text) {
3026
+ else if (state.doc.sliceString(newFrom, newTo) != text) {
3025
3027
  return Decoration.none;
3026
3028
  }
3027
3029
  let topView = ContentView.get(node);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.11.0",
3
+ "version": "6.11.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",