mirror of
https://github.com/penpot/penpot.git
synced 2026-09-14 07:59:36 +00:00
Merge pull request #7634 from penpot/alotor-fix-editable-label
🐛 Fix problem with certain text input and drag/drop
This commit is contained in:
commit
6d2d66a079
@ -70,6 +70,7 @@
|
|||||||
- Fix library update notificacions showing when they should not [Taiga #12397](https://tree.taiga.io/project/penpot/issue/12397)
|
- Fix library update notificacions showing when they should not [Taiga #12397](https://tree.taiga.io/project/penpot/issue/12397)
|
||||||
- Fix remove flex button doesn’t work within variant [Taiga #12314](https://tree.taiga.io/project/penpot/issue/12314)
|
- Fix remove flex button doesn’t work within variant [Taiga #12314](https://tree.taiga.io/project/penpot/issue/12314)
|
||||||
- Fix an error translation [Taiga #12402](https://tree.taiga.io/project/penpot/issue/12402)
|
- Fix an error translation [Taiga #12402](https://tree.taiga.io/project/penpot/issue/12402)
|
||||||
|
- 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)
|
||||||
|
|
||||||
## 2.10.1
|
## 2.10.1
|
||||||
|
|
||||||
|
|||||||
@ -169,9 +169,9 @@
|
|||||||
|
|
||||||
on-color-drag-start
|
on-color-drag-start
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps color file-id selected item-ref read-only?)
|
(mf/deps color file-id selected item-ref read-only? editing?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(if read-only?
|
(if (or read-only? editing?)
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(cmm/on-asset-drag-start event file-id color selected item-ref :colors identity))))
|
(cmm/on-asset-drag-start event file-id color selected item-ref :colors identity))))
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,7 @@
|
|||||||
component-id (:id component)
|
component-id (:id component)
|
||||||
|
|
||||||
visible? (h/use-visible item-ref :once? true)
|
visible? (h/use-visible item-ref :once? true)
|
||||||
|
renaming? (= renaming (:id component))
|
||||||
|
|
||||||
;; NOTE: we don't use reactive deref for it because we don't
|
;; NOTE: we don't use reactive deref for it because we don't
|
||||||
;; really need rerender on any change on the file change. If
|
;; really need rerender on any change on the file change. If
|
||||||
@ -82,12 +83,13 @@
|
|||||||
|
|
||||||
on-component-double-click
|
on-component-double-click
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps file-id component is-local)
|
(mf/deps file-id component is-local renaming?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(if is-local
|
(when-not renaming?
|
||||||
(st/emit! (dwl/go-to-local-component :id component-id))
|
(if is-local
|
||||||
(st/emit! (dwl/go-to-component-file file-id component false)))))
|
(st/emit! (dwl/go-to-local-component :id component-id))
|
||||||
|
(st/emit! (dwl/go-to-component-file file-id component false))))))
|
||||||
|
|
||||||
on-drop
|
on-drop
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
@ -113,18 +115,16 @@
|
|||||||
|
|
||||||
on-component-drag-start
|
on-component-drag-start
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps file-id component selected item-ref on-drag-start read-only? is-local)
|
(mf/deps file-id component selected item-ref on-drag-start read-only? renaming? is-local)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(if read-only?
|
(if (or read-only? renaming?)
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(cmm/on-asset-drag-start event file-id component selected item-ref :components on-drag-start))))
|
(cmm/on-asset-drag-start event file-id component selected item-ref :components on-drag-start))))
|
||||||
|
|
||||||
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 :component-item true
|
:class (stl/css-case :component-item true
|
||||||
|
|||||||
@ -76,9 +76,9 @@
|
|||||||
|
|
||||||
on-typography-drag-start
|
on-typography-drag-start
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps typography file-id selected item-ref read-only?)
|
(mf/deps typography file-id selected item-ref read-only? renaming? open?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(if read-only?
|
(if (or read-only? renaming? open?)
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(cmm/on-asset-drag-start event file-id typography selected item-ref :typographies identity))))
|
(cmm/on-asset-drag-start event file-id typography selected item-ref :typographies identity))))
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,7 @@
|
|||||||
:data {:id id
|
:data {:id id
|
||||||
:index index
|
:index index
|
||||||
:name (:name page)}
|
:name (:name page)}
|
||||||
:draggable? (not read-only?))
|
:draggable? (and (not read-only?) (not editing?)))
|
||||||
|
|
||||||
on-context-menu
|
on-context-menu
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|||||||
@ -162,7 +162,7 @@
|
|||||||
:data {:index index
|
:data {:index index
|
||||||
:is-group true}
|
:is-group true}
|
||||||
:detect-center? true
|
:detect-center? true
|
||||||
:draggable? is-draggable)]
|
:draggable? (and is-draggable (not is-editing)))]
|
||||||
|
|
||||||
[:div {:ref dref
|
[:div {:ref dref
|
||||||
:data-testid "tokens-set-group-item"
|
:data-testid "tokens-set-group-item"
|
||||||
@ -271,7 +271,7 @@
|
|||||||
:on-drop on-drop
|
:on-drop on-drop
|
||||||
:data {:index index
|
:data {:index index
|
||||||
:is-group false}
|
:is-group false}
|
||||||
:draggable? is-draggable)
|
:draggable? (and is-draggable (not is-editing)))
|
||||||
|
|
||||||
drop-over
|
drop-over
|
||||||
(get dprops :over)]
|
(get dprops :over)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user