mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
[macos] fix bug 50590
This commit is contained in:
@ -137,6 +137,7 @@
|
||||
addObserverFor(CEFEventNameDocumentFragmentBuild, @selector(onCEFDocumentFragmentBuild:));
|
||||
addObserverFor(CEFEventNameDocumentFragmented, @selector(onCEFDocumentFragmented:));
|
||||
addObserverFor(CEFEventNameCertificatePreview, @selector(onCEFCertificatePreview:));
|
||||
addObserverFor(ASCEventNameChangedUITheme, @selector(onUIThemeChanged:));
|
||||
|
||||
if (_externalDelegate && [_externalDelegate respondsToSelector:@selector(onCommonViewDidLoad:)]) {
|
||||
[_externalDelegate onCommonViewDidLoad:self];
|
||||
@ -1684,6 +1685,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onUIThemeChanged:(NSNotification *)notification {
|
||||
if (notification && notification.userInfo) {
|
||||
NSDictionary * params = (NSDictionary *)notification.userInfo;
|
||||
std::wstring theme = [params[@"uitheme"] stdwstring];
|
||||
CAscApplicationManager * appManager = [NSAscApplicationWorker getAppManager];
|
||||
|
||||
for (ASCTabView * tab in self.tabsControl.tabs) {
|
||||
if (NSCefView * cefView = [self cefViewWithTab:tab]) {
|
||||
CCefView * cef = appManager->GetViewById((int)cefView.uuid);
|
||||
if (cef && cef->GetType() == cvwtEditor) {
|
||||
NSEditorApi::CAscExecCommandJS * pCommand = new NSEditorApi::CAscExecCommandJS;
|
||||
pCommand->put_FrameName(L"frameEditor");
|
||||
pCommand->put_Command(L"uitheme:changed");
|
||||
pCommand->put_Param(theme);
|
||||
|
||||
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent(ASC_MENU_EVENT_TYPE_CEF_EXECUTE_COMMAND_JS);
|
||||
pEvent->m_pData = pCommand;
|
||||
|
||||
[cefView apply:pEvent];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark ASCTabsControl Delegate
|
||||
|
||||
|
||||
@ -695,6 +695,23 @@ public:
|
||||
}];
|
||||
}
|
||||
}
|
||||
} else if (cmd.find(L"webapps:features") != std::wstring::npos) {
|
||||
CAscApplicationManager * appManager = [NSAscApplicationWorker getAppManager];
|
||||
CCefView * pCefView = appManager->GetViewById(senderId);
|
||||
|
||||
if (pCefView) {
|
||||
NSString * uiTheme = [[NSUserDefaults standardUserDefaults] valueForKey:ASCUserUITheme] ?: @"theme-classic-light";
|
||||
|
||||
NSEditorApi::CAscExecCommandJS * pCommand = new NSEditorApi::CAscExecCommandJS;
|
||||
pCommand->put_FrameName(L"frameEditor");
|
||||
pCommand->put_Command(L"uitheme:changed");
|
||||
pCommand->put_Param([uiTheme stdwstring]);
|
||||
|
||||
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent(ASC_MENU_EVENT_TYPE_CEF_EXECUTE_COMMAND_JS);
|
||||
pEvent->m_pData = pCommand;
|
||||
|
||||
pCefView->Apply(pEvent);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user