fix: initializeWorkspaceViewHandlersAndLoad not exposed in window

This commit is contained in:
lin onetwo 2023-12-28 01:36:01 +08:00
parent 0156e80bbd
commit d89d00d4cd
4 changed files with 14 additions and 4 deletions

View file

@ -73,11 +73,12 @@ export const ViewServiceIPCDescriptor = {
forEachView: ProxyPropertyType.Function,
getActiveBrowserView: ProxyPropertyType.Function,
getAllViewOfWorkspace: ProxyPropertyType.Function,
initializeWorkspaceViewHandlersAndLoad: ProxyPropertyType.Function,
getSharedWebPreferences: ProxyPropertyType.Function,
getView: ProxyPropertyType.Function,
getViewCount: ProxyPropertyType.Function,
getViewCurrentUrl: ProxyPropertyType.Function,
hideView: ProxyPropertyType.Function,
initializeWorkspaceViewHandlersAndLoad: ProxyPropertyType.Function,
realignActiveView: ProxyPropertyType.Function,
reloadActiveBrowserView: ProxyPropertyType.Function,
reloadViewsWebContents: ProxyPropertyType.Function,

View file

@ -245,8 +245,12 @@ export class Window implements IWindowService {
});
}
await this.updateWindowBackground(newWindow);
// This loading will wait for a while
await newWindow.loadURL(newWindowURL);
// Not loading main window (like sidebar and background) here. Only load wiki in browserView in the secondary window.
const isWindowToLoadURL = windowName !== WindowNames.secondary;
if (isWindowToLoadURL) {
// This loading will wait for a while
await newWindow.loadURL(newWindowURL);
}
await webContentLoadingPromise;
return newWindow;
}

View file

@ -211,7 +211,11 @@ export class WorkspaceView implements IWorkspaceViewService {
public async openWorkspaceWindowWithView(workspace: IWorkspace, configs?: { uri?: string }): Promise<void> {
const uriToOpen = configs?.uri ?? workspace.lastUrl ?? workspace.homeUrl;
logger.debug('Open workspace in new window. uriToOpen here will overwrite the decision in initializeWorkspaceViewHandlersAndLoad.', { id: workspace.id, uriToOpen, function: 'openWorkspaceWindowWithView' });
logger.debug('Open workspace in new window. uriToOpen here will overwrite the decision in initializeWorkspaceViewHandlersAndLoad.', {
id: workspace.id,
uriToOpen,
function: 'openWorkspaceWindowWithView',
});
const browserWindow = await this.windowService.open(WindowNames.secondary, undefined, undefined, true);
const sharedWebPreferences = await this.viewService.getSharedWebPreferences(workspace);
const view = await this.viewService.createViewAddToWindow(workspace, browserWindow, sharedWebPreferences);

View file

@ -88,6 +88,7 @@ export const WorkspaceViewServiceIPCDescriptor = {
initializeWorkspaceView: ProxyPropertyType.Function,
loadURL: ProxyPropertyType.Function,
openUrlInWorkspace: ProxyPropertyType.Function,
openWorkspaceWindowWithView: ProxyPropertyType.Function,
printTiddler: ProxyPropertyType.Function,
realignActiveWorkspace: ProxyPropertyType.Function,
removeWorkspaceView: ProxyPropertyType.Function,