mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
First mildly working WebTextBox... no syntax coloring yet
This commit is contained in:
parent
9ff9940bcf
commit
aa9ce640c9
@ -81,11 +81,10 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
|
||||
var ch = text[i];
|
||||
if (ch == '\r')
|
||||
{
|
||||
//continue
|
||||
//continue
|
||||
}
|
||||
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()
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user