Skip to content

Commit eb6b975

Browse files
committed
fix: update selectionStart on change for formula autocompletion in Preact
1 parent 140c042 commit eb6b975

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/react-core/src/components/Editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ export const Editor: FC<Props> = ({ mode }: Props) => {
648648
return;
649649
}
650650
dispatch(setInputting(e.currentTarget.value));
651+
setSelectionStart(e.currentTarget.selectionStart);
651652
setSelected(0);
652653
},
653654
[cell],

packages/react-core/src/components/FormulaBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const FormulaBar = ({ ready }: FormulaBarProps) => {
9898

9999
const handleInput = useCallback((e: React.SyntheticEvent<HTMLTextAreaElement>) => {
100100
dispatch(setInputting(e.currentTarget.value));
101+
setSelectionStart(e.currentTarget.selectionStart);
101102
}, []);
102103

103104
const handleSelect = useCallback((e: React.SyntheticEvent<HTMLTextAreaElement>) => {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {}
5+
}
6+
}

packages/react-core/vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react";
33
import dts from "vite-plugin-dts";
44

55
export default defineConfig(() => ({
6-
plugins: [react(), dts({ insertTypesEntry: true, exclude: ['**/*.spec.ts', '**/*.spec.tsx'] })],
6+
plugins: [react(), dts({ insertTypesEntry: true, exclude: ['**/*.spec.ts', '**/*.spec.tsx'], tsconfigPath: './tsconfig.build.json' })],
77
build: {
88
lib: {
99
entry: {

0 commit comments

Comments
 (0)