Skip to content

Commit 1b4115d

Browse files
expose SETTINGS_CONTEXT, COMPONENT_CONTEXT, DATACORE_CONTEXT and APP_CONTEXT in the local api
1 parent 1e5857f commit 1b4115d

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/api/local-api.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ import * as hooks from "preact/hooks";
1616
import { Result } from "./result";
1717
import { Group, Stack } from "./ui/layout";
1818
import { Embed, LineSpanEmbed } from "api/ui/embed";
19-
import { CURRENT_FILE_CONTEXT, Lit, Markdown, ObsidianLink } from "ui/markdown";
19+
import {
20+
APP_CONTEXT,
21+
COMPONENT_CONTEXT,
22+
CURRENT_FILE_CONTEXT,
23+
DATACORE_CONTEXT,
24+
Lit,
25+
Markdown,
26+
ObsidianLink,
27+
SETTINGS_CONTEXT,
28+
} from "ui/markdown";
2029
import { CSSProperties } from "preact/compat";
2130
import { Literal } from "expression/literal";
2231
import { Button, Checkbox, Icon, Slider, Switch, Textbox, VanillaSelect } from "./ui/basics";
@@ -170,6 +179,26 @@ export class DatacoreLocalApi {
170179
await completeTask(completed, task, this.app.vault, this.core);
171180
}
172181

182+
//////////////
183+
// Contexts //
184+
//////////////
185+
186+
// export the necessary contexts to enable rendering
187+
// datacore components outside the datacore plugin
188+
// itself
189+
get SETTINGS_CONTEXT(): typeof SETTINGS_CONTEXT {
190+
return SETTINGS_CONTEXT;
191+
}
192+
get COMPONENT_CONTEXT(): typeof COMPONENT_CONTEXT {
193+
return COMPONENT_CONTEXT;
194+
}
195+
get DATACORE_CONTEXT(): typeof DATACORE_CONTEXT {
196+
return DATACORE_CONTEXT;
197+
}
198+
get APP_CONTEXT(): typeof APP_CONTEXT {
199+
return APP_CONTEXT;
200+
}
201+
173202
/////////////
174203
// Hooks //
175204
/////////////

0 commit comments

Comments
 (0)