File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ type PostPageData struct {
53
53
Username string
54
54
BlogName string
55
55
Contents template.HTML
56
+ Text string
56
57
PublishAtISO string
57
58
PublishAt string
58
59
ExpiresAt string
@@ -219,6 +220,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
219
220
Username : username ,
220
221
BlogName : blogName ,
221
222
Contents : template .HTML (parsedText ),
223
+ Text : post .Text ,
222
224
ExpiresAt : expiresAt ,
223
225
Unlisted : unlisted ,
224
226
}
@@ -235,6 +237,7 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
235
237
Username : username ,
236
238
BlogName : blogName ,
237
239
Contents : "oops! we can't seem to find this post." ,
240
+ Text : "oops! we can't seem to find this post." ,
238
241
ExpiresAt : "" ,
239
242
}
240
243
}
Original file line number Diff line number Diff line change 37
37
<p class="font-bold m-0">expires: {{.ExpiresAt}}</p>
38
38
</header>
39
39
<main>
40
+ <script>
41
+ function copyText() {
42
+ const text = `{{.Text}}`
43
+ navigator.clipboard.writeText(text)
44
+ }
45
+ </script>
46
+ <button onclick="copyText()" class="btn mt inline-block">Copy Paste</button>
40
47
<article>
41
48
{{.Contents}}
42
49
</article>
You can’t perform that action at this time.
0 commit comments