From 7f95d4ed8752f112d21658f8518901862cfb6077 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Wed, 24 Jun 2020 14:24:16 +0200 Subject: [PATCH] Fix textarea display, closes #12 --- app.js | 8 +++++++- manifest.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index a4859dd..4e17898 100644 --- a/app.js +++ b/app.js @@ -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 @@ -72,6 +74,7 @@ var initializePlugin = function() { // Create a new button + // TODO: Move this code to a separate function createButton(parenElem); $translateMathBtn = $(''); var shortcut; if(isMac) @@ -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); @@ -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 @@ -113,7 +119,7 @@ if(shouldUnescape(source)) { translatedString = escapeCrowdinString(translatedString); } - $translation.val(translatedString); + $translation.val(translatedString).trigger("input"); } var checkLocale = function() { diff --git a/manifest.json b/manifest.json index f0b1760..d78efb6 100644 --- a/manifest.json +++ b/manifest.json @@ -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"