|
@@ -28,10 +28,12 @@ import PageAttachment from './components/PageAttachment';
|
|
|
import PageStatusAlert from './components/PageStatusAlert';
|
|
import PageStatusAlert from './components/PageStatusAlert';
|
|
|
import RecentCreated from './components/RecentCreated/RecentCreated';
|
|
import RecentCreated from './components/RecentCreated/RecentCreated';
|
|
|
import MyDraftList from './components/MyDraftList/MyDraftList';
|
|
import MyDraftList from './components/MyDraftList/MyDraftList';
|
|
|
-import UserPictureList from './components/User/UserPictureList';
|
|
|
|
|
|
|
+import SeenUserList from './components/User/SeenUserList';
|
|
|
|
|
+import LikerList from './components/User/LikerList';
|
|
|
import TableOfContents from './components/TableOfContents';
|
|
import TableOfContents from './components/TableOfContents';
|
|
|
|
|
|
|
|
import PersonalSettings from './components/Me/PersonalSettings';
|
|
import PersonalSettings from './components/Me/PersonalSettings';
|
|
|
|
|
+import NavigationContainer from './services/NavigationContainer';
|
|
|
import PageContainer from './services/PageContainer';
|
|
import PageContainer from './services/PageContainer';
|
|
|
import CommentContainer from './services/CommentContainer';
|
|
import CommentContainer from './services/CommentContainer';
|
|
|
import EditorContainer from './services/EditorContainer';
|
|
import EditorContainer from './services/EditorContainer';
|
|
@@ -40,21 +42,24 @@ import GrowiSubNavigation from './components/Navbar/GrowiSubNavigation';
|
|
|
import GrowiSubNavigationForUserPage from './components/Navbar/GrowiSubNavigationForUserPage';
|
|
import GrowiSubNavigationForUserPage from './components/Navbar/GrowiSubNavigationForUserPage';
|
|
|
import PersonalContainer from './services/PersonalContainer';
|
|
import PersonalContainer from './services/PersonalContainer';
|
|
|
|
|
|
|
|
-import { appContainer, componentMappings } from './bootstrap';
|
|
|
|
|
|
|
+import { appContainer, componentMappings } from './base';
|
|
|
|
|
|
|
|
-const logger = loggerFactory('growi:app');
|
|
|
|
|
|
|
+const logger = loggerFactory('growi:cli:app');
|
|
|
|
|
+
|
|
|
|
|
+appContainer.initContents();
|
|
|
|
|
|
|
|
const { i18n } = appContainer;
|
|
const { i18n } = appContainer;
|
|
|
const websocketContainer = appContainer.getContainer('WebsocketContainer');
|
|
const websocketContainer = appContainer.getContainer('WebsocketContainer');
|
|
|
|
|
|
|
|
// create unstated container instance
|
|
// create unstated container instance
|
|
|
|
|
+const navigationContainer = new NavigationContainer(appContainer);
|
|
|
const pageContainer = new PageContainer(appContainer);
|
|
const pageContainer = new PageContainer(appContainer);
|
|
|
const commentContainer = new CommentContainer(appContainer);
|
|
const commentContainer = new CommentContainer(appContainer);
|
|
|
const editorContainer = new EditorContainer(appContainer, defaultEditorOptions, defaultPreviewOptions);
|
|
const editorContainer = new EditorContainer(appContainer, defaultEditorOptions, defaultPreviewOptions);
|
|
|
const tagContainer = new TagContainer(appContainer);
|
|
const tagContainer = new TagContainer(appContainer);
|
|
|
const personalContainer = new PersonalContainer(appContainer);
|
|
const personalContainer = new PersonalContainer(appContainer);
|
|
|
const injectableContainers = [
|
|
const injectableContainers = [
|
|
|
- appContainer, websocketContainer, pageContainer, commentContainer, editorContainer, tagContainer, personalContainer,
|
|
|
|
|
|
|
+ appContainer, websocketContainer, navigationContainer, pageContainer, commentContainer, editorContainer, tagContainer, personalContainer,
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
logger.info('unstated containers have been initialized');
|
|
logger.info('unstated containers have been initialized');
|
|
@@ -70,11 +75,7 @@ Object.assign(componentMappings, {
|
|
|
// 'revision-history': <PageHistory pageId={pageId} />,
|
|
// 'revision-history': <PageHistory pageId={pageId} />,
|
|
|
'tags-page': <TagsList crowi={appContainer} />,
|
|
'tags-page': <TagsList crowi={appContainer} />,
|
|
|
|
|
|
|
|
- 'page-editor': <PageEditor />,
|
|
|
|
|
- 'page-editor-path-nav': <PagePathNavForEditor />,
|
|
|
|
|
- 'page-editor-options-selector': <OptionsSelector crowi={appContainer} />,
|
|
|
|
|
'page-status-alert': <PageStatusAlert />,
|
|
'page-status-alert': <PageStatusAlert />,
|
|
|
- 'save-page-controls': <SavePageControls />,
|
|
|
|
|
|
|
|
|
|
'trash-page-alert': <TrashPageAlert />,
|
|
'trash-page-alert': <TrashPageAlert />,
|
|
|
|
|
|
|
@@ -86,16 +87,15 @@ Object.assign(componentMappings, {
|
|
|
// additional definitions if data exists
|
|
// additional definitions if data exists
|
|
|
if (pageContainer.state.pageId != null) {
|
|
if (pageContainer.state.pageId != null) {
|
|
|
Object.assign(componentMappings, {
|
|
Object.assign(componentMappings, {
|
|
|
- 'page-editor-with-hackmd': <PageEditorByHackmd />,
|
|
|
|
|
'page-comments-list': <PageComments />,
|
|
'page-comments-list': <PageComments />,
|
|
|
- 'page-attachment': <PageAttachment />,
|
|
|
|
|
'page-comment-write': <CommentEditorLazyRenderer />,
|
|
'page-comment-write': <CommentEditorLazyRenderer />,
|
|
|
|
|
+ 'page-attachment': <PageAttachment />,
|
|
|
'page-management': <PageManagement />,
|
|
'page-management': <PageManagement />,
|
|
|
'page-share-management': <PageShareManagement />,
|
|
'page-share-management': <PageShareManagement />,
|
|
|
|
|
|
|
|
'revision-toc': <TableOfContents />,
|
|
'revision-toc': <TableOfContents />,
|
|
|
- 'seen-user-list': <UserPictureList userIds={pageContainer.state.seenUserIds} />,
|
|
|
|
|
- 'liker-list': <UserPictureList userIds={pageContainer.state.likerUserIds} />,
|
|
|
|
|
|
|
+ 'seen-user-list': <SeenUserList />,
|
|
|
|
|
+ 'liker-list': <LikerList />,
|
|
|
|
|
|
|
|
'user-created-list': <RecentCreated />,
|
|
'user-created-list': <RecentCreated />,
|
|
|
'user-draft-list': <MyDraftList />,
|
|
'user-draft-list': <MyDraftList />,
|
|
@@ -109,6 +109,20 @@ if (pageContainer.state.path != null) {
|
|
|
'grw-subnav-for-user-page': <GrowiSubNavigationForUserPage />,
|
|
'grw-subnav-for-user-page': <GrowiSubNavigationForUserPage />,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+// additional definitions if user is logged in
|
|
|
|
|
+if (appContainer.currentUser != null) {
|
|
|
|
|
+ Object.assign(componentMappings, {
|
|
|
|
|
+ 'page-editor': <PageEditor />,
|
|
|
|
|
+ 'page-editor-path-nav': <PagePathNavForEditor />,
|
|
|
|
|
+ 'page-editor-options-selector': <OptionsSelector crowi={appContainer} />,
|
|
|
|
|
+ 'save-page-controls': <SavePageControls />,
|
|
|
|
|
+ });
|
|
|
|
|
+ if (pageContainer.state.pageId != null) {
|
|
|
|
|
+ Object.assign(componentMappings, {
|
|
|
|
|
+ 'page-editor-with-hackmd': <PageEditorByHackmd />,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
Object.keys(componentMappings).forEach((key) => {
|
|
Object.keys(componentMappings).forEach((key) => {
|
|
|
const elem = document.getElementById(key);
|
|
const elem = document.getElementById(key);
|