Skip to content

Commit

Permalink
Merge pull request #284 from MartinZikmund/feature/workaround-webview2
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund authored Aug 11, 2024
2 parents 33f6902 + ab3c811 commit 0762ddb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<Project>
<!-- Workaround for https://github.com/unoplatform/uno/issues/17910 -->
<Target Name="ResolveWebView2CoreDuplicates1" BeforeTargets="_ComputeResolvedFilesToPublishTypes" AfterTargets="ComputeFilesToPublish" />
<Target Name="ResolveWebView2CoreDuplicates2" BeforeTargets="_ComputeResolvedFilesToPublishTypes" AfterTargets="ComputeFilesToPublish" />
</Project>
25 changes: 25 additions & 0 deletions src/app/MZikmund.App/Assets/PostPreviewTemplate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="{ACTUALTHEME}">
<head>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet" href="https://mzikmund.dev/css/site.min.css" />
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
<script src="https://mzikmund.dev/js/site.js"></script>
</head>
<body>
<div b-mkd0nzmx6b class="container">
<main b-mkd0nzmx6b role="main" class="pb-4">
<article class="blog-post">

<div class="post-content">
{POSTCONTENT}
</div>
</article>
</main>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion src/app/MZikmund.App/Views/Admin/PostEditorView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public PostEditorView()
{
InitializeComponent();
// Read the template from the embedded resource
_postPreviewTemplate = typeof(PostEditorView).GetAssembly().GetManifestResourceStream("MZikmund.Assets.PostPreviewTemplate.html")?.ReadToEnd()!;
_postPreviewTemplate = typeof(PostEditorView).Assembly.GetManifestResourceStream("MZikmund.App.Assets.PostPreviewTemplate.html")!.ReadToEnd()!;
PreviewWebViewContainer.Content = _previewWebView = new WebView2();
this.Loaded += PostEditorView_Loaded;
this.Unloaded += PostEditorView_Unloaded;
Expand Down
2 changes: 1 addition & 1 deletion src/app/MZikmund.App/Views/PostView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public PostView()
{
InitializeComponent();
// Read the template from the embedded resource
_postPreviewTemplate = typeof(PostView).GetAssembly().GetManifestResourceStream("MZikmund.Assets.PostPreviewTemplate.html")?.ReadToEnd()!;
_postPreviewTemplate = typeof(PostView).Assembly.GetManifestResourceStream("MZikmund.App.Assets.PostPreviewTemplate.html")?.ReadToEnd()!;
PreviewWebViewContainer.Content = _previewWebView = new WebView2();
this.Loaded += PostEditorView_Loaded;
this.Unloaded += PostEditorView_Unloaded;
Expand Down

0 comments on commit 0762ddb

Please sign in to comment.