|
|
@@ -1,7 +1,7 @@
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
-import { withTranslation } from 'react-i18next';
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
import AppContainer from '~/client/services/AppContainer';
|
|
|
@@ -424,12 +424,29 @@ class PageEditorByHackmd extends React.Component {
|
|
|
|
|
|
}
|
|
|
|
|
|
+PageEditorByHackmd.propTypes = {
|
|
|
+ t: PropTypes.func.isRequired, // i18next
|
|
|
+
|
|
|
+ appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
+ pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
|
+ editorContainer: PropTypes.instanceOf(EditorContainer).isRequired,
|
|
|
+
|
|
|
+ // TODO: remove this when omitting unstated is completed
|
|
|
+ editorMode: PropTypes.string.isRequired,
|
|
|
+ isSlackEnabled: PropTypes.bool.isRequired,
|
|
|
+ slackChannels: PropTypes.string.isRequired,
|
|
|
+ grant: PropTypes.number.isRequired,
|
|
|
+ grantGroupId: PropTypes.string,
|
|
|
+ grantGroupName: PropTypes.string,
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* Wrapper component for using unstated
|
|
|
*/
|
|
|
const PageEditorByHackmdHOCWrapper = withUnstatedContainers(PageEditorByHackmd, [AppContainer, PageContainer, EditorContainer]);
|
|
|
|
|
|
const PageEditorByHackmdWrapper = (props) => {
|
|
|
+ const { t } = useTranslation();
|
|
|
const { data: editorMode } = useEditorMode();
|
|
|
const { data: currentPagePath } = useCurrentPagePath();
|
|
|
const { data: slackChannelsData } = useSWRxSlackChannels(currentPagePath);
|
|
|
@@ -445,6 +462,7 @@ const PageEditorByHackmdWrapper = (props) => {
|
|
|
return (
|
|
|
<PageEditorByHackmdHOCWrapper
|
|
|
{...props}
|
|
|
+ t={t}
|
|
|
editorMode={editorMode}
|
|
|
isSlackEnabled={isSlackEnabled}
|
|
|
slackChannels={slackChannelsData.toString()}
|
|
|
@@ -455,20 +473,4 @@ const PageEditorByHackmdWrapper = (props) => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-PageEditorByHackmd.propTypes = {
|
|
|
- t: PropTypes.func.isRequired, // i18next
|
|
|
-
|
|
|
- appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
- pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
|
- editorContainer: PropTypes.instanceOf(EditorContainer).isRequired,
|
|
|
-
|
|
|
- // TODO: remove this when omitting unstated is completed
|
|
|
- editorMode: PropTypes.string.isRequired,
|
|
|
- isSlackEnabled: PropTypes.bool.isRequired,
|
|
|
- slackChannels: PropTypes.string.isRequired,
|
|
|
- grant: PropTypes.number.isRequired,
|
|
|
- grantGroupId: PropTypes.string,
|
|
|
- grantGroupName: PropTypes.string,
|
|
|
-};
|
|
|
-
|
|
|
-export default withTranslation()(PageEditorByHackmdWrapper);
|
|
|
+export default PageEditorByHackmdWrapper;
|