@lexion-rte/react 0.1.6 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @lexion-rte/react
2
2
 
3
+ ## 0.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Preserve undo history when a controlled editor value is synced back into the adapter without any actual document change. This also keeps the rendered editor state and status bar aligned when React, Vue, or the web adapter receives the current document again.
8
+
9
+ ## 0.1.7
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @lexion-rte/starter-kit@0.2.2
15
+
3
16
  ## 0.1.6
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexion-rte/react",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "React adapter for the Lexion editor platform.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "prosemirror-view": "^1.37.2",
38
- "@lexion-rte/starter-kit": "0.2.1",
39
- "@lexion-rte/core": "0.1.5"
38
+ "@lexion-rte/core": "0.1.5",
39
+ "@lexion-rte/starter-kit": "0.2.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.2.0 || ^19.0.0",
@@ -81,8 +81,11 @@ export const LexionEditorView = ({
81
81
  }
82
82
 
83
83
  if (isControlled && value !== undefined) {
84
- activeEditor.setJSON(value);
85
- lastAppliedValueRef.current = serializeJSON(value);
84
+ const nextValue = serializeJSON(value);
85
+ if (nextValue !== serializeJSON(activeEditor.getJSON())) {
86
+ activeEditor.setJSON(value);
87
+ }
88
+ lastAppliedValueRef.current = nextValue;
86
89
  }
87
90
 
88
91
  const view = new EditorView(containerRef.current, {
@@ -125,7 +128,10 @@ export const LexionEditorView = ({
125
128
  }
126
129
 
127
130
  const nextValue = serializeJSON(value);
128
- if (nextValue === lastAppliedValueRef.current) {
131
+ if (nextValue === lastAppliedValueRef.current || nextValue === serializeJSON(activeEditor.getJSON())) {
132
+ lastAppliedValueRef.current = nextValue;
133
+ viewRef.current?.updateState(activeEditor.state);
134
+ setStatusBarItems(activeEditor.getStatusBarItems());
129
135
  return;
130
136
  }
131
137