|
1 | | -import type { CustomWorkspaces, NMRiumCore } from '@zakodium/nmrium-core'; |
| 1 | +import type { CustomWorkspaces } from '@zakodium/nmrium-core'; |
| 2 | +import init from '@zakodium/nmrium-core-plugins'; |
2 | 3 | import { useCallback, useEffect, useState } from 'react'; |
3 | 4 | import { ObjectInspector } from 'react-inspector'; |
4 | 5 |
|
5 | | -import { useCore } from '../../component/context/CoreContext.js'; |
6 | 6 | import type { NMRiumWorkspace } from '../../component/main/index.js'; |
7 | 7 | import { NMRium } from '../../component/main/index.js'; |
8 | 8 | import type { PageConfig } from '../layouts/Main.js'; |
9 | 9 |
|
10 | | -async function loadFromURL(core: NMRiumCore, url: string) { |
| 10 | +const core = init(); |
| 11 | + |
| 12 | +async function loadFromURL(url: string) { |
11 | 13 | const { pathname: relativePath, origin: baseURL } = new URL(url); |
12 | 14 | return core.readFromWebSource({ entries: [{ relativePath, baseURL }] }); |
13 | 15 | } |
@@ -36,12 +38,11 @@ export default function WebSourceView(props: WebSourceViewProps) { |
36 | 38 | const [callbackData, setCallbackData] = useState<any[]>([]); |
37 | 39 | const [isCallbackVisible, showCallback] = useState(false); |
38 | 40 |
|
39 | | - const core = useCore(); |
40 | 41 | useEffect(() => { |
41 | | - void loadFromURL(core, file).then((d) => { |
| 42 | + void loadFromURL(file).then((d) => { |
42 | 43 | setData(d as any); |
43 | 44 | }); |
44 | | - }, [baseURL, core, file, props]); |
| 45 | + }, [baseURL, file, props]); |
45 | 46 |
|
46 | 47 | const changeHandler = useCallback((logData) => { |
47 | 48 | setCallbackData((prevLogs) => { |
|
0 commit comments