0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-24 15:56:11 -05:00

🐛 Fix layer and component names inputs not having their text selectable on Firefox

This commit is contained in:
Belén Albeza 2024-03-27 11:55:17 +01:00
parent 7fa026da15
commit 78aafa4635
2 changed files with 21 additions and 19 deletions

View file

@ -177,8 +177,9 @@
on-mount on-mount
(fn [] (fn []
(let [dom (mf/ref-val ref)] (let [dom (mf/ref-val ref)]
(.setAttribute dom "draggable" true) ;; In firefox it needs to be draggable for problems with event handling. ;; In firefox it needs to be draggable for problems with event handling.
;; It will stop the drag operation in on-drag-start ;; It will stop the drag operation in on-drag-start
(.setAttribute dom "draggable" (and draggable? (not disabled)))
;; Register all events in the (default) bubble mode, so that they ;; Register all events in the (default) bubble mode, so that they
;; are captured by the most leaf item. The handler will stop ;; are captured by the most leaf item. The handler will stop

View file

@ -141,14 +141,16 @@
on-context-menu on-context-menu
(mf/use-fn (mf/use-fn
(mf/deps on-context-menu component-id) (mf/deps on-context-menu component-id)
(partial on-context-menu component-id))] (partial on-context-menu component-id))
renaming? (= renaming (:id component))]
[:div {:ref item-ref [:div {:ref item-ref
:class (stl/css-case :selected (contains? selected (:id component)) :class (stl/css-case :selected (contains? selected (:id component))
:grid-cell listing-thumbs? :grid-cell listing-thumbs?
:enum-item (not listing-thumbs?)) :enum-item (not listing-thumbs?))
:id (dm/str "component-shape-id-" (:id component)) :id (dm/str "component-shape-id-" (:id component))
:draggable (not read-only?) :draggable (and (not read-only?) (not renaming?))
:on-click on-component-click :on-click on-component-click
:on-double-click on-component-double-click :on-double-click on-component-double-click
:on-context-menu on-context-menu :on-context-menu on-context-menu
@ -160,7 +162,6 @@
(when (and (some? root-shape) (when (and (some? root-shape)
(some? container)) (some? container))
[:* [:*
(let [renaming? (= renaming (:id component))]
[:* [:*
[:& editable-label [:& editable-label
{:class (stl/css-case :cell-name listing-thumbs? {:class (stl/css-case :cell-name listing-thumbs?
@ -175,7 +176,7 @@
:on-cancel cancel-rename}] :on-cancel cancel-rename}]
(when ^boolean dragging? (when ^boolean dragging?
[:div {:class (stl/css :dragging)}])]) [:div {:class (stl/css :dragging)}])]
(when visible? (when visible?
[:& cmm/component-item-thumbnail {:file-id file-id [:& cmm/component-item-thumbnail {:file-id file-id