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

[DYN-2316] feature: consume librarie.js as npm package #15228

Merged
Show file tree
Hide file tree
Changes from 2 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
44 changes: 22 additions & 22 deletions src/LibraryViewExtensionWebView2/LibraryViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private string ReplaceUrlWithBase64Image(string html, string minifiedURL, bool m
{
minifiedURL = $"{magicstringprod}\"{minifiedURL}\"";
}
var searchString = minifiedURL.Replace(magicstringprod, @"./dist").Replace("\"", "");
var searchString = minifiedURL.Replace(magicstringprod, @"./dist/").Replace("\"", "");
var base64 = iconProvider.GetResourceAsString(searchString, out ext);
if (string.IsNullOrEmpty(base64))
{
Expand Down Expand Up @@ -287,23 +287,23 @@ private string ReplaceUrlWithBase64Image(string html, string minifiedURL, bool m
//list of resources which have paths embedded directly into the source.
private readonly Tuple<string, bool>[] dynamicResourcePaths = new Tuple<string, bool>[]
{
Tuple.Create("/resources/ArtifaktElement-Bold.woff",true),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the "/" is not needed?

Copy link
Contributor Author

@Enzo707 Enzo707 May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the "/" is not needed?

Because we changed the public path in package so the bundle has changed

Tuple.Create("/resources/ArtifaktElement-Regular.woff",true),
Tuple.Create("/resources/bin.svg",true),
Tuple.Create("/resources/default-icon.svg",true),
Tuple.Create("/resources/library-action.svg",true),
Tuple.Create("/resources/library-create.svg",true),
Tuple.Create("/resources/library-query.svg",true),
Tuple.Create("/resources/indent-arrow-category-down.svg",true),
Tuple.Create("/resources/indent-arrow-category-right.svg",true),
Tuple.Create("/resources/indent-arrow-down.svg",true),
Tuple.Create("/resources/indent-arrow-right.svg",true),
Tuple.Create("/resources/plus-symbol.svg",true),
Tuple.Create("/resources/search-detailed.svg",true),
Tuple.Create("/resources/search-filter.svg",true),
Tuple.Create("/resources/search-filter-selected.svg",true),
Tuple.Create("/resources/search-icon.svg",true),
Tuple.Create("/resources/search-icon-clear.svg",true)
Tuple.Create("resources/ArtifaktElement-Bold.woff",true),
Tuple.Create("resources/ArtifaktElement-Regular.woff",true),
Tuple.Create("resources/bin.svg",true),
Tuple.Create("resources/default-icon.svg",true),
Tuple.Create("resources/library-action.svg",true),
Tuple.Create("resources/library-create.svg",true),
Tuple.Create("resources/library-query.svg",true),
Tuple.Create("resources/indent-arrow-category-down.svg",true),
Tuple.Create("resources/indent-arrow-category-right.svg",true),
Tuple.Create("resources/indent-arrow-down.svg",true),
Tuple.Create("resources/indent-arrow-right.svg",true),
Tuple.Create("resources/plus-symbol.svg",true),
Tuple.Create("resources/search-detailed.svg",true),
Tuple.Create("resources/search-filter.svg",true),
Tuple.Create("resources/search-filter-selected.svg",true),
Tuple.Create("resources/search-icon.svg",true),
Tuple.Create("resources/search-icon-clear.svg",true)
};

async void InitializeAsync()
Expand Down Expand Up @@ -358,10 +358,10 @@ private void Browser_CoreWebView2InitializationCompleted(object sender, CoreWebV
LibraryView view = new LibraryView(model);

var lib_min_template = "LIBPLACEHOLDER";
var libHTMLURI = "Dynamo.LibraryViewExtensionWebView2.web.library.library.html";
var libHTMLURI = "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.library.html";
var stream = LoadResource(libHTMLURI);

var libMinURI = "Dynamo.LibraryViewExtensionWebView2.web.library.librarie.min.js";
var libMinURI = "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.build.librarie.min.js";
var libminstream = LoadResource(libMinURI);
var libminstring = "LIBJS";
var libraryHTMLPage = "LIBRARY HTML WAS NOT FOUND";
Expand Down Expand Up @@ -658,11 +658,11 @@ private static void NotifySearchModelUpdate(ILibraryViewCustomization customizat
/// <param name="customization"></param>
private void InitializeResourceProviders(DynamoModel model, LibraryViewCustomization customization)
{
var dllProvider = new DllResourceProvider("http://localhost/dist", "Dynamo.LibraryViewExtensionWebView2.web.library");
var dllProvider = new DllResourceProvider("http://localhost/dist", "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS");
iconProvider = new IconResourceProvider(model.PathManager, dllProvider, customization);
nodeProvider = new NodeItemDataProvider(model.SearchModel, iconProvider);
searchResultDataProvider = new SearchResultDataProvider(model.SearchModel, iconProvider);
layoutProvider = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionWebView2.web.library.layoutSpecs.json");
layoutProvider = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionWebView2.Packages.LibrarieJS.layoutSpecs.json");
}

private void DynamoSliderValueChanged(object sender, EventArgs e)
Expand Down
Loading
Loading