Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
f8855ddb
Unverified
Commit
f8855ddb
authored
Jan 17, 2023
by
Zeng1998
Committed by
GitHub
Jan 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support empty content memo (#963)
feat: support empty-text memo
parent
288ecc61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
memo.go
server/memo.go
+0
-3
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+6
-7
No files found.
server/memo.go
View file @
f8855ddb
...
@@ -29,9 +29,6 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
...
@@ -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
...
...
web/src/components/MemoEditor.tsx
View file @
f8855ddb
...
@@ -296,12 +296,7 @@ const MemoEditor = () => {
...
@@ -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 = () => {
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment