@copilotkit/react-textarea 0.17.0 → 0.18.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/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-V54GX4SO.mjs → chunk-5GGCWNTT.mjs} +3 -3
- package/dist/{chunk-O5VWVXYD.mjs → chunk-BLRD23HM.mjs} +2 -2
- package/dist/{chunk-RKZRCIPE.mjs → chunk-LWVCQYWV.mjs} +2 -2
- package/dist/chunk-RQHOUUXQ.mjs +29 -0
- package/dist/chunk-RQHOUUXQ.mjs.map +1 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +3 -3
- package/dist/components/copilot-textarea/copilot-textarea.mjs +4 -4
- package/dist/components/index.mjs +4 -4
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
- package/dist/index.mjs +4 -4
- package/dist/lib/slatejs-edits/replace-text.mjs +1 -1
- package/package.json +1 -1
- package/src/lib/slatejs-edits/replace-text.ts +15 -31
- package/dist/chunk-KW6VCM7T.mjs +0 -40
- package/dist/chunk-KW6VCM7T.mjs.map +0 -1
- /package/dist/{chunk-V54GX4SO.mjs.map → chunk-5GGCWNTT.mjs.map} +0 -0
- /package/dist/{chunk-O5VWVXYD.mjs.map → chunk-BLRD23HM.mjs.map} +0 -0
- /package/dist/{chunk-RKZRCIPE.mjs.map → chunk-LWVCQYWV.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/react-textarea@0.
|
|
2
|
+
> @copilotkit/react-textarea@0.18.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-textarea
|
|
3
3
|
> tsup --treeshake
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx, src/components/index.ts, src/context/index.ts, src/hooks/index.ts, src/lib/debouncer.ts, src/lib/editor-to-text.ts, src/lib/get-text-around-cursor.ts, src/lib/utils.test.ts, src/lib/utils.ts, src/types/html-copilot-textarea-element.ts, src/types/index.ts, src/components/base-copilot-textarea/base-copilot-textarea.tsx, src/components/base-copilot-textarea/render-element.tsx, src/components/base-copilot-textarea/render-placeholder.tsx, src/components/base-copilot-textarea/use-add-branding-css.tsx, src/components/copilot-textarea/copilot-textarea.tsx, src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts, src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx, src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts, src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx, src/lib/slatejs-edits/add-autocompletions.ts, src/lib/slatejs-edits/clear-autocompletions.ts, src/lib/slatejs-edits/replace-text.ts, src/lib/slatejs-edits/with-partial-history.ts, src/types/base/autosuggestion-state.ts, src/types/base/autosuggestions-bare-function.ts, src/types/base/base-autosuggestions-config.tsx, src/types/base/base-copilot-textarea-props.tsx, src/types/base/custom-editor.tsx, src/types/base/editor-autocomplete-state.ts, src/types/base/index.ts, src/types/standard-autosuggestions/autosuggestions-config.tsx, src/types/standard-autosuggestions/chatlike-api-endpoint.tsx, src/types/standard-autosuggestions/index.ts, src/types/standard-autosuggestions/minimal-chat-gpt-message.tsx
|
|
@@ -59,18 +59,18 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
59
59
|
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs [22m[32m907.00 B[39m
|
|
60
60
|
[32mESM[39m [1mdist/index.mjs [22m[32m1.12 KB[39m
|
|
61
61
|
[32mESM[39m [1mdist/components/index.mjs [22m[32m888.00 B[39m
|
|
62
|
-
[32mESM[39m [1mdist/chunk-
|
|
62
|
+
[32mESM[39m [1mdist/chunk-BLRD23HM.mjs [22m[32m1.23 KB[39m
|
|
63
63
|
[32mESM[39m [1mdist/chunk-BTAUKCBN.mjs [22m[32m1.77 KB[39m
|
|
64
64
|
[32mESM[39m [1mdist/chunk-3A2CNIG5.mjs [22m[32m949.00 B[39m
|
|
65
65
|
[32mESM[39m [1mdist/chunk-JWN2VEE3.mjs [22m[32m2.72 KB[39m
|
|
66
|
-
[32mESM[39m [1mdist/chunk-
|
|
66
|
+
[32mESM[39m [1mdist/chunk-5GGCWNTT.mjs [22m[32m6.02 KB[39m
|
|
67
67
|
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs [22m[32m3.02 KB[39m
|
|
68
68
|
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs [22m[32m496.00 B[39m
|
|
69
69
|
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs [22m[32m2.01 KB[39m
|
|
70
|
-
[32mESM[39m [1mdist/chunk-
|
|
70
|
+
[32mESM[39m [1mdist/chunk-LWVCQYWV.mjs [22m[32m2.57 KB[39m
|
|
71
71
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs [22m[32m595.00 B[39m
|
|
72
72
|
[32mESM[39m [1mdist/chunk-F3MHL6ZY.mjs [22m[32m680.00 B[39m
|
|
73
|
-
[32mESM[39m [1mdist/chunk-
|
|
73
|
+
[32mESM[39m [1mdist/chunk-RQHOUUXQ.mjs [22m[32m594.00 B[39m
|
|
74
74
|
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs [22m[32m3.08 KB[39m
|
|
75
75
|
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs [22m[32m1.37 KB[39m
|
|
76
76
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs [22m[32m1.09 KB[39m
|
|
@@ -122,18 +122,18 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
122
122
|
[32mESM[39m [1mdist/components/copilot-textarea/copilot-textarea.mjs.map [22m[32m51.00 B[39m
|
|
123
123
|
[32mESM[39m [1mdist/index.mjs.map [22m[32m51.00 B[39m
|
|
124
124
|
[32mESM[39m [1mdist/components/index.mjs.map [22m[32m51.00 B[39m
|
|
125
|
-
[32mESM[39m [1mdist/chunk-
|
|
125
|
+
[32mESM[39m [1mdist/chunk-BLRD23HM.mjs.map [22m[32m2.23 KB[39m
|
|
126
126
|
[32mESM[39m [1mdist/chunk-BTAUKCBN.mjs.map [22m[32m4.42 KB[39m
|
|
127
127
|
[32mESM[39m [1mdist/chunk-3A2CNIG5.mjs.map [22m[32m2.15 KB[39m
|
|
128
128
|
[32mESM[39m [1mdist/chunk-JWN2VEE3.mjs.map [22m[32m4.06 KB[39m
|
|
129
|
-
[32mESM[39m [1mdist/chunk-
|
|
129
|
+
[32mESM[39m [1mdist/chunk-5GGCWNTT.mjs.map [22m[32m10.79 KB[39m
|
|
130
130
|
[32mESM[39m [1mdist/chunk-HZGSG7ST.mjs.map [22m[32m5.83 KB[39m
|
|
131
131
|
[32mESM[39m [1mdist/chunk-UW3ITU2Y.mjs.map [22m[32m878.00 B[39m
|
|
132
132
|
[32mESM[39m [1mdist/chunk-CSGFJU3L.mjs.map [22m[32m3.82 KB[39m
|
|
133
|
-
[32mESM[39m [1mdist/chunk-
|
|
133
|
+
[32mESM[39m [1mdist/chunk-LWVCQYWV.mjs.map [22m[32m4.80 KB[39m
|
|
134
134
|
[32mESM[39m [1mdist/chunk-WJYQWL4I.mjs.map [22m[32m1.04 KB[39m
|
|
135
135
|
[32mESM[39m [1mdist/chunk-F3MHL6ZY.mjs.map [22m[32m1.14 KB[39m
|
|
136
|
-
[32mESM[39m [1mdist/chunk-
|
|
136
|
+
[32mESM[39m [1mdist/chunk-RQHOUUXQ.mjs.map [22m[32m1.12 KB[39m
|
|
137
137
|
[32mESM[39m [1mdist/chunk-KCHYD3EB.mjs.map [22m[32m6.12 KB[39m
|
|
138
138
|
[32mESM[39m [1mdist/chunk-KGKLUWKW.mjs.map [22m[32m2.45 KB[39m
|
|
139
139
|
[32mESM[39m [1mdist/chunk-LNAIMEB2.mjs.map [22m[32m1.73 KB[39m
|
|
@@ -159,14 +159,14 @@ Generated an empty chunk: "chunk-H4VKQGVU".
|
|
|
159
159
|
[32mESM[39m [1mdist/types/standard-autosuggestions/autosuggestions-config.mjs.map [22m[32m51.00 B[39m
|
|
160
160
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map [22m[32m51.00 B[39m
|
|
161
161
|
[32mESM[39m [1mdist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map [22m[32m51.00 B[39m
|
|
162
|
-
[32mESM[39m ⚡️ Build success in
|
|
162
|
+
[32mESM[39m ⚡️ Build success in 2581ms
|
|
163
163
|
Export "AutosuggestionsConfig" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
164
164
|
Either change the import in "src/components/copilot-textarea/copilot-textarea.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
165
165
|
Export "ChatlikeApiEndpoint" of module "src/types/standard-autosuggestions/chatlike-api-endpoint.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
166
166
|
Either change the import in "src/components/copilot-textarea/copilot-textarea.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
167
167
|
Export "MakeSystemPrompt" of module "src/types/standard-autosuggestions/autosuggestions-config.tsx" was reexported through module "src/types/standard-autosuggestions/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
|
|
168
168
|
Either change the import in "src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx" to point directly to the exporting module or do not use "preserveModules" to ensure these modules end up in the same chunk.
|
|
169
|
-
[32mDTS[39m ⚡️ Build success in
|
|
169
|
+
[32mDTS[39m ⚡️ Build success in 4989ms
|
|
170
170
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.01 KB[39m
|
|
171
171
|
[32mDTS[39m [1mdist/components/base-copilot-textarea/base-copilot-textarea.d.ts [22m[32m669.00 B[39m
|
|
172
172
|
[32mDTS[39m [1mdist/components/copilot-textarea/copilot-textarea.d.ts [22m[32m948.00 B[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useAutosuggestions } from './chunk-HZGSG7ST.mjs';
|
|
2
2
|
import { useCopilotTextareaEditor } from './chunk-CSGFJU3L.mjs';
|
|
3
|
-
import { usePopulateCopilotTextareaRef } from './chunk-
|
|
3
|
+
import { usePopulateCopilotTextareaRef } from './chunk-LWVCQYWV.mjs';
|
|
4
4
|
import { addAutocompletionsToEditor } from './chunk-WJYQWL4I.mjs';
|
|
5
5
|
import { clearAutocompletionsFromEditor } from './chunk-F3MHL6ZY.mjs';
|
|
6
|
-
import { replaceEditorText } from './chunk-
|
|
6
|
+
import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
|
|
7
7
|
import { defaultBaseAutosuggestionsConfig } from './chunk-MFJNLKRC.mjs';
|
|
8
8
|
import { makeRenderElementFunction } from './chunk-LNAIMEB2.mjs';
|
|
9
9
|
import { makeRenderPlaceholderFunction } from './chunk-OELUUJZY.mjs';
|
|
@@ -160,4 +160,4 @@ function makeSemiFakeReactTextAreaEvent(currentText) {
|
|
|
160
160
|
|
|
161
161
|
export { BaseCopilotTextarea };
|
|
162
162
|
//# sourceMappingURL=out.js.map
|
|
163
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-5GGCWNTT.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMakeStandardAutosuggestionFunction } from './chunk-BTAUKCBN.mjs';
|
|
2
2
|
import { defaultAutosuggestionsConfig } from './chunk-JWN2VEE3.mjs';
|
|
3
|
-
import { BaseCopilotTextarea } from './chunk-
|
|
3
|
+
import { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
|
|
4
4
|
import { __spreadValues, __spreadProps } from './chunk-MRXNTQOX.mjs';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -29,4 +29,4 @@ var CopilotTextarea = React.forwardRef(
|
|
|
29
29
|
|
|
30
30
|
export { CopilotTextarea };
|
|
31
31
|
//# sourceMappingURL=out.js.map
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-BLRD23HM.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { replaceEditorText } from './chunk-
|
|
1
|
+
import { replaceEditorText } from './chunk-RQHOUUXQ.mjs';
|
|
2
2
|
import { getFullEditorTextWithNewlines } from './chunk-3UQM3NLM.mjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ReactEditor } from 'slate-react';
|
|
@@ -80,4 +80,4 @@ function usePopulateCopilotTextareaRef(editor, ref) {
|
|
|
80
80
|
|
|
81
81
|
export { usePopulateCopilotTextareaRef };
|
|
82
82
|
//# sourceMappingURL=out.js.map
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-LWVCQYWV.mjs.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Transforms, Editor } from 'slate';
|
|
2
|
+
|
|
3
|
+
// src/lib/slatejs-edits/replace-text.ts
|
|
4
|
+
function replaceEditorText(editor, newText) {
|
|
5
|
+
Transforms.delete(editor, {
|
|
6
|
+
at: {
|
|
7
|
+
anchor: Editor.start(editor, []),
|
|
8
|
+
focus: Editor.end(editor, [])
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
if (newText && newText !== "") {
|
|
12
|
+
Transforms.insertNodes(
|
|
13
|
+
editor,
|
|
14
|
+
[
|
|
15
|
+
{
|
|
16
|
+
type: "paragraph",
|
|
17
|
+
children: [{ text: newText }]
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
at: [0]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { replaceEditorText };
|
|
28
|
+
//# sourceMappingURL=out.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-RQHOUUXQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,kBAAkB;AAE5B,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,aAAW,OAAO,QAAQ;AAAA,IACxB,IAAI;AAAA,MACF,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,MAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,IAC9B;AAAA,EACF,CAAC;AAGD,MAAI,WAAW,YAAY,IAAI;AAE7B,eAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,QAC9B;AAAA,MACF;AAAA,MACA;AAAA,QACE,IAAI,CAAC,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { Editor, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n Transforms.delete(editor, {\n at: {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n },\n });\n\n // insert new text\n if (newText && newText !== \"\") {\n // don't insert empty text - results in strange visual behavior\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { BaseCopilotTextarea } from '../../chunk-
|
|
1
|
+
export { BaseCopilotTextarea } from '../../chunk-5GGCWNTT.mjs';
|
|
2
2
|
import '../../chunk-HZGSG7ST.mjs';
|
|
3
3
|
import '../../chunk-UW3ITU2Y.mjs';
|
|
4
4
|
import '../../chunk-CSGFJU3L.mjs';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-LWVCQYWV.mjs';
|
|
6
6
|
import '../../chunk-WJYQWL4I.mjs';
|
|
7
7
|
import '../../chunk-F3MHL6ZY.mjs';
|
|
8
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
9
9
|
import '../../chunk-KCHYD3EB.mjs';
|
|
10
10
|
import '../../chunk-KGKLUWKW.mjs';
|
|
11
11
|
import '../../chunk-WJHSY5T6.mjs';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { CopilotTextarea } from '../../chunk-
|
|
1
|
+
export { CopilotTextarea } from '../../chunk-BLRD23HM.mjs';
|
|
2
2
|
import '../../chunk-BTAUKCBN.mjs';
|
|
3
3
|
import '../../chunk-SL4J5HMW.mjs';
|
|
4
4
|
import '../../chunk-3A2CNIG5.mjs';
|
|
5
5
|
import '../../chunk-JWN2VEE3.mjs';
|
|
6
|
-
import '../../chunk-
|
|
6
|
+
import '../../chunk-5GGCWNTT.mjs';
|
|
7
7
|
import '../../chunk-HZGSG7ST.mjs';
|
|
8
8
|
import '../../chunk-UW3ITU2Y.mjs';
|
|
9
9
|
import '../../chunk-CSGFJU3L.mjs';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-LWVCQYWV.mjs';
|
|
11
11
|
import '../../chunk-WJYQWL4I.mjs';
|
|
12
12
|
import '../../chunk-F3MHL6ZY.mjs';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
14
14
|
import '../../chunk-KCHYD3EB.mjs';
|
|
15
15
|
import '../../chunk-KGKLUWKW.mjs';
|
|
16
16
|
import '../../chunk-WJHSY5T6.mjs';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import '../chunk-MMVDU6DF.mjs';
|
|
2
|
-
export { CopilotTextarea } from '../chunk-
|
|
2
|
+
export { CopilotTextarea } from '../chunk-BLRD23HM.mjs';
|
|
3
3
|
import '../chunk-BTAUKCBN.mjs';
|
|
4
4
|
import '../chunk-SL4J5HMW.mjs';
|
|
5
5
|
import '../chunk-3A2CNIG5.mjs';
|
|
6
6
|
import '../chunk-JWN2VEE3.mjs';
|
|
7
|
-
export { BaseCopilotTextarea } from '../chunk-
|
|
7
|
+
export { BaseCopilotTextarea } from '../chunk-5GGCWNTT.mjs';
|
|
8
8
|
import '../chunk-HZGSG7ST.mjs';
|
|
9
9
|
import '../chunk-UW3ITU2Y.mjs';
|
|
10
10
|
import '../chunk-CSGFJU3L.mjs';
|
|
11
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-LWVCQYWV.mjs';
|
|
12
12
|
import '../chunk-WJYQWL4I.mjs';
|
|
13
13
|
import '../chunk-F3MHL6ZY.mjs';
|
|
14
|
-
import '../chunk-
|
|
14
|
+
import '../chunk-RQHOUUXQ.mjs';
|
|
15
15
|
import '../chunk-KCHYD3EB.mjs';
|
|
16
16
|
import '../chunk-KGKLUWKW.mjs';
|
|
17
17
|
import '../chunk-WJHSY5T6.mjs';
|
package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { usePopulateCopilotTextareaRef } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { usePopulateCopilotTextareaRef } from '../../chunk-LWVCQYWV.mjs';
|
|
2
|
+
import '../../chunk-RQHOUUXQ.mjs';
|
|
3
3
|
import '../../chunk-3UQM3NLM.mjs';
|
|
4
4
|
import '../../chunk-MRXNTQOX.mjs';
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import './chunk-DE5K76I2.mjs';
|
|
2
2
|
import './chunk-WADHCMPK.mjs';
|
|
3
3
|
import './chunk-MMVDU6DF.mjs';
|
|
4
|
-
export { CopilotTextarea } from './chunk-
|
|
4
|
+
export { CopilotTextarea } from './chunk-BLRD23HM.mjs';
|
|
5
5
|
import './chunk-BTAUKCBN.mjs';
|
|
6
6
|
import './chunk-SL4J5HMW.mjs';
|
|
7
7
|
export { ChatlikeApiEndpoint } from './chunk-3A2CNIG5.mjs';
|
|
8
8
|
export { defaultAutosuggestionsConfig, defaultFewShotMessages, defaultMakeSystemPrompt } from './chunk-JWN2VEE3.mjs';
|
|
9
|
-
export { BaseCopilotTextarea } from './chunk-
|
|
9
|
+
export { BaseCopilotTextarea } from './chunk-5GGCWNTT.mjs';
|
|
10
10
|
import './chunk-HZGSG7ST.mjs';
|
|
11
11
|
import './chunk-UW3ITU2Y.mjs';
|
|
12
12
|
import './chunk-CSGFJU3L.mjs';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-LWVCQYWV.mjs';
|
|
14
14
|
import './chunk-WJYQWL4I.mjs';
|
|
15
15
|
import './chunk-F3MHL6ZY.mjs';
|
|
16
|
-
import './chunk-
|
|
16
|
+
import './chunk-RQHOUUXQ.mjs';
|
|
17
17
|
import './chunk-KCHYD3EB.mjs';
|
|
18
18
|
import './chunk-KGKLUWKW.mjs';
|
|
19
19
|
import './chunk-WJHSY5T6.mjs';
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor,
|
|
1
|
+
import { Editor, Transforms } from "slate";
|
|
2
2
|
|
|
3
3
|
export function replaceEditorText(editor: Editor, newText: string) {
|
|
4
4
|
// clear all previous text
|
|
@@ -9,36 +9,20 @@ export function replaceEditorText(editor: Editor, newText: string) {
|
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
// try again (this is the original implementation; we found a seemingly better one above but doesn't hurt to do both)
|
|
13
|
-
const paths: Path[] = [];
|
|
14
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
15
|
-
if (
|
|
16
|
-
Element.isElement(node) &&
|
|
17
|
-
(node.type === "paragraph" || node.type === "suggestion") &&
|
|
18
|
-
path.length === 1
|
|
19
|
-
) {
|
|
20
|
-
paths.push(path);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
for (const path of paths) {
|
|
24
|
-
try {
|
|
25
|
-
Transforms.removeNodes(editor, { at: path });
|
|
26
|
-
} catch (e) {
|
|
27
|
-
console.log("CopilotTextarea.replaceEditorText: error removing node", e);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
12
|
// insert new text
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
if (newText && newText !== "") {
|
|
14
|
+
// don't insert empty text - results in strange visual behavior
|
|
15
|
+
Transforms.insertNodes(
|
|
16
|
+
editor,
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
children: [{ text: newText }],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
35
23
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
at: [0],
|
|
42
|
-
}
|
|
43
|
-
);
|
|
24
|
+
at: [0],
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
44
28
|
}
|
package/dist/chunk-KW6VCM7T.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Transforms, Editor, Node, Element } from 'slate';
|
|
2
|
-
|
|
3
|
-
// src/lib/slatejs-edits/replace-text.ts
|
|
4
|
-
function replaceEditorText(editor, newText) {
|
|
5
|
-
Transforms.delete(editor, {
|
|
6
|
-
at: {
|
|
7
|
-
anchor: Editor.start(editor, []),
|
|
8
|
-
focus: Editor.end(editor, [])
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const paths = [];
|
|
12
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
13
|
-
if (Element.isElement(node) && (node.type === "paragraph" || node.type === "suggestion") && path.length === 1) {
|
|
14
|
-
paths.push(path);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
for (const path of paths) {
|
|
18
|
-
try {
|
|
19
|
-
Transforms.removeNodes(editor, { at: path });
|
|
20
|
-
} catch (e) {
|
|
21
|
-
console.log("CopilotTextarea.replaceEditorText: error removing node", e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
Transforms.insertNodes(
|
|
25
|
-
editor,
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
type: "paragraph",
|
|
29
|
-
children: [{ text: newText }]
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
{
|
|
33
|
-
at: [0]
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { replaceEditorText };
|
|
39
|
-
//# sourceMappingURL=out.js.map
|
|
40
|
-
//# sourceMappingURL=chunk-KW6VCM7T.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/slatejs-edits/replace-text.ts"],"names":[],"mappings":";AAAA,SAAS,QAAQ,SAAS,MAAY,kBAAkB;AAEjD,SAAS,kBAAkB,QAAgB,SAAiB;AAEjE,aAAW,OAAO,QAAQ;AAAA,IACxB,IAAI;AAAA,MACF,QAAQ,OAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,MAC/B,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,IAC9B;AAAA,EACF,CAAC;AAGD,QAAM,QAAgB,CAAC;AACvB,aAAW,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM,MAAM,GAAG;AAC7C,QACE,QAAQ,UAAU,IAAI,MACrB,KAAK,SAAS,eAAe,KAAK,SAAS,iBAC5C,KAAK,WAAW,GAChB;AACA,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAK,CAAC;AAAA,IAC7C,SAAS,GAAP;AACA,cAAQ,IAAI,0DAA0D,CAAC;AAAA,IACzE;AAAA,EACF;AAGA,aAAW;AAAA,IACT;AAAA,IACA;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,QAAQ,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,IACA;AAAA,MACE,IAAI,CAAC,CAAC;AAAA,IACR;AAAA,EACF;AACF","sourcesContent":["import { Editor, Element, Node, Path, Transforms } from \"slate\";\n\nexport function replaceEditorText(editor: Editor, newText: string) {\n // clear all previous text\n Transforms.delete(editor, {\n at: {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n },\n });\n\n // try again (this is the original implementation; we found a seemingly better one above but doesn't hurt to do both)\n const paths: Path[] = [];\n for (const [node, path] of Node.nodes(editor)) {\n if (\n Element.isElement(node) &&\n (node.type === \"paragraph\" || node.type === \"suggestion\") &&\n path.length === 1\n ) {\n paths.push(path);\n }\n }\n for (const path of paths) {\n try {\n Transforms.removeNodes(editor, { at: path });\n } catch (e) {\n console.log(\"CopilotTextarea.replaceEditorText: error removing node\", e);\n }\n }\n\n // insert new text\n Transforms.insertNodes(\n editor,\n [\n {\n type: \"paragraph\",\n children: [{ text: newText }],\n },\n ],\n {\n at: [0],\n }\n );\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|