mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: save url cell
This commit is contained in:
@ -10,34 +10,22 @@ export const EditCellUrl = ({
|
|||||||
data: URLCellDataPB | undefined;
|
data: URLCellDataPB | undefined;
|
||||||
cellController: CellController<any, any>;
|
cellController: CellController<any, any>;
|
||||||
}) => {
|
}) => {
|
||||||
const [url, setUrl] = useState('');
|
const [value, setValue] = useState('');
|
||||||
const [content, setContent] = useState('');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setUrl((data as URLCellDataPB)?.url || '');
|
setValue((data as URLCellDataPB)?.url || '');
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
await (cellController as URLCellController)?.saveCellData(url);
|
await (cellController as URLCellController)?.saveCellData(value);
|
||||||
// console.log('saving url');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'flex flex-col px-4 py-2'}>
|
<input
|
||||||
<label className={'mb-1'}>URL:</label>
|
value={value}
|
||||||
<input
|
onChange={(e) => setValue(e.target.value)}
|
||||||
value={url}
|
onBlur={() => save()}
|
||||||
onChange={(e) => setUrl(e.target.value)}
|
className={'w-full px-4 py-2'}
|
||||||
className={'-mx-2 mb-4 rounded bg-white px-2 py-1'}
|
></input>
|
||||||
onBlur={() => save()}
|
|
||||||
/>
|
|
||||||
<label className={'mb-1'}>Content:</label>
|
|
||||||
<input
|
|
||||||
value={content}
|
|
||||||
onChange={(e) => setContent(e.target.value)}
|
|
||||||
className={'-mx-2 mb-2 rounded bg-white px-2 py-1'}
|
|
||||||
onBlur={() => save()}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user