Skip to content

Commit f8b48a0

Browse files
Export executeAction and allow pathname to be passed in if wanted when opening new file
1 parent 91f0f8d commit f8b48a0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/misc/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { onRenderCallback } from "./profilerCallback";
2-
export { FileProvider } from "./fileContext";
2+
export { FileProvider, FileContext } from "./fileContext";
33
export { OutlineContext, OutlineProvider } from "./outlineContext";

src/ui/widgets/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export { TabContainer } from "./Tabs/tabContainer";
3636
export { DynamicTabs } from "./Tabs/dynamicTabs";
3737
export { XYPlot } from "./XYPlot/xyPlot";
3838
export { Webcam } from "./Webcam/webcam";
39+
export { executeAction } from "./widgetActions";
3940

4041
// By importing and calling this function you ensure all the
4142
// above widgets are imported and thus registered.

src/ui/widgets/widgetActions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ export const getActionDescription = (action: WidgetAction): string => {
120120
export const openPage = (
121121
action: DynamicAction,
122122
fileContext?: FileContextType,
123-
parentMacros?: MacroMap
123+
parentMacros?: MacroMap,
124+
pathname?: string
124125
): void => {
125126
const { location, file } = action.dynamicInfo;
126127
file.macros = {
127128
...(parentMacros ?? {}),
128129
...file.macros
129130
};
130-
fileContext?.addPage(location, file);
131+
fileContext?.addPage(location, file, pathname);
131132
};
132133

133134
export const closePage = (
@@ -163,12 +164,13 @@ export const executeAction = (
163164
action: WidgetAction,
164165
files?: FileContextType,
165166
exitContext?: ExitContextType,
166-
parentMacros?: MacroMap
167+
parentMacros?: MacroMap,
168+
pathname?: string
167169
): void => {
168170
switch (action.type) {
169171
case OPEN_PAGE:
170172
if (files) {
171-
openPage(action, files, parentMacros);
173+
openPage(action, files, parentMacros, pathname);
172174
} else {
173175
log.error("Tried to open a page but no file context passed");
174176
}

0 commit comments

Comments
 (0)