Skip to content

Commit

Permalink
JS: Update prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Nov 20, 2020
1 parent cecbf9c commit 6c31d13
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.1.2
rev: v2.2.0
hooks:
- id: prettier
files: "\\.(\
Expand All @@ -61,7 +61,7 @@ repos:
- id: eslint
args: ["--format=compact"]
additional_dependencies:
- prettier@2.1.2
- prettier@2.2.0
- eslint@>=6.2.2
- eslint-plugin-import@>=2.18.0
- eslint-plugin-node@>=9.1.0
Expand All @@ -78,7 +78,7 @@ repos:
- stylelint@latest
- stylelint-config-prettier@latest
- stylelint-prettier@latest
- prettier@2.1.2
- prettier@2.2.0

exclude: "^.*\\.(\
csv|\
Expand Down
26 changes: 14 additions & 12 deletions weblate/static/editor/full.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
window.location = $("#button-end").attr("href");
return false;
});
Mousetrap.bindGlobal(["alt+pagedown", "mod+down", "alt+down"], function (
e
) {
window.location = $("#button-next").attr("href");
return false;
});
Mousetrap.bindGlobal(
["alt+pagedown", "mod+down", "alt+down"],
function (e) {
window.location = $("#button-next").attr("href");
return false;
}
);
Mousetrap.bindGlobal(["alt+pageup", "mod+up", "alt+up"], function (e) {
window.location = $("#button-prev").attr("href");
return false;
Expand Down Expand Up @@ -367,12 +368,13 @@
.find(".check-number")
.html(' <kbd title="' + title + '">' + key + "</kbd>");

Mousetrap.bindGlobal(["mod+i " + key, "mod+i mod+" + key], function (
e
) {
$this.find(".check-dismiss-single").click();
return false;
});
Mousetrap.bindGlobal(
["mod+i " + key, "mod+i mod+" + key],
function (e) {
$this.find(".check-dismiss-single").click();
return false;
}
);
} else {
$(this).find(".check-number").html("");
}
Expand Down
41 changes: 21 additions & 20 deletions weblate/static/loader-codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,30 @@
});
}

CodeMirror.registerHelper("hint", "userSuggestions", function (
editor,
callback
) {
var cur = editor.getCursor();
var curLine = editor.getLine(cur.line);
CodeMirror.registerHelper(
"hint",
"userSuggestions",
function (editor, callback) {
var cur = editor.getCursor();
var curLine = editor.getLine(cur.line);

var end = cur.ch;
var start = curLine.lastIndexOf("@") + 1;
// Extract the current word from the current line using 'start' / 'end' value pair
var curWord = start !== end && curLine.slice(start, end);
var end = cur.ch;
var start = curLine.lastIndexOf("@") + 1;
// Extract the current word from the current line using 'start' / 'end' value pair
var curWord = start !== end && curLine.slice(start, end);

if (curWord && curWord.length > 2) {
// If there is current word set, We can filter out users from the
// main list and display them
getUserList(
curWord,
CodeMirror.Pos(cur.line, start),
CodeMirror.Pos(cur.line, end),
callback
);
if (curWord && curWord.length > 2) {
// If there is current word set, We can filter out users from the
// main list and display them
getUserList(
curWord,
CodeMirror.Pos(cur.line, start),
CodeMirror.Pos(cur.line, end),
callback
);
}
}
});
);

CodeMirror.hint.userSuggestions.async = true;

Expand Down

0 comments on commit 6c31d13

Please sign in to comment.