Browse Source

Merge branch 'master' into feature/txtBlockInlines

pull/9245/head
Benedikt Stebner 4 years ago
committed by GitHub
parent
commit
78d2baf072
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/Web/Avalonia.Web/AvaloniaView.cs
  2. 4
      src/Web/Avalonia.Web/webapp/modules/avalonia/dom.ts

12
src/Web/Avalonia.Web/AvaloniaView.cs

@ -77,8 +77,7 @@ namespace Avalonia.Web
_topLevelImpl.SetCssCursor = (cursor) => _topLevelImpl.SetCssCursor = (cursor) =>
{ {
InputHelper.SetCursor(_containerElement, cursor); // macOS InputHelper.SetCursor(_containerElement, cursor);
InputHelper.SetCursor(_canvas, cursor); // windows
}; };
_topLevel.Prepare(); _topLevel.Prepare();
@ -254,7 +253,14 @@ namespace Avalonia.Web
private bool OnKeyDown (string code, string key, int modifier) private bool OnKeyDown (string code, string key, int modifier)
{ {
return _topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, code, key, (RawInputModifiers)modifier); var handled = _topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, code, key, (RawInputModifiers)modifier);
if (!handled && key.Length == 1)
{
handled = _topLevelImpl.RawTextEvent(key);
}
return handled;
} }
private bool OnKeyUp(string code, string key, int modifier) private bool OnKeyUp(string code, string key, int modifier)

4
src/Web/Avalonia.Web/webapp/modules/avalonia/dom.ts

@ -24,7 +24,7 @@ export class AvaloniaDOM {
// Native controls host // Native controls host
const nativeHost = document.createElement("div"); const nativeHost = document.createElement("div");
canvas.id = `nativeHost${randomIdPart}`; nativeHost.id = `nativeHost${randomIdPart}`;
nativeHost.classList.add("avalonia-native-host"); nativeHost.classList.add("avalonia-native-host");
nativeHost.style.left = "0px"; nativeHost.style.left = "0px";
nativeHost.style.top = "0px"; nativeHost.style.top = "0px";
@ -34,7 +34,7 @@ export class AvaloniaDOM {
// IME // IME
const inputElement = document.createElement("input"); const inputElement = document.createElement("input");
canvas.id = `input${randomIdPart}`; inputElement.id = `inputElement${randomIdPart}`;
inputElement.classList.add("avalonia-input-element"); inputElement.classList.add("avalonia-input-element");
inputElement.autocapitalize = "none"; inputElement.autocapitalize = "none";
inputElement.type = "text"; inputElement.type = "text";

Loading…
Cancel
Save