mirror of
https://github.com/usememos/memos.git
synced 2025-03-20 20:50:07 +01:00
parent
288ecc617d
commit
f8855ddb56
@ -29,9 +29,6 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
if err := json.NewDecoder(c.Request().Body).Decode(memoCreate); err != nil {
|
if err := json.NewDecoder(c.Request().Body).Decode(memoCreate); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo request").SetInternal(err)
|
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted post memo request").SetInternal(err)
|
||||||
}
|
}
|
||||||
if memoCreate.Content == "" {
|
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, "Memo content shouldn't be empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
if memoCreate.Visibility == "" {
|
if memoCreate.Visibility == "" {
|
||||||
userSettingMemoVisibilityKey := api.UserSettingMemoVisibilityKey
|
userSettingMemoVisibilityKey := api.UserSettingMemoVisibilityKey
|
||||||
|
@ -296,12 +296,7 @@ const MemoEditor = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSaveBtnClick = async () => {
|
const handleSaveBtnClick = async () => {
|
||||||
const content = editorRef.current?.getContent();
|
const content = editorRef.current?.getContent() ?? "";
|
||||||
if (!content) {
|
|
||||||
toastHelper.error(t("editor.cant-empty"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { editMemoId } = editorStore.getState();
|
const { editMemoId } = editorStore.getState();
|
||||||
if (editMemoId && editMemoId !== UNKNOWN_ID) {
|
if (editMemoId && editMemoId !== UNKNOWN_ID) {
|
||||||
@ -551,7 +546,11 @@ const MemoEditor = () => {
|
|||||||
<button className={`action-btn cancel-btn ${isEditing ? "" : "!hidden"}`} onClick={handleCancelEdit}>
|
<button className={`action-btn cancel-btn ${isEditing ? "" : "!hidden"}`} onClick={handleCancelEdit}>
|
||||||
{t("editor.cancel-edit")}
|
{t("editor.cancel-edit")}
|
||||||
</button>
|
</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")}
|
{t("editor.save")}
|
||||||
<img className="icon-img w-4 h-auto" src="/logo.png" />
|
<img className="icon-img w-4 h-auto" src="/logo.png" />
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user