mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Merge pull request #4532 from OmrSi/web-textbox-alignment
Fix center in RTL mode
This commit is contained in:
commit
896a33b5bf
@ -115,20 +115,13 @@ namespace Nikse.SubtitleEdit.Controls.WebBrowser
|
|||||||
Thread.Sleep(5);
|
Thread.Sleep(5);
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
_rightToLeft = Configuration.Settings.General.RightToLeftMode;
|
|
||||||
_center = Configuration.Settings.General.CenterSubtitleInTextBox;
|
_center = Configuration.Settings.General.CenterSubtitleInTextBox;
|
||||||
|
_rightToLeft = Configuration.Settings.General.RightToLeftMode;
|
||||||
|
|
||||||
var code = "left";
|
var align = _center ? "text-align:center" : string.Empty;
|
||||||
if (_rightToLeft)
|
var dir = _rightToLeft ? "rtl" : string.Empty;
|
||||||
{
|
|
||||||
code = "rtl";
|
|
||||||
}
|
|
||||||
else if (_center)
|
|
||||||
{
|
|
||||||
code = "center";
|
|
||||||
}
|
|
||||||
|
|
||||||
Document.InvokeScript("setTextDirection", new object[] { code });
|
Document.InvokeScript("setTextDirection", new object[] { align, dir });
|
||||||
}
|
}
|
||||||
|
|
||||||
Document.InvokeScript("setText", new object[] { value });
|
Document.InvokeScript("setText", new object[] { value });
|
||||||
|
@ -260,19 +260,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call with: rtl / center / left
|
// Call with: center / rtl
|
||||||
function setTextDirection(dir) {
|
function setTextDirection(align, dir) {
|
||||||
var element = document.getElementById("myContent");
|
var element = document.getElementById("myContent");
|
||||||
if (dir === "rtl") {
|
element.setAttribute("style", align);
|
||||||
element.setAttribute("dir", "rtl");
|
element.setAttribute("dir", dir);
|
||||||
element.setAttribute("style", "");
|
|
||||||
} else if (dir === "center") {
|
|
||||||
element.setAttribute("style", "text-align:center");
|
|
||||||
element.setAttribute("dir", "");
|
|
||||||
} else {
|
|
||||||
element.setAttribute("style", "");
|
|
||||||
element.setAttribute("dir", "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getText() {
|
function getText() {
|
||||||
|
Loading…
Reference in New Issue
Block a user