Skip to content

Commit

Permalink
fix reply textarea text being flushed when image uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Sep 7, 2024
1 parent a9d3901 commit 18dfe7a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#

APP_NAME=littr
APP_VERSION=0.39.18
APP_VERSION=0.39.19
GOLANG_VERSION=1.23
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "MIT",
"url": "https://github.com/krustowski/littr/blob/master/LICENSE"
},
"version": "0.39.18"
"version": "0.39.19"
},
"host": "www.littr.eu",
"basePath": "/api/v1",
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/router.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @title littr
// @version 0.39.18
// @version 0.39.19
// @description a simple nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down
17 changes: 14 additions & 3 deletions pkg/frontend/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,15 @@ func (c *flowContent) handleReply(ctx app.Context, a app.Action) {
postType := "post"

// trim the spaces on the extremites
textarea := app.Window().GetElementByID("reply-textarea").Get("value").String()
replyPost := strings.TrimSpace(textarea)
replyPost := c.replyPostContent

if replyPost == "" {
textarea := app.Window().GetElementByID("reply-textarea")

if !textarea.IsNull() {
replyPost = strings.TrimSpace(textarea.Get("reply-textarea").String())
}
}

// allow picture-only posting
if replyPost == "" && c.newFigFile == "" {
Expand Down Expand Up @@ -400,6 +407,7 @@ func (c *flowContent) handleReply(ctx app.Context, a app.Action) {
c.postButtonsDisabled = false

c.interactedPostKey = ""
c.replyPostContent = ""
c.newFigData = []byte{}
c.newFigFile = ""
})
Expand All @@ -415,6 +423,7 @@ func (c *flowContent) handleReply(ctx app.Context, a app.Action) {
c.postButtonsDisabled = false

c.interactedPostKey = ""
c.replyPostContent = ""
c.newFigData = []byte{}
c.newFigFile = ""
})
Expand All @@ -437,6 +446,7 @@ func (c *flowContent) handleReply(ctx app.Context, a app.Action) {
c.postButtonsDisabled = false

c.interactedPostKey = ""
c.replyPostContent = ""
c.newFigData = []byte{}
c.newFigFile = ""
})
Expand All @@ -461,6 +471,7 @@ func (c *flowContent) handleReply(ctx app.Context, a app.Action) {
c.buttonDisabled = false

c.interactedPostKey = ""
c.replyPostContent = ""
c.newFigData = []byte{}
c.newFigFile = ""
})
Expand Down Expand Up @@ -1276,7 +1287,7 @@ func (c *flowContent) Render() app.UI {

app.Div().Class("field label textarea border extra deep-orange-text").Body(
//app.Textarea().Class("active").Name("replyPost").OnChange(c.ValueTo(&c.replyPostContent)).AutoFocus(true).Placeholder("reply to: "+c.posts[c.interactedPostKey].Nickname),
app.Textarea().Class("active").Name("replyPost").OnChange(c.ValueTo(&c.replyPostContent)).AutoFocus(true).ID("reply-textarea"),
app.Textarea().Class("active").Name("replyPost").Text(c.replyPostContent).OnChange(c.ValueTo(&c.replyPostContent)).AutoFocus(true).ID("reply-textarea"),
app.Label().Text("reply to: "+c.posts[c.interactedPostKey].Nickname).Class("active deep-orange-text"),
//app.Label().Text("text").Class("active"),
),
Expand Down

0 comments on commit 18dfe7a

Please sign in to comment.