mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 09:45:54 +02:00
🐛 Fix display of asset names and console warning
This commit is contained in:
parent
3053e867cb
commit
a08c1b1278
1 changed files with 42 additions and 40 deletions
|
@ -375,7 +375,7 @@
|
||||||
[{:keys [component renaming listing-thumbs? selected-components
|
[{:keys [component renaming listing-thumbs? selected-components
|
||||||
on-asset-click on-context-menu on-drag-start do-rename
|
on-asset-click on-context-menu on-drag-start do-rename
|
||||||
cancel-rename selected-components-full selected-components-paths]}]
|
cancel-rename selected-components-full selected-components-paths]}]
|
||||||
(let [item-ref (mf/use-ref)
|
(let [item-ref (mf/use-ref)
|
||||||
|
|
||||||
dragging? (mf/use-state false)
|
dragging? (mf/use-state false)
|
||||||
|
|
||||||
|
@ -407,8 +407,7 @@
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(on-asset-drag-start event component selected-components item-ref :components on-drag-start)))]
|
(on-asset-drag-start event component selected-components item-ref :components on-drag-start)))]
|
||||||
|
|
||||||
[:div {:key (:id component)
|
[:div {:ref item-ref
|
||||||
:ref item-ref
|
|
||||||
:class (dom/classnames
|
:class (dom/classnames
|
||||||
:selected (contains? selected-components (:id component))
|
:selected (contains? selected-components (:id component))
|
||||||
:grid-cell @listing-thumbs?
|
:grid-cell @listing-thumbs?
|
||||||
|
@ -426,23 +425,24 @@
|
||||||
[:& component-svg {:group (get-in component [:objects (:id component)])
|
[:& component-svg {:group (get-in component [:objects (:id component)])
|
||||||
:objects (:objects component)}]
|
:objects (:objects component)}]
|
||||||
(let [renaming? (= renaming (:id component))]
|
(let [renaming? (= renaming (:id component))]
|
||||||
[:& editable-label
|
[:*
|
||||||
{:class (dom/classnames
|
[:& editable-label
|
||||||
:cell-name @listing-thumbs?
|
{:class-name (dom/classnames
|
||||||
:item-name (not @listing-thumbs?)
|
:cell-name @listing-thumbs?
|
||||||
:editing renaming?)
|
:item-name (not @listing-thumbs?)
|
||||||
:value (cph/merge-path-item (:path component) (:name component))
|
:editing renaming?)
|
||||||
:tooltip (cph/merge-path-item (:path component) (:name component))
|
:value (cph/merge-path-item (:path component) (:name component))
|
||||||
:display-value (if @listing-thumbs?
|
:tooltip (cph/merge-path-item (:path component) (:name component))
|
||||||
(:name component)
|
:display-value (if @listing-thumbs?
|
||||||
(cph/compact-name (:path component)
|
(:name component)
|
||||||
(:name component)))
|
(cph/compact-name (:path component)
|
||||||
:editing? renaming?
|
(:name component)))
|
||||||
:disable-dbl-click? true
|
:editing? renaming?
|
||||||
:on-change do-rename
|
:disable-dbl-click? true
|
||||||
:on-cancel cancel-rename}]
|
:on-change do-rename
|
||||||
(when @dragging?
|
:on-cancel cancel-rename}]
|
||||||
[:div.dragging]))]))
|
(when @dragging?
|
||||||
|
[:div.dragging])])]))
|
||||||
|
|
||||||
(mf/defc components-group
|
(mf/defc components-group
|
||||||
[{:keys [file-id prefix groups open-groups renaming listing-thumbs? selected-components on-asset-click
|
[{:keys [file-id prefix groups open-groups renaming listing-thumbs? selected-components on-asset-click
|
||||||
|
@ -510,6 +510,7 @@
|
||||||
[:div.drop-space])
|
[:div.drop-space])
|
||||||
(for [component components]
|
(for [component components]
|
||||||
[:& components-item {:component component
|
[:& components-item {:component component
|
||||||
|
:key (:id component)
|
||||||
:renaming renaming
|
:renaming renaming
|
||||||
:listing-thumbs? listing-thumbs?
|
:listing-thumbs? listing-thumbs?
|
||||||
:selected-components selected-components
|
:selected-components selected-components
|
||||||
|
@ -751,8 +752,7 @@
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(on-asset-drag-start event object selected-objects item-ref :graphics on-drag-start)))]
|
(on-asset-drag-start event object selected-objects item-ref :graphics on-drag-start)))]
|
||||||
|
|
||||||
[:div {:key (:id object)
|
[:div {:ref item-ref
|
||||||
:ref item-ref
|
|
||||||
:class-name (dom/classnames
|
:class-name (dom/classnames
|
||||||
:selected (contains? selected-objects (:id object))
|
:selected (contains? selected-objects (:id object))
|
||||||
:grid-cell @listing-thumbs?
|
:grid-cell @listing-thumbs?
|
||||||
|
@ -769,23 +769,24 @@
|
||||||
:draggable false}] ;; Also need to add css pointer-events: none
|
:draggable false}] ;; Also need to add css pointer-events: none
|
||||||
|
|
||||||
(let [renaming? (= renaming (:id object))]
|
(let [renaming? (= renaming (:id object))]
|
||||||
[:& editable-label
|
[:*
|
||||||
{:class-name (dom/classnames
|
[:& editable-label
|
||||||
:cell-name @listing-thumbs?
|
{:class-name (dom/classnames
|
||||||
:item-name (not @listing-thumbs?)
|
:cell-name @listing-thumbs?
|
||||||
:editing renaming?)
|
:item-name (not @listing-thumbs?)
|
||||||
:value (cph/merge-path-item (:path object) (:name object))
|
:editing renaming?)
|
||||||
:tooltip (cph/merge-path-item (:path object) (:name object))
|
:value (cph/merge-path-item (:path object) (:name object))
|
||||||
:display-value (if @listing-thumbs?
|
:tooltip (cph/merge-path-item (:path object) (:name object))
|
||||||
(:name object)
|
:display-value (if @listing-thumbs?
|
||||||
(cph/compact-name (:path object)
|
(:name object)
|
||||||
(:name object)))
|
(cph/compact-name (:path object)
|
||||||
:editing? renaming?
|
(:name object)))
|
||||||
:disable-dbl-click? true
|
:editing? renaming?
|
||||||
:on-change do-rename
|
:disable-dbl-click? true
|
||||||
:on-cancel cancel-rename}]
|
:on-change do-rename
|
||||||
(when @dragging?
|
:on-cancel cancel-rename}]
|
||||||
[:div.dragging]))]))
|
(when @dragging?
|
||||||
|
[:div.dragging])])]))
|
||||||
|
|
||||||
(mf/defc graphics-group
|
(mf/defc graphics-group
|
||||||
[{:keys [file-id prefix groups open-groups renaming listing-thumbs? selected-objects on-asset-click
|
[{:keys [file-id prefix groups open-groups renaming listing-thumbs? selected-objects on-asset-click
|
||||||
|
@ -852,7 +853,8 @@
|
||||||
(some? groups))
|
(some? groups))
|
||||||
[:div.drop-space])
|
[:div.drop-space])
|
||||||
(for [object objects]
|
(for [object objects]
|
||||||
[:& graphics-item {:object object
|
[:& graphics-item {:key (:id object)
|
||||||
|
:object object
|
||||||
:renaming renaming
|
:renaming renaming
|
||||||
:listing-thumbs? listing-thumbs?
|
:listing-thumbs? listing-thumbs?
|
||||||
:selected-objects selected-objects
|
:selected-objects selected-objects
|
||||||
|
|
Loading…
Add table
Reference in a new issue