compose: Add parentheses for correct precedence.

This commit is contained in:
Umair Khan 2018-02-02 12:29:24 +05:00 committed by showell
parent 693ad9eac8
commit 302e106860
2 changed files with 9 additions and 1 deletions

View File

@ -321,6 +321,14 @@ people.add(bob);
compose.handle_keydown(event);
assert.equal("****Anything **bold**.", $('#compose-textarea').val());
// Test 'i' is typed correctly.
$("#compose-textarea").val('i');
event.keyCode = undefined;
event.which = 73;
event.metaKey = false;
event.ctrlKey = false;
compose.handle_keydown(event);
assert.equal("i", $('#compose-textarea').val());
// Test italic: ctrl/cmd + i.
input_text = "Anything italic";
$("#compose-textarea").val(input_text);

View File

@ -679,7 +679,7 @@ exports.handle_keydown = function (event) {
var isItalic = code === 73 && !event.shiftKey;
var isLink = code === 76 && event.shiftKey;
if (isBold || isItalic || isLink && (event.ctrlKey || event.metaKey)) {
if ((isBold || isItalic || isLink) && (event.ctrlKey || event.metaKey)) {
function add_markdown(markdown) {
var textarea = $("#compose-textarea");
var range = textarea.range();