@codemirror/state 6.5.1 → 6.5.2

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,9 @@
1
+ ## 6.5.2 (2025-02-03)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug where reconfiguring a field with a new `init` value didn't update the value of the field.
6
+
1
7
  ## 6.5.1 (2025-01-10)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1777,6 +1777,11 @@ class StateField {
1777
1777
  return 1 /* SlotStatus.Changed */;
1778
1778
  },
1779
1779
  reconfigure: (state, oldState) => {
1780
+ let init = state.facet(initField), oldInit = oldState.facet(initField), reInit;
1781
+ if ((reInit = init.find(i => i.field == this)) && reInit != oldInit.find(i => i.field == this)) {
1782
+ state.values[idx] = reInit.create(state);
1783
+ return 1 /* SlotStatus.Changed */;
1784
+ }
1780
1785
  if (oldState.config.address[this.id] != null) {
1781
1786
  state.values[idx] = oldState.field(this);
1782
1787
  return 0;
package/dist/index.js CHANGED
@@ -1774,6 +1774,11 @@ class StateField {
1774
1774
  return 1 /* SlotStatus.Changed */;
1775
1775
  },
1776
1776
  reconfigure: (state, oldState) => {
1777
+ let init = state.facet(initField), oldInit = oldState.facet(initField), reInit;
1778
+ if ((reInit = init.find(i => i.field == this)) && reInit != oldInit.find(i => i.field == this)) {
1779
+ state.values[idx] = reInit.create(state);
1780
+ return 1 /* SlotStatus.Changed */;
1781
+ }
1777
1782
  if (oldState.config.address[this.id] != null) {
1778
1783
  state.values[idx] = oldState.field(this);
1779
1784
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/state",
3
- "version": "6.5.1",
3
+ "version": "6.5.2",
4
4
  "description": "Editor state data structures for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",