summaryrefslogtreecommitdiffstats
path: root/client/lib/escapeActions.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /client/lib/escapeActions.js
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/lib/escapeActions.js')
-rw-r--r--client/lib/escapeActions.js48
1 files changed, 25 insertions, 23 deletions
diff --git a/client/lib/escapeActions.js b/client/lib/escapeActions.js
index 0757ae46..1bf32a7d 100644
--- a/client/lib/escapeActions.js
+++ b/client/lib/escapeActions.js
@@ -33,13 +33,19 @@ EscapeActions = {
const noClickEscapeOn = options.noClickEscapeOn;
- this._actions = _.sortBy([...this._actions, {
- priority,
- condition,
- action,
- noClickEscapeOn,
- enabledOnClick,
- }], (action) => action.priority);
+ this._actions = _.sortBy(
+ [
+ ...this._actions,
+ {
+ priority,
+ condition,
+ action,
+ noClickEscapeOn,
+ enabledOnClick,
+ },
+ ],
+ action => action.priority,
+ );
},
executeLowest() {
@@ -80,10 +86,8 @@ EscapeActions = {
},
_stopClick(action, clickTarget) {
- if (!_.isString(action.noClickEscapeOn))
- return false;
- else
- return $(clickTarget).closest(action.noClickEscapeOn).length > 0;
+ if (!_.isString(action.noClickEscapeOn)) return false;
+ else return $(clickTarget).closest(action.noClickEscapeOn).length > 0;
},
_execute(options) {
@@ -95,14 +99,11 @@ EscapeActions = {
let executedAtLeastOne = false;
let maxPriority;
- if (!maxLabel)
- maxPriority = Infinity;
- else
- maxPriority = this.hierarchy.indexOf(maxLabel);
+ if (!maxLabel) maxPriority = Infinity;
+ else maxPriority = this.hierarchy.indexOf(maxLabel);
for (const currentAction of this._actions) {
- if (currentAction.priority > maxPriority)
- return executedAtLeastOne;
+ if (currentAction.priority > maxPriority) return executedAtLeastOne;
if (isClick && this._stopClick(currentAction, clickTarget))
return executedAtLeastOne;
@@ -111,8 +112,7 @@ EscapeActions = {
if (isEnabled && currentAction.condition()) {
currentAction.action();
executedAtLeastOne = true;
- if (!multipleActions)
- return executedAtLeastOne;
+ if (!multipleActions) return executedAtLeastOne;
}
}
return executedAtLeastOne;
@@ -128,13 +128,15 @@ Mousetrap.bindGlobal('esc', () => {
// On a left click on the document, we try to exectute one escape action (eg,
// close the popup). We don't execute any action if the user has clicked on a
// link or a button.
-$(document).on('click', (evt) => {
- if (evt.button === 0 &&
- $(evt.target).closest('a,button,.is-editable').length === 0) {
+$(document).on('click', evt => {
+ if (
+ evt.button === 0 &&
+ $(evt.target).closest('a,button,.is-editable').length === 0
+ ) {
EscapeActions.clickExecute(evt.target, 'multiselection');
}
});
-$(document).on('click', 'a[href=\\#]', (evt) => {
+$(document).on('click', 'a[href=\\#]', evt => {
evt.preventDefault();
});