Skip to content

Commit

Permalink
when clicking on A or BUTTON prevent dblclick
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Apr 2, 2024
1 parent 6cd97c6 commit 6f8bde2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/web/assets/cp/src/js/BaseElementIndexView.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ Craft.BaseElementIndexView = Garnish.Base.extend(
// Enable inline element editing if this is an index page
if (this.elementIndex.isAdministrative) {
this._handleElementEditing = (ev) => {
if (['A', 'BUTTON'].includes(ev.target.nodeName)) {
if (
['A', 'BUTTON'].includes(ev.target.nodeName) ||
['A', 'BUTTON'].includes(ev.target.parentNode.nodeName)
) {
// Let the link do its thing
return;
}
Expand Down
5 changes: 4 additions & 1 deletion src/web/assets/cp/src/js/NestedElementManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ Craft.NestedElementManager = Garnish.Base.extend(
initElement($element) {
if (Garnish.hasAttr($element, 'data-editable')) {
this.addListener($element, 'dblclick,taphold', (ev) => {
if (['A', 'BUTTON'].includes(ev.target.nodeName)) {
if (
['A', 'BUTTON'].includes(ev.target.nodeName) ||
['A', 'BUTTON'].includes(ev.target.parentNode.nodeName)
) {
// Let the link/button do its thing
return;
}
Expand Down

0 comments on commit 6f8bde2

Please sign in to comment.