🐛 Fix options button does not work for comments created in the lower part of the screen

This commit is contained in:
Alejandro Alonso
2025-10-29 11:24:24 +01:00
parent 133590f19c
commit bc700334ca
2 changed files with 14 additions and 25 deletions

View File

@@ -73,6 +73,7 @@
- Fix problem with certain text input in some editable labels (pages, components, tokens...) being in conflict with the drag/drop functionality [Taiga #12316](https://tree.taiga.io/project/penpot/issue/12316) - Fix problem with certain text input in some editable labels (pages, components, tokens...) being in conflict with the drag/drop functionality [Taiga #12316](https://tree.taiga.io/project/penpot/issue/12316)
- Fix not controlled theme renaming [Taiga #12411](https://tree.taiga.io/project/penpot/issue/12411) - Fix not controlled theme renaming [Taiga #12411](https://tree.taiga.io/project/penpot/issue/12411)
- Fix paste without selection sends the new element in the back [Taiga #12382](https://tree.taiga.io/project/penpot/issue/12382) - Fix paste without selection sends the new element in the back [Taiga #12382](https://tree.taiga.io/project/penpot/issue/12382)
- Fix options button does not work for comments created in the lower part of the screen [Taiga #12422](https://tree.taiga.io/project/penpot/issue/12422)
## 2.10.1 ## 2.10.1

View File

@@ -666,11 +666,12 @@
[:div {:class (stl/css :form-buttons-wrapper)} [:div {:class (stl/css :form-buttons-wrapper)}
[:> mentions-button*] [:> mentions-button*]
[:> button* {:variant "ghost" (when (some? on-cancel)
:type "button" [:> button* {:variant "ghost"
:on-key-down handle-cancel :type "button"
:on-click on-cancel} :on-key-down handle-cancel
(tr "ds.confirm-cancel")] :on-click on-cancel}
(tr "ds.confirm-cancel")])
[:> button* {:variant "primary" [:> button* {:variant "primary"
:type "button" :type "button"
:on-key-down handle-submit :on-key-down handle-submit
@@ -686,52 +687,39 @@
{::mf/props :obj {::mf/props :obj
::mf/private true} ::mf/private true}
[{:keys [on-submit]}] [{:keys [on-submit]}]
(let [show-buttons? (mf/use-state false) (let [content (mf/use-state "")
content (mf/use-state "")
disabled? (or (blank-content? @content) disabled? (or (blank-content? @content)
(exceeds-length? @content)) (exceeds-length? @content))
on-focus on-cancel
(mf/use-fn (mf/use-fn
#(reset! show-buttons? true)) #(st/emit! :interrupt))
on-blur
(mf/use-fn
#(reset! show-buttons? false))
on-change on-change
(mf/use-fn (mf/use-fn
#(reset! content %)) #(reset! content %))
on-cancel
(mf/use-fn
#(do (reset! content "")
(reset! show-buttons? false)))
on-submit* on-submit*
(mf/use-fn (mf/use-fn
(mf/deps @content) (mf/deps @content)
(fn [] (fn []
(on-submit @content) (on-submit @content)
(on-cancel)))] (reset! content "")))]
[:div {:class (stl/css :form)} [:div {:class (stl/css :form)}
[:> comment-input* [:> comment-input*
{:value @content {:value @content
:placeholder (tr "labels.reply.thread") :placeholder (tr "labels.reply.thread")
:autofocus true :autofocus true
:on-blur on-blur
:on-focus on-focus
:on-ctrl-enter on-submit* :on-ctrl-enter on-submit*
:on-change on-change}] :on-change on-change}]
(when (exceeds-length? @content) (when (exceeds-length? @content)
[:div {:class (stl/css :error-text)} [:div {:class (stl/css :error-text)}
(tr "errors.character-limit-exceeded")]) (tr "errors.character-limit-exceeded")])
(when (or @show-buttons? (seq @content)) [:> comment-form-buttons* {:on-submit on-submit*
[:> comment-form-buttons* {:on-submit on-submit* :on-cancel on-cancel
:on-cancel on-cancel :is-disabled disabled?}]]))
:is-disabled disabled?}])]))
(mf/defc comment-edit-form* (mf/defc comment-edit-form*
{::mf/private true} {::mf/private true}