[ftb]: also toggle punc status when cn/en state changed
This commit is contained in:
1 parent
800d87ce7c
commit
10fa4e6edf
4 files changed
+45
-13
No files matched your search
@@ -946,6 +946,45 @@ void UpdateFtbCnEnState(ComPtr<ICoreWebView2> webview, int cnEnState)
|
||||
script.append(L"document.getElementById('cn').style.display = 'none';");
|
||||
script.append(L"document.getElementById('en').style.display = 'flex';");
|
||||
|
||||
webview->ExecuteScript(script.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 更新 floating toolbar 窗口的中英文切换状态和标点切换状态
|
||||
*
|
||||
* @param webview
|
||||
* @param cnEnState 1: 中文, 0: 英文
|
||||
*/
|
||||
void UpdateFtbCnEnAndPuncState(ComPtr<ICoreWebView2> webview, int cnEnState)
|
||||
{
|
||||
if (webview == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cnEnState == 1)
|
||||
{
|
||||
std::wstring script;
|
||||
script.reserve(256);
|
||||
|
||||
script.append(L"document.getElementById('cn').style.display = 'flex';");
|
||||
script.append(L"document.getElementById('en').style.display = 'none';");
|
||||
script.append(L"document.getElementById('puncCn').style.display = 'flex';");
|
||||
script.append(L"document.getElementById('puncEn').style.display = 'none';");
|
||||
|
||||
webview->ExecuteScript(script.c_str(), nullptr);
|
||||
}
|
||||
else if (cnEnState == 0)
|
||||
{
|
||||
std::wstring script;
|
||||
script.reserve(256);
|
||||
|
||||
script.append(L"document.getElementById('cn').style.display = 'none';");
|
||||
script.append(L"document.getElementById('en').style.display = 'flex';");
|
||||
script.append(L"document.getElementById('puncCn').style.display = 'none';");
|
||||
script.append(L"document.getElementById('puncEn').style.display = 'flex';");
|
||||
|
||||
webview->ExecuteScript(script.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user