feat: support empty content memo (#963)

feat: support empty-text memo
This commit is contained in:
Zeng1998
2023-01-17 20:56:57 +08:00
committed by GitHub
parent 288ecc617d
commit f8855ddb56
2 changed files with 6 additions and 10 deletions

View File

@ -296,12 +296,7 @@ const MemoEditor = () => {
};
const handleSaveBtnClick = async () => {
const content = editorRef.current?.getContent();
if (!content) {
toastHelper.error(t("editor.cant-empty"));
return;
}
const content = editorRef.current?.getContent() ?? "";
try {
const { editMemoId } = editorStore.getState();
if (editMemoId && editMemoId !== UNKNOWN_ID) {
@ -551,7 +546,11 @@ const MemoEditor = () => {
<button className={`action-btn cancel-btn ${isEditing ? "" : "!hidden"}`} onClick={handleCancelEdit}>
{t("editor.cancel-edit")}
</button>
<button className="action-btn confirm-btn" disabled={!allowSave || state.isUploadingResource} onClick={handleSaveBtnClick}>
<button
className="action-btn confirm-btn"
disabled={!(allowSave || editorState.resourceList.length > 0) || state.isUploadingResource}
onClick={handleSaveBtnClick}
>
{t("editor.save")}
<img className="icon-img w-4 h-auto" src="/logo.png" />
</button>