Skip to content

Commit 7ff1506

Browse files
authored
Support for new XH.openInTab (#761)
1 parent 84b3868 commit 7ff1506

6 files changed

Lines changed: 15 additions & 12 deletions

File tree

client-app/src/admin/tests/fetch/TabPanels.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {hoistCmp} from '@xh/hoist/core';
1+
import {hoistCmp, XH} from '@xh/hoist/core';
22
import {Icon} from '@xh/hoist/icon';
33
import {hframe, vframe} from '@xh/hoist/cmp/layout';
44
import {button} from '@xh/hoist/desktop/cmp/button';
@@ -23,7 +23,7 @@ export const individualBtns = hoistCmp.factory<FetchApiTestModel>(({model}) =>
2323
}),
2424
button({
2525
icon: Icon.info(),
26-
onClick: () => window.open(`${model.referenceSite}${it.code}`),
26+
onClick: () => XH.openWindow(`${model.referenceSite}${it.code}`),
2727
minimal: false
2828
})
2929
]

client-app/src/desktop/tabs/examples/ExamplesTab.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {div, filler, frame, hframe, iframe} from '@xh/hoist/cmp/layout';
2-
import {creates, hoistCmp} from '@xh/hoist/core';
2+
import {creates, hoistCmp, XH} from '@xh/hoist/core';
33
import {button} from '@xh/hoist/desktop/cmp/button';
44
import {panel} from '@xh/hoist/desktop/cmp/panel';
55
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
@@ -86,12 +86,15 @@ const appTile = hoistCmp.factory<ExamplesTabModel>(({app, model}) => {
8686
text: 'Source',
8787
icon: Icon.code(),
8888
onClick: () =>
89-
window.open(toolboxUrl(`$TB/client-app/src/examples/${app.srcPath}`))
89+
XH.openWindow(
90+
toolboxUrl(`$TB/client-app/src/examples/${app.srcPath}`),
91+
'toolboxSource'
92+
)
9093
}),
9194
button({
9295
text: 'Full Tab',
9396
icon: Icon.openExternal(),
94-
onClick: () => window.open(`/${app.path}/`)
97+
onClick: () => XH.openWindow(`/${app.path}/`)
9598
})
9699
]
97100
}),
@@ -109,7 +112,7 @@ const sideBar = hoistCmp.factory<ExamplesTabModel>(({model}) => {
109112
icon: app.icon,
110113
active: isActive,
111114
onClick: () =>
112-
isActive ? window.open(app.path) : (model.activeApp = app.title)
115+
isActive ? XH.openWindow(app.path) : (model.activeApp = app.title)
113116
});
114117
}),
115118
filler(),

client-app/src/desktop/tabs/home/widgets/activity/ActivityWidgetModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ActivityWidgetModel extends HoistModel {
2828
tooltip: 'Open on Github',
2929
icon: Icon.icon({iconName: 'github', prefix: 'fab'}),
3030
displayFn: ({record}) => ({disabled: !record?.data?.url}),
31-
actionFn: ({record}) => window.open(record.data.url)
31+
actionFn: ({record}) => XH.openWindow(record.data.url, 'gitlink')
3232
};
3333

3434
this.gridModel = new GridModel({
@@ -181,7 +181,7 @@ export class ActivityWidgetModel extends HoistModel {
181181

182182
private onRowDoubleClicked = params => {
183183
const rec = params.data;
184-
if (rec?.isRecord) window.open(rec.data.url);
184+
if (rec?.isRecord) XH.openWindow(rec.data.url, 'gitlink');
185185
};
186186

187187
private setGroupBy(groupBy) {

client-app/src/desktop/tabs/home/widgets/roadmap/RoadmapViewItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function getGitIcon(gitLinks) {
116116
gitIcon = Icon.icon({iconName: 'github', prefix: 'fab', size: '2x'});
117117

118118
if (gitLinksList.length === 1) {
119-
return button({icon: gitIcon, onClick: () => window.open(gitLinksList[0])});
119+
return button({icon: gitIcon, onClick: () => XH.openWindow(gitLinksList[0], 'gitlink')});
120120
} else {
121121
return popover({
122122
minimal: true,
@@ -133,7 +133,7 @@ function getGitMenuItems(gitLinks) {
133133
return menuItem({
134134
text: link,
135135
icon: Icon.icon({iconName: 'github', prefix: 'fab'}),
136-
onClick: () => window.open(link)
136+
onClick: () => XH.openWindow(link, 'gitlink')
137137
});
138138
});
139139
}

client-app/src/desktop/tabs/mobile/MobileTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const mobileTab = hoistCmp.factory(() =>
6161
text: 'Open Toolbox Mobile in this browser',
6262
icon: Icon.mobile(),
6363
minimal: false,
64-
onClick: () => window.open('/mobile')
64+
onClick: () => XH.openWindow('/mobile')
6565
}),
6666
filler()
6767
],

client-app/src/examples/news/NewsPanelModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ export class NewsPanelModel extends HoistModel {
8181

8282
private onRowDoubleClicked({data: record}) {
8383
const url = record.get('url');
84-
if (url) window.open(url, '_blank');
84+
if (url) XH.openWindow(url, 'tb-news');
8585
}
8686
}

0 commit comments

Comments
 (0)