Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix collapsed menu and popup position #12501

Merged
merged 2 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ internal static void CollapseExpandPackage(Step stepInfo)
{
CurrentExecutingStep = stepInfo;
var firstUIAutomation = stepInfo.UIAutomation.FirstOrDefault();
if (firstUIAutomation == null) return;
if (firstUIAutomation == null || firstUIAutomation.JSParameters.Count == 0) return;
object[] parametersInvokeScript = new object[] { firstUIAutomation.JSFunctionName, new object[] { firstUIAutomation.JSParameters.FirstOrDefault() } };
ResourceUtilities.ExecuteJSFunction(stepInfo.MainWindow, stepInfo.HostPopupInfo, parametersInvokeScript);
}
Expand Down
29 changes: 23 additions & 6 deletions src/DynamoCoreWpf/UI/GuidedTour/dynamo_guides.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@
"Name": "ExecutePackageSearch",
"ExecuteCleanUpForward": false,
"ExecuteCleanUpBackward": true,
"ElementName": "NextButton",
"Action": "execute",
"UpdatePlacementTarget": true
},
Expand Down Expand Up @@ -741,7 +742,7 @@
"Name": "SubscribeNextButtonClickEvent",
"Action": "execute",
"JSFunctionName": "collapseExpandPackage",
"JSParameters": [ "SampleLibraryUI" ],
"JSParameters": [ "SampleLibraryUI", "LibraryItemText" ],
"AutomaticHandlers": [
{
"HandlerElement": "NextButton",
Expand Down Expand Up @@ -798,7 +799,7 @@
"Type": "tooltip",
"TooltipPointerDirection": "top_left",
"Width": 480,
"Height": 490,
"Height": 400,
"ShowLibrary": true,
"StepContent": {
"Title": "PackagesGuidePackagesNodeTitle",
Expand All @@ -809,8 +810,8 @@
"DynamicHostWindow": true,
"HostUIElementString": "sidebarGrid",
"WindowName": "LibraryView",
"VerticalPopupOffset": 300,
"HorizontalPopupOffset": 300,
"VerticalPopupOffset": 450,
"HorizontalPopupOffset": 320,
"HtmlPage": {
"FileName": "nodePackage.html",
"Resources": {
Expand All @@ -833,7 +834,23 @@
"Name": "InvokeJSFunction",
"Action": "execute",
"JSFunctionName": "collapseExpandPackage",
"JSParameters": [ "Revit" ]
"JSParameters": [ "SampleLibraryUI", "LibraryItemText" ]
},
{
"Sequence": 2,
"ControlType": "JSFunction",
"Name": "InvokeJSFunction",
"Action": "execute",
"JSFunctionName": "collapseExpandPackage",
"JSParameters": [ "Examples", "LibraryItemGroupText" ]
},
{
"Sequence": 3,
"ControlType": "function",
"Name": "LibraryScrollToBottom",
"JSFunctionName": "scrollToBottom",
"JSParameters": [],
"Action": "execute"
}
]
},
Expand All @@ -856,7 +873,7 @@
"HostPopupInfo": {
"PopupPlacement": "center",
"HostUIElementString": "WorkspaceTabs",
"VerticalPopupOffset": 0
"VerticalPopupOffset": 0
}
}
]
Expand Down
10 changes: 5 additions & 5 deletions src/LibraryViewExtensionMSWebBrowser/web/library/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@
}

//This will find the <div> that contains the package information
function findPackageDiv(packageName) {
function findPackageDiv(packageName, libraryClassName) {
var found_div = null;
var libraryItemsText = document.getElementsByClassName("LibraryItemText");
var libraryItemsText = document.getElementsByClassName(libraryClassName);
for (var i = 0; i < libraryItemsText.length; i++) {
if (libraryItemsText[i].textContent.toLowerCase() == packageName.toLowerCase()) {
found_div = libraryItemsText[i];
Expand All @@ -321,13 +321,13 @@
}

//This will execute a click over a specific <div> that contains the package content
function collapseExpandPackage(packageName) {
var found_div = findPackageDiv(packageName);
function collapseExpandPackage(packageName, libraryClassName) {
var found_div = findPackageDiv(packageName, libraryClassName);
if (found_div == null) {
return;
}
var containerCatDiv = found_div.parentNode.parentNode;
var itemBodyContainer = containerCatDiv.getElementsByClassName("LibraryItemText")[0];
var itemBodyContainer = containerCatDiv.getElementsByClassName(libraryClassName)[0];
itemBodyContainer.click();
}

Expand Down