From ec388c285598eb706fc9fbbabc035ad63de27ba6 Mon Sep 17 00:00:00 2001 From: righ Date: Sun, 18 Aug 2024 01:49:28 +0900 Subject: [PATCH] chore: rename --- src/components/Editor.tsx | 8 ++++---- src/components/FormulaBar.tsx | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx index 1aeea249..1357c37c 100644 --- a/src/components/Editor.tsx +++ b/src/components/Editor.tsx @@ -74,7 +74,7 @@ export const Editor: React.FC = () => { const rowId = `${y2r(y)}`; const colId = x2c(x); const address = `${colId}${rowId}`; - const [origin, setOrigin] = React.useState(''); + const [before, setBefore] = React.useState(''); const editing = editingCell === address; const cell = table.getByPoint({ y, x }); @@ -82,7 +82,7 @@ export const Editor: React.FC = () => { const { y: top, x: left, height, width } = editorRect; const writeCell = (value: string) => { - if (origin !== value) { + if (before !== value) { dispatch(write(value)); } //setBefore(''); @@ -398,7 +398,7 @@ export const Editor: React.FC = () => { const input = e.currentTarget; if (!editing) { input.value = table.stringify({ y, x }, value); - setOrigin(input.value); + setBefore(input.value); dispatch(setEditingCell(address)); input.style.width = `${width}px`; input.style.height = `${height}px`; @@ -411,7 +411,7 @@ export const Editor: React.FC = () => { } }} onBlur={(e) => { - dispatch(setLastEdited(origin)); + dispatch(setLastEdited(before)); if (e.target.value.startsWith('=')) { return true; } else { diff --git a/src/components/FormulaBar.tsx b/src/components/FormulaBar.tsx index b2a2002d..ad9aab11 100644 --- a/src/components/FormulaBar.tsx +++ b/src/components/FormulaBar.tsx @@ -12,7 +12,7 @@ type Props = { export const FormulaBar: React.FC = ({ width }) => { const { store, dispatch } = React.useContext(Context); - const [origin, setOrigin] = React.useState(''); + const [before, setBefore] = React.useState(''); const { choosing, editorRef, largeEditorRef, table } = store; const [, sheetContext] = useSheetContext(); @@ -23,11 +23,11 @@ export const FormulaBar: React.FC = ({ width }) => { // debug to remove this line value = table.stringify(choosing, value); largeEditorRef.current!.value = value; - setOrigin(value as string); + setBefore(value as string); }, [address, table]); const writeCell = (value: string) => { - if (origin !== value) { + if (before !== value) { dispatch(write(value)); } dispatch(setEditingCell('')); @@ -63,7 +63,7 @@ export const FormulaBar: React.FC = ({ width }) => { onFocus={sync} onChange={sync} onBlur={(e) => { - dispatch(setLastEdited(origin)); + dispatch(setLastEdited(before)); if (e.target.value.startsWith('=')) { return true; } else { @@ -94,7 +94,7 @@ export const FormulaBar: React.FC = ({ width }) => { break; } case 'Escape': { - input.value = origin; + input.value = before; dispatch(setEditingCell('')); e.preventDefault(); editorRef.current!.focus();