Skip to content

Commit

Permalink
Fixing DevTools Console Errors (#227)
Browse files Browse the repository at this point in the history
* Fixing DevTools Console Errors

Fixing DevTools Console Errors

* Fixing DevTools Console Errors

Bumping up librariejs version
  • Loading branch information
RobertGlobant20 authored May 13, 2024
1 parent ea43d0b commit f5853c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
if (src.startsWith("data:image")) {
continue;
}

if(window.chrome.webview === undefined) return;
//request the icon from the extension.
var base64String = await window.chrome.webview.hostObjects.bridgeTwoWay.GetBase64StringFromPath(src);
if (currentImage != null) {
Expand All @@ -195,6 +197,7 @@
}

function refreshLibraryView(libraryController) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage("RefreshLibrary");
}

Expand All @@ -203,13 +206,15 @@
var encodedText = encodeURIComponent(text);
//save the callback so we can access from our completion function
searchCallback = callback;
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"performSearch","data":encodedText}));
window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Search",encodedText]}));
}

// Register event handlers for various events on library controller and package controller.
libController.on(libController.ItemClickedEventName, function (nodeCreationName) {
console.log('Library Node Clicked: ' + nodeCreationName);
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"createNode","data":nodeCreationName}));
});

Expand All @@ -225,15 +230,18 @@
}, true);

libController.on(libController.ItemMouseEnterEventName, function (arg) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"showNodeTooltip","data":[arg.data,arg.rect.top]}));
});

libController.on(libController.ItemMouseLeaveEventName, function (arg) {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"closeNodeTooltip","data":true}));
});

libController.on(libController.SectionIconClickedEventName, function (section) {
console.log("Section clicked: " + section);
if(window.chrome.webview === undefined) return;
if (section == "Add-ons") {
window.chrome.webview.postMessage(JSON.stringify({"func":"importLibrary","data":""}));
}
Expand All @@ -245,11 +253,13 @@
var catString = elem.name + ":" + (elem.checked ? "Selected" : "Unselected");
categories.push(catString);
});
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({"func":"logEventsToInstrumentation","data":["Filter-Categories",categories.join(",")]}));
});

//This will call the NextStep() function located in the LibraryViewController
function nextStepInGuide() {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({ "func": "NextStep", "data": "" }));
}

Expand Down Expand Up @@ -436,6 +446,7 @@

//This method will be executed when the WebBrowser change its size, so we can update the Popup vertical location that is over the library
function bodyResizeEvent() {
if(window.chrome.webview === undefined) return;
window.chrome.webview.postMessage(JSON.stringify({ "func": "ResizedEvent", "data": "" }));
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dynamods/librariejs",
"version": "1.0.2",
"version": "1.0.3",
"description": "Project that contains all hosted contents of Dynamo Windows client",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f5853c1

Please sign in to comment.