2023-04-21 03:55:11 +00:00
|
|
|
import React, { Suspense } from 'react';
|
2023-04-17 07:32:52 +00:00
|
|
|
import ReactDom from 'react-dom';
|
2023-04-18 10:23:03 +00:00
|
|
|
import { SimpleEditor } from '@seafile/sdoc-editor';
|
2023-04-21 03:55:11 +00:00
|
|
|
import { I18nextProvider } from 'react-i18next';
|
|
|
|
import i18n from './_i18n/i18n-sdoc-editor';
|
|
|
|
import Loading from './components/loading';
|
2023-04-27 02:36:49 +00:00
|
|
|
import { Utils } from './utils/utils';
|
2023-04-17 07:32:52 +00:00
|
|
|
|
2023-04-27 02:36:49 +00:00
|
|
|
const { serviceURL, avatarURL, siteRoot } = window.app.config;
|
2023-04-23 08:54:59 +00:00
|
|
|
const { username, name } = window.app.userInfo;
|
2023-04-27 02:36:49 +00:00
|
|
|
const { repoID, docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, filePerm } = window.app.pageOptions;
|
2023-04-17 07:32:52 +00:00
|
|
|
|
2023-04-18 10:23:03 +00:00
|
|
|
window.seafile = {
|
|
|
|
repoID,
|
2023-04-17 07:32:52 +00:00
|
|
|
docPath,
|
|
|
|
docName,
|
|
|
|
docUuid,
|
2023-04-18 10:23:03 +00:00
|
|
|
isOpenSocket: true,
|
|
|
|
serviceUrl: serviceURL,
|
|
|
|
accessToken: seadocAccessToken,
|
|
|
|
sdocServer: seadocServerUrl,
|
2023-04-23 08:54:59 +00:00
|
|
|
name,
|
2023-04-21 03:55:11 +00:00
|
|
|
username,
|
2023-04-23 08:54:59 +00:00
|
|
|
avatarURL,
|
2023-04-27 02:36:49 +00:00
|
|
|
siteRoot,
|
|
|
|
docPerm: filePerm,
|
|
|
|
historyURL: Utils.generateHistoryURL(siteRoot, repoID, docPath),
|
2023-04-17 07:32:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-21 03:55:11 +00:00
|
|
|
ReactDom.render(
|
|
|
|
<I18nextProvider i18n={ i18n } >
|
|
|
|
<Suspense fallback={<Loading />}>
|
|
|
|
<SimpleEditor />
|
|
|
|
</Suspense>
|
|
|
|
</I18nextProvider>,
|
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|