@codemirror/view 6.28.0 → 6.28.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,11 @@
1
+ ## 6.28.1 (2024-06-12)
2
+
3
+ ### Bug fixes
4
+
5
+ Disable `EditContext` by default again, to work around a regression where Chrome's implementation doesn't support inverted selections.
6
+
7
+ Make sure `EditorView.editable` is respected when `EditContext` is used.
8
+
1
9
  ## 6.28.0 (2024-06-10)
2
10
 
3
11
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -6639,9 +6639,10 @@ class DOMObserver {
6639
6639
  else
6640
6640
  this.flush();
6641
6641
  });
6642
- if (window.EditContext && view.constructor.EDIT_CONTEXT !== false) {
6642
+ if (window.EditContext && view.constructor.EDIT_CONTEXT === true) {
6643
6643
  this.editContext = new EditContextManager(view);
6644
- view.contentDOM.editContext = this.editContext.editContext;
6644
+ if (view.state.facet(editable))
6645
+ view.contentDOM.editContext = this.editContext.editContext;
6645
6646
  }
6646
6647
  if (useCharData)
6647
6648
  this.onCharData = (event) => {
@@ -7005,8 +7006,11 @@ class DOMObserver {
7005
7006
  win.document.removeEventListener("selectionchange", this.onSelectionChange);
7006
7007
  }
7007
7008
  update(update) {
7008
- if (this.editContext)
7009
+ if (this.editContext) {
7009
7010
  this.editContext.update(update);
7011
+ if (update.startState.facet(editable) != update.state.facet(editable))
7012
+ update.view.contentDOM.editContext = update.state.facet(editable) ? this.editContext.editContext : null;
7013
+ }
7010
7014
  }
7011
7015
  destroy() {
7012
7016
  var _a, _b, _c;
package/dist/index.js CHANGED
@@ -6634,9 +6634,10 @@ class DOMObserver {
6634
6634
  else
6635
6635
  this.flush();
6636
6636
  });
6637
- if (window.EditContext && view.constructor.EDIT_CONTEXT !== false) {
6637
+ if (window.EditContext && view.constructor.EDIT_CONTEXT === true) {
6638
6638
  this.editContext = new EditContextManager(view);
6639
- view.contentDOM.editContext = this.editContext.editContext;
6639
+ if (view.state.facet(editable))
6640
+ view.contentDOM.editContext = this.editContext.editContext;
6640
6641
  }
6641
6642
  if (useCharData)
6642
6643
  this.onCharData = (event) => {
@@ -7000,8 +7001,11 @@ class DOMObserver {
7000
7001
  win.document.removeEventListener("selectionchange", this.onSelectionChange);
7001
7002
  }
7002
7003
  update(update) {
7003
- if (this.editContext)
7004
+ if (this.editContext) {
7004
7005
  this.editContext.update(update);
7006
+ if (update.startState.facet(editable) != update.state.facet(editable))
7007
+ update.view.contentDOM.editContext = update.state.facet(editable) ? this.editContext.editContext : null;
7008
+ }
7005
7009
  }
7006
7010
  destroy() {
7007
7011
  var _a, _b, _c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.28.0",
3
+ "version": "6.28.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",