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-21 03:55:11 +00:00
|
|
|
import { I18nextProvider } from 'react-i18next';
|
|
|
|
import i18n from './_i18n/i18n-sdoc-editor';
|
2023-04-27 02:36:49 +00:00
|
|
|
import { Utils } from './utils/utils';
|
2023-05-09 12:32:29 +00:00
|
|
|
import Loading from './components/loading';
|
2023-10-26 09:15:42 +00:00
|
|
|
import SdocEditor from './pages/sdoc/sdoc-editor';
|
2023-04-17 07:32:52 +00:00
|
|
|
|
2023-11-17 05:00:30 +00:00
|
|
|
const { serviceURL, avatarURL, siteRoot, lang, mediaUrl } = window.app.config;
|
2023-04-23 08:54:59 +00:00
|
|
|
const { username, name } = window.app.userInfo;
|
2023-05-06 04:28:43 +00:00
|
|
|
const {
|
|
|
|
repoID, repoName, parentDir, filePerm,
|
2023-07-06 06:56:31 +00:00
|
|
|
docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, assetsUrl,
|
2023-09-28 07:13:25 +00:00
|
|
|
isSdocRevision, isPublished, originFilename, revisionCreatedAt, originFileVersion,
|
2023-11-21 05:53:40 +00:00
|
|
|
originFilePath, originDocUuid, revisionId, isFreezed
|
2023-05-06 04:28:43 +00:00
|
|
|
} = 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-05-09 12:32:29 +00:00
|
|
|
parentFolderURL: `${siteRoot}library/${repoID}/${Utils.encodePath(repoName + parentDir)}`,
|
2023-05-13 07:34:41 +00:00
|
|
|
assetsUrl,
|
2023-05-22 10:26:56 +00:00
|
|
|
isShowInternalLink: true,
|
2023-07-06 06:56:31 +00:00
|
|
|
isStarIconShown: true, // for star/unstar
|
2023-07-06 09:47:24 +00:00
|
|
|
isSdocRevision,
|
|
|
|
isPublished,
|
2023-07-07 08:07:14 +00:00
|
|
|
originFilename,
|
2023-09-28 07:13:25 +00:00
|
|
|
originFileVersion,
|
|
|
|
originFilePath,
|
|
|
|
originDocUuid,
|
2023-07-07 08:07:14 +00:00
|
|
|
revisionCreatedAt,
|
2023-08-07 09:45:28 +00:00
|
|
|
lang,
|
2023-10-26 09:15:42 +00:00
|
|
|
revisionId,
|
2023-11-17 05:00:30 +00:00
|
|
|
mediaUrl,
|
2023-11-21 05:53:40 +00:00
|
|
|
isFreezed,
|
2023-04-17 07:32:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-21 03:55:11 +00:00
|
|
|
ReactDom.render(
|
|
|
|
<I18nextProvider i18n={ i18n } >
|
|
|
|
<Suspense fallback={<Loading />}>
|
2023-05-12 06:12:28 +00:00
|
|
|
<SdocEditor />
|
2023-04-21 03:55:11 +00:00
|
|
|
</Suspense>
|
|
|
|
</I18nextProvider>,
|
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|