@copilotkit/react-textarea 1.81.0 → 1.82.0

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/dist/index.mjs CHANGED
@@ -339,10 +339,7 @@ function replaceEditorText(editor, newText) {
339
339
  anchor: Editor.start(editor, []),
340
340
  focus: Editor.end(editor, [])
341
341
  } });
342
- if (newText && newText !== "") Transforms.insertNodes(editor, [{
343
- type: "paragraph",
344
- children: [{ text: newText }]
345
- }], { at: [0] });
342
+ if (newText && newText !== "") Transforms.insertText(editor, newText, { at: Editor.start(editor, []) });
346
343
  }
347
344
 
348
345
  //#endregion
@@ -1172,7 +1169,7 @@ function nodeChildrenToTextComponents(editor, nodes) {
1172
1169
  }).reduce((acc, val) => acc.concat(val), []);
1173
1170
  }
1174
1171
  const editorToText = (editor) => {
1175
- return nodeChildrenToTextComponents(editor, editor.children).map((textComponent) => textComponent.text).join("\n");
1172
+ return editor.children.map((node) => nodeChildrenToTextComponents(editor, [node]).map((textComponent) => textComponent.text).join("")).join("\n");
1176
1173
  };
1177
1174
 
1178
1175
  //#endregion