Skip to content

Commit

Permalink
Fix textarea display, closes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Jun 24, 2020
1 parent 369cf53 commit 7f95d4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// NOTE: We could actually just press our button here
// but using chrome.commmands in manigest allows
// users to customize the Keyboard shortcut
// NOTE2: This will obviously not work if user customized
// their Crowdin shortcut for "Copy Source"
$(document).on("keydown", function(e) {
// Alt+C for Linux and Win
// Ctrl+C for Mac
Expand Down Expand Up @@ -72,6 +74,7 @@
var initializePlugin = function() {

// Create a new button
// TODO: Move this code to a separate function createButton(parenElem);
$translateMathBtn = $('<button id="translate_math" tabindex="-1" class="btn btn-icon"><i class="static-icon-copy"></i></button>');
var shortcut;
if(isMac)
Expand All @@ -83,6 +86,7 @@
commaURL = chrome.runtime.getURL("5commastyle.gif");
$translateMathBtn.css('background', `url("${commaURL}") 3px 7px no-repeat`);

// The original button
$copySourceBtn = $(copySourceElemSelector);
$menu = $copySourceBtn.parent();
$menu.append($translateMathBtn);
Expand All @@ -92,8 +96,10 @@
$copySourceBtn.attr("title", "Copy Source");

var copyAndTranslateMath = function(lang) {
// TODO: Move this up
$translation = $('#translation');
// Click the original button
// TODO: use $copySourceBtn
$('#action_copy_source').click();

// This is where we actually translate math
Expand All @@ -113,7 +119,7 @@
if(shouldUnescape(source)) {
translatedString = escapeCrowdinString(translatedString);
}
$translation.val(translatedString);
$translation.val(translatedString).trigger("input");
}

var checkLocale = function() {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Khan Academy Dots",
"description": "Translate math notation in Khan Academy Crowdin strings.",
"author": "Daniel Hollas & Szymon Bubak & Krzysztof Krystek & Robert Pala",
"version": "3.2.2",
"version": "3.2.3",
"permissions": [
"activeTab",
"storage"
Expand Down

0 comments on commit 7f95d4e

Please sign in to comment.