First mildly working WebTextBox... no syntax coloring yet

This commit is contained in:
Nikolaj Olsson 2020-11-22 16:19:55 +01:00
parent 9ff9940bcf
commit aa9ce640c9
2 changed files with 23 additions and 6 deletions

View File

@ -85,7 +85,6 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
}
else if (ch == '\n')
{
i++;
if (!isNewLine)
{
sb.Append(Environment.NewLine);
@ -205,7 +204,15 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
}
}
public int SelectionLength { get; set; }
public int SelectionLength
{
get => SelectedText.Length;
set
{
//TODO: fix
}
}
public bool HideSelection { get; set; }
public void SelectAll()
@ -299,13 +306,15 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
public void ClientClick()
{
MouseClick?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 1));
var mp = PointToClient(MousePosition);
MouseClick?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, mp.X, mp.Y, 1));
TextChanged?.Invoke(this, new KeyEventArgs(0));
}
public void ClientMouseMove()
{
MouseMove?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 1, 1, 1, 1));
var mp = PointToClient(MousePosition);
MouseMove?.Invoke(this, new MouseEventArgs(MouseButtons.None, 0, mp.X, mp.Y, 0));
}
internal int GetCharIndexFromPosition(Point pt)
@ -315,10 +324,17 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
public void Clear()
{
Text = string.Empty;
}
public void Undo()
{
if (Document == null)
{
return;
}
Document.ExecCommand("undo", false, null);
}
public void ClearUndo()

View File

@ -109,7 +109,7 @@
if (node.parentNode.parentNode.id === "myContent" && !node.parentNode.previousSibling) {
// skip first P
} else {
extraChar = 1;
extraChar = 2;
}
}
@ -130,6 +130,7 @@
if (node.nodeName === "P" && node.previousSibling) {
idx++;
idx++;
}
var res = getPreviousOrParentLastChild(node);