diff --git a/appview/pages/templates/fragments/comment/edit.html b/appview/pages/templates/fragments/comment/edit.html index 3c060801..6689e3fa 100644 --- a/appview/pages/templates/fragments/comment/edit.html +++ b/appview/pages/templates/fragments/comment/edit.html @@ -8,11 +8,10 @@ hx-disabled-elt="find button[type='submit']" > - + {{ template "fragments/markdownEditor" + (dict "Name" "body" + "Value" .Comment.EditableBody + "Placeholder" "Describe this pull request. Markdown is supported.") }}
{{ template "editActions" $ }} @@ -42,6 +41,8 @@ hx-get="/comment?aturi={{ .Comment.AtUri }}" hx-target="closest form" hx-swap="outerHTML" + hx-indicator="this" + hx-disabled-elt="this" > {{ i "x" "size-4" }} Cancel diff --git a/appview/pages/templates/fragments/comment/reply.html b/appview/pages/templates/fragments/comment/reply.html index 46835e89..d33701b6 100644 --- a/appview/pages/templates/fragments/comment/reply.html +++ b/appview/pages/templates/fragments/comment/reply.html @@ -8,12 +8,12 @@ hx-disabled-elt="find button[type='submit']" > {{ template "user/fragments/picHandleLink" .LoggedInUser.Did }} - + {{ template "fragments/markdownEditor" + (dict "Name" "body" + "BlobName" "blob" + "Rows" 3 + "AutoFocus" true + "Placeholder" "Leave a reply...") }} {{ template "replyActions" . }} {{ end }} diff --git a/appview/pages/templates/fragments/line-quote-button.html b/appview/pages/templates/fragments/line-quote-button.html index e3f13fd7..e280067b 100644 --- a/appview/pages/templates/fragments/line-quote-button.html +++ b/appview/pages/templates/fragments/line-quote-button.html @@ -18,7 +18,7 @@ const btnEnd = document.getElementById('line-quote-btn-end'); const textarea = () => - document.getElementById('comment-textarea'); + document.querySelector('form[hx-post="/comment"] textarea'); const lineOf = (el) => el?.closest?.('span[id*="-O"]') diff --git a/appview/pages/templates/fragments/markdownEditor.html b/appview/pages/templates/fragments/markdownEditor.html new file mode 100644 index 00000000..635277f2 --- /dev/null +++ b/appview/pages/templates/fragments/markdownEditor.html @@ -0,0 +1,69 @@ +{{ define "fragments/markdownEditor" }} + {{ $name := .Name }} + {{ $value := .Value }} + {{ $blobName := .BlobName }} + {{ $blobValues := .BlobValues }} + {{ $rows := (or .Rows 5) }} + {{ $required := .Required }} + {{ $autofocus := .AutoFocus }} + {{ $placeholder := .Placeholder }} +