@copilotkit/react-textarea 1.80.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.cjs CHANGED
@@ -372,10 +372,7 @@ function replaceEditorText(editor, newText) {
372
372
  anchor: slate.Editor.start(editor, []),
373
373
  focus: slate.Editor.end(editor, [])
374
374
  } });
375
- if (newText && newText !== "") slate.Transforms.insertNodes(editor, [{
376
- type: "paragraph",
377
- children: [{ text: newText }]
378
- }], { at: [0] });
375
+ if (newText && newText !== "") slate.Transforms.insertText(editor, newText, { at: slate.Editor.start(editor, []) });
379
376
  }
380
377
 
381
378
  //#endregion
@@ -1205,7 +1202,7 @@ function nodeChildrenToTextComponents(editor, nodes) {
1205
1202
  }).reduce((acc, val) => acc.concat(val), []);
1206
1203
  }
1207
1204
  const editorToText = (editor) => {
1208
- return nodeChildrenToTextComponents(editor, editor.children).map((textComponent) => textComponent.text).join("\n");
1205
+ return editor.children.map((node) => nodeChildrenToTextComponents(editor, [node]).map((textComponent) => textComponent.text).join("")).join("\n");
1209
1206
  };
1210
1207
 
1211
1208
  //#endregion