|
@@ -13,7 +13,6 @@ namespace Avalonia.Controls
|
|
|
private TextPresenter? _presenter;
|
|
|
private bool _selectionChanged;
|
|
|
private bool _isInChange;
|
|
|
- private ITextInputMethodImpl? _im;
|
|
|
|
|
|
public override Visual TextViewVisual => _presenter!;
|
|
|
|
|
@@ -119,6 +118,7 @@ namespace Avalonia.Controls
|
|
|
if (_parent != null)
|
|
|
{
|
|
|
_parent.PropertyChanged -= OnParentPropertyChanged;
|
|
|
+ _parent.Tapped -= OnParentTapped;
|
|
|
}
|
|
|
|
|
|
_parent = parent;
|
|
@@ -126,11 +126,7 @@ namespace Avalonia.Controls
|
|
|
if (_parent != null)
|
|
|
{
|
|
|
_parent.PropertyChanged += OnParentPropertyChanged;
|
|
|
- _im = (_parent.VisualRoot as ITextInputMethodRoot)?.InputMethod;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _im = null;
|
|
|
+ _parent.Tapped += OnParentTapped;
|
|
|
}
|
|
|
|
|
|
var oldPresenter = _presenter;
|
|
@@ -154,6 +150,11 @@ namespace Avalonia.Controls
|
|
|
RaiseCursorRectangleChanged();
|
|
|
}
|
|
|
|
|
|
+ private void OnParentTapped(object? sender, Input.TappedEventArgs e)
|
|
|
+ {
|
|
|
+ RaiseInputPaneActivationRequested();
|
|
|
+ }
|
|
|
+
|
|
|
public override void SetPreeditText(string? preeditText) => SetPreeditText(preeditText, null);
|
|
|
|
|
|
public override void SetPreeditText(string? preeditText, int? cursorPos)
|
|
@@ -167,17 +168,6 @@ namespace Avalonia.Controls
|
|
|
_presenter.SetCurrentValue(TextPresenter.PreeditTextCursorPositionProperty, cursorPos);
|
|
|
}
|
|
|
|
|
|
- public override void ShowInputPanel()
|
|
|
- {
|
|
|
- base.ShowInputPanel();
|
|
|
-
|
|
|
- if (_parent is { } && _im is { })
|
|
|
- {
|
|
|
- _im.SetOptions(TextInputOptions.FromStyledElement(_parent));
|
|
|
- _im.SetClient(this);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private static string GetTextLineText(TextLine textLine)
|
|
|
{
|
|
|
if (textLine.Length == 0)
|