Skip to content

Commit

Permalink
enter for search, keep case when replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmajh committed Dec 6, 2021
1 parent b303006 commit ece4822
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Binary file modified assets/Translation_PM_JP_Asset.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions assets/asset_translation/asset_translation_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AssetTranslateDescription {

// write assets sheet
wb = new Exceljs.Workbook()
debugger
ws = wb.addWorksheet('assets');
ws.addRow(['IKO_Import', 'IKO_ASSET', 'AddChange', lang_code.toUpperCase()]);
ws.addRow(['SITEID', 'ASSETNUM', 'DESCRIPTION']);
Expand Down
2 changes: 1 addition & 1 deletion renderer/item_main.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h3 class="col">Validated Description</h3>
<td><i class="material-icons pointer">content_copy</i></td>
</tr>
<tr id="single-copy">
<th>Combinded Description</th>
<th>Combined Description</th>
<td id="result-single" colspan="3"></td>
<td><i class="material-icons pointer">content_copy</i></td>
</tr>
Expand Down
15 changes: 14 additions & 1 deletion renderer/item_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ document.getElementById("save-desc").addEventListener("click", writeDescription)
document.getElementById("save-num").addEventListener("click", writeAssetNum);
document.getElementById("skip-row").addEventListener("click", skipRow);

// listener for enter key on search field
document.getElementById("maximo-desc").addEventListener("keyup", function(event) {
// Number 13 is the "Enter" key on the keyboard
if (event.key === "Enter") {
// Cancel the default action, if needed
event.preventDefault();
// Trigger the button element with a click
validSingle();
}
});

// listener for general click events on icons
document.getElementById("main").addEventListener('click', (event) => {
Expand Down Expand Up @@ -286,7 +296,10 @@ async function showRelated(result) {
split = word.split(' ');
for (let smallWord of split) {
if (smallWord.length > 0) {
itemName = itemName.replace(new RegExp(`${smallWord}`, 'i'), `<b>${smallWord}</b>`)
itemName = itemName.replace(
new RegExp(`${smallWord}`, 'i'),
`<b>${itemName.match(new RegExp(`${smallWord}`, 'i'))?.[0]}</b>`
)
}
}

Expand Down

0 comments on commit ece4822

Please sign in to comment.