@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.cjs +2 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -5
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/lib/editor-to-text.test.ts +60 -0
- package/src/lib/editor-to-text.ts +17 -9
- package/src/lib/slatejs-edits/replace-text.test.ts +56 -0
- package/src/lib/slatejs-edits/replace-text.ts +8 -13
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.
|
|
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,
|
|
1172
|
+
return editor.children.map((node) => nodeChildrenToTextComponents(editor, [node]).map((textComponent) => textComponent.text).join("")).join("\n");
|
|
1176
1173
|
};
|
|
1177
1174
|
|
|
1178
1175
|
//#endregion
|