chore: update button elements

This commit is contained in:
boojack
2022-07-10 12:02:36 +08:00
parent 46d7ecca88
commit 2e126c71f0
6 changed files with 24 additions and 22 deletions

View File

@ -127,15 +127,14 @@ const MemoEditor: React.FC<Props> = () => {
[state]
);
const handleSaveBtnClick = useCallback(async (content: string) => {
const handleSaveBtnClick = async (content: string) => {
if (content === "") {
toastHelper.error("Content can't be empty");
return;
}
const { editMemoId } = editorStateService.getState();
try {
const { editMemoId } = editorStateService.getState();
if (editMemoId && editMemoId !== UNKNOWN_ID) {
const prevMemo = memoService.getMemoById(editMemoId ?? UNKNOWN_ID);
@ -156,8 +155,12 @@ const MemoEditor: React.FC<Props> = () => {
toastHelper.error(error.message);
}
setState({
...state,
fullscreen: false,
});
setEditorContentCache("");
}, []);
};
const handleCancelBtnClick = useCallback(() => {
editorStateService.clearEditMemo();
@ -235,10 +238,10 @@ const MemoEditor: React.FC<Props> = () => {
})}
</div>
</div>
<div className="action-btn">
<button className="action-btn">
<img className="icon-img" src="/icons/image.svg" onClick={handleUploadFileBtnClick} />
<span className={`tip-text ${state.isUploadingResource ? "!block" : ""}`}>Uploading</span>
</div>
</button>
<button className="action-btn" onClick={handleFullscreenBtnClick}>
<img className="icon-img" src={`/icons/${state.fullscreen ? "close" : "open"}-fullscreen.svg`} alt="" />
</button>