PteroTheme/resources/scripts/components/server/files/FileEditContainer.tsx

24 lines
664 B
TypeScript
Raw Normal View History

2019-10-19 23:31:02 +01:00
import React, { lazy } from 'react';
import { ServerContext } from '@/state/server';
2019-10-12 23:29:45 +01:00
2019-10-19 23:31:02 +01:00
const LazyAceEditor = lazy(() => import(/* webpackChunkName: "editor" */'@/components/elements/AceEditor'));
2019-08-17 19:40:51 +01:00
export default () => {
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
2019-10-19 23:31:02 +01:00
let ref: null| (() => Promise<string>) = null;
2019-10-12 23:29:45 +01:00
2019-10-19 23:31:02 +01:00
setTimeout(() => ref && ref().then(console.log), 5000);
2019-08-17 19:40:51 +01:00
return (
<div className={'my-10'}>
2019-10-19 23:31:02 +01:00
<LazyAceEditor
fetchContent={value => {
ref = value;
}}
onContentSaved={() => null}
/>
2019-08-17 19:40:51 +01:00
</div>
);
};