-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to control click and context propagation #141
Conversation
jkanban.js
Outdated
@@ -54,8 +54,8 @@ var dragula = require('dragula'); | |||
dragBoard: function (el, source) {}, | |||
dragendBoard: function (el) {}, | |||
dropBoard: function (el, target, source, sibling) {}, | |||
click: function (el) {}, | |||
context: function (el, e) {}, | |||
click: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not recommend that. I guess it would be nice to have a kind of property or even a callback function to get if user wants to have native click or context.
jkanban.js
Outdated
@@ -508,6 +508,9 @@ var dragula = require('dragula'); | |||
} | |||
|
|||
function __onclickHandler (nodeItem, clickfn) { | |||
if (typeof self.options.click !== 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See that browser event is cancelled by preventDefault method. So if we have a property to control if jKanban has to propagate click or context this if will be simpler like ´if (!self.ownedHandlers.includes('click')) { return }`
jkanban.js
Outdated
@@ -516,6 +519,9 @@ var dragula = require('dragula'); | |||
} | |||
|
|||
function __onContextHandler(nodeItem, contextfn) { | |||
if (typeof self.options.context !== 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then here we can check ownedHandlers as well like ´if (!self.ownedHandlers.includes('context')) { return }`
jkanban.js
Outdated
click: function (el) {}, | ||
context: function (el, e) {}, | ||
click: null, | ||
context: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about that, I could suggest you to create a property called ownedHandlers or so, in order to control what event jKanban will handle ('click', 'context').
@marcosrocha85 |
Merged, thanks @ngmy |
I think it's more convenient to enable browser click and right-click by default.
For example, click to open URL in an item, or right-click to use the browser developer tool.