Skip to content

Commit

Permalink
DocumentationBrowserViewExtension Upgrade + Insert (#13414)
Browse files Browse the repository at this point in the history
* Stylesheet Update

- updated the MarkdownStyling.html containing the css for styling the browser
- first updates to the NodeDocumentationHtmlGenerator to test the styling

* HtmlGenerator Structure Change

- adopting the components of the new UI design

* Markdown Moved

- location of markdown part of the document moved to the Node Information sections (first expander)

* Input Output Table Style Update

- work on the table containing Inputs and Outputs
- css style changes
- dpi script change to allow for 100% width

* Inputs Outputs Tables Finished

- restyling of inputs and outputs table done

* Body Style Changes

- slight changes to the left/right margin of the body

* Image Navigation Started

- added the initial Image navigation implementation in javascript
- KNOWN ISSUES - HTML Sanitize will remove 'position: absolute/relative' from CSS code. Current workaround is very patchy and a better solution needs to be found
- button restyling WIP
- zoom-in/zoom-out recenters image (WIP)

* Breadcrumbs ILayoutSpecSource Implementation, Image Navigation

- now reads the layoutspec.json by using the ILayoutSpecSource interface
- added a Func to ILayoutSpec to allow for the layoutspec.json to be retrieved after all extensions are loaded
- zooming in/out of image in browser javascript implementation
- styling WIP
- whitelisted CSS position property in Md2HtmlSanitizer

* Image Navigation Styling

- added icons to image navigation buttons
- added an eventhandler to button click handling Insert function

* Insert Functionality Started

- WIP Insert file from path

* Insert Functionality Working with JSON Graphs

- the full workflow now inserts a graph with all the relevant Annotations
- the functionality was added in the DynamoModel class

* Dynamo Graph from MD File Location

- now tries to find the corresponding Dynamo graph from the MarkDown location (fallback_docks folder)

* DissolveNestedGroups Command Added, Multiple Changes to DocumentationBrowserViewExtension

- added a command to help 'dissolve' nested group into their parent group
- improved the logic when inserting links into file using the DocumentationBrowserViewExtension

* Insert WIP

- progression work on 'Insert' function

* Dyf | Dyn Split

- will only allow for .dyn files to be inserted in HomeWorkspaceModel
- will only prompt for .dyf files to be inserted in CustomNodeWorkspaceModel
- the *.* option will still allow you to potentially mix-and-match, needs testing

* Removed Prompt to Save File

- when inserting no longer prompts the user to save the current progress

* Toast Notifications Added

- added notifications when flipping RunType to Manual before insertion

* Note Alignment Fix

- small fix for the location of notes outside group in DocumentaionBrowser routine

* Initial Tests Added

- added a test for the new Insert function

* Image Controls - Visual Bump

- aligning the style of the image control buttons to the existing workspace visual controls in Dynamo

* Tests Added

- node count test when inserting graph test
- run settings after executing insert graph test

* Localization for DocumnationBrowser Added

- replaced hard-coded strings with resource parameters

* Localization Issues Fallback Folder

- fallback directory failing on non-US cultures

* Test Fix 1

- changes to a number of tests due to the complete rehaul of the Documentation Browser

* Test Fix 2

- continuation of failing test fixes

* Test Fix 3

- continuation of failing test fixes

* Comments and Fixes

- PR comments and minor fixes

* RunSettings Tooltips Changes

- changes to existing tooltips regarding RunSettings dropdown
- new ? info tooltip added to Preferences panel inline with Default Run Settings

* Toast Notificaiton from DynamoModel to DynamoViewModel

- now raises a toast notification when failing to insert a graph due to nodes already existing in the workspace

* Unsubscribe RequestNotification

* Mk2Html Whitlisting CSS Properties Added

- added properties used in MarkdownStyling.html
- removed unnecessary 'include' statements for the DocumentationBrowser project
- cleaned up unused code

* Comments

* Comments

- API break - introduced a separate overload to fix the potential issue
- used localized resource instead of hard-coded value

* Test Fix

- fixed expected result for CanCreateNodeDocumenationHtmlFromNodeAnnotationEventArgsWithPackageNodeWithAddtionalDocumentation

* Comments

* Comments
  • Loading branch information
dnenov authored Nov 1, 2022
1 parent e96d777 commit ef6b0c1
Show file tree
Hide file tree
Showing 42 changed files with 2,473 additions and 230 deletions.
391 changes: 285 additions & 106 deletions src/DocumentationBrowserViewExtension/Docs/MarkdownStyling.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.Utilities;
using Dynamo.Utilities;
using System.IO;
using System.Reflection;

Expand All @@ -17,7 +17,14 @@ internal static string GetDPIScript()
{
return ResourceUtilities.DPISCRIPT;
}

/// <summary>
/// Returns the Image Navigation Script
/// </summary>
/// <returns></returns>
internal static string GetImageNavigationScript()
{
return ResourceUtilities.IMGNAVIGATIONSCRIPT;
}
/// <summary>
/// Returns the content of an embedded resource file.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.Logging;
using Dynamo.Logging;
using Dynamo.Utilities;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.Wpf;
Expand Down Expand Up @@ -113,6 +113,8 @@ protected virtual void Dispose(bool disposing)
this.documentationBrowser.Dispose();
}
this.documentationBrowser.DpiChanged -= DocumentationBrowser_DpiChanged;
if(this.documentationBrowser.CoreWebView2 != null)
this.documentationBrowser.CoreWebView2.WebMessageReceived -= CoreWebView2OnWebMessageReceived;
}

async void InitializeAsync()
Expand All @@ -138,6 +140,18 @@ async void InitializeAsync()
{
this.documentationBrowser.NavigateToString(htmlContent);
}));

this.documentationBrowser.CoreWebView2.WebMessageReceived += CoreWebView2OnWebMessageReceived;
}

private void CoreWebView2OnWebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
{
var message = e.TryGetWebMessageAsString();
if (string.Equals(message, "insert"))
{
// Insert the graph inside the current worskspace
this.viewModel.InsertGraph();
}
}

/// <summary>
Expand Down
Loading

0 comments on commit ef6b0c1

Please sign in to comment.