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

Show document title in WebWindow #474

Merged
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
3 changes: 2 additions & 1 deletion src/shell/dotnet/Shell.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ regarding copyright ownership. Unless required by applicable law or agreed
to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions
and limitations under the License.</s:String></wpf:ResourceDictionary>
and limitations under the License.</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
11 changes: 10 additions & 1 deletion src/shell/dotnet/Shell/WebWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ private Task InitializeCoreWebView2(CoreWebView2 coreWebView)
{
coreWebView.NewWindowRequested += (sender, args) => OnNewWindowRequested(args);
coreWebView.WindowCloseRequested += (sender, args) => OnWindowCloseRequested(args);
coreWebView.NavigationStarting += (sender, args) => OnNavigationStarting(args);
coreWebView.NavigationStarting += (sender, args) => OnNavigationStarting(args);
coreWebView.DocumentTitleChanged += (sender, args) => OnDocumentTitleChanged(args);

return Task.CompletedTask;
}

private void OnDocumentTitleChanged(object args)
{
if (_options.Title == null)
{
Title = WebView.CoreWebView2.DocumentTitle;
}
}

private void OnNavigationStarting(CoreWebView2NavigationStartingEventArgs args)
{
if (_scriptsInjected)
Expand Down
2 changes: 1 addition & 1 deletion src/shell/dotnet/Shell/WebWindowOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class WebWindowOptions
public double? Width { get; set; }

public const double DefaultHeight = 450;
public const string DefaultTitle = "Compose Web Container";
public const string DefaultTitle = "ComposeUI Web Container";
public const string DefaultUrl = "about:blank";
public const double DefaultWidth = 800;
public const string ParameterName = nameof(WebWindowOptions);
Expand Down
Loading