@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.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.
|
|
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,
|
|
1205
|
+
return editor.children.map((node) => nodeChildrenToTextComponents(editor, [node]).map((textComponent) => textComponent.text).join("")).join("\n");
|
|
1209
1206
|
};
|
|
1210
1207
|
|
|
1211
1208
|
//#endregion
|