|
@@ -2,15 +2,35 @@ import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
import { withTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
|
+import loggerFactory from '@alias/logger';
|
|
|
|
|
+
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
|
|
+import { toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
|
|
import AppContainer from '../../../services/AppContainer';
|
|
import AppContainer from '../../../services/AppContainer';
|
|
|
import LineBreakForm from './LineBreakForm';
|
|
import LineBreakForm from './LineBreakForm';
|
|
|
import PresentationForm from './PresentationForm';
|
|
import PresentationForm from './PresentationForm';
|
|
|
import XssForm from './XssForm';
|
|
import XssForm from './XssForm';
|
|
|
|
|
+import AdminMarkDownContainer from '../../../services/AdminMarkDownContainer';
|
|
|
|
|
+
|
|
|
|
|
+const logger = loggerFactory('growi:MarkDown');
|
|
|
|
|
|
|
|
class MarkdownSetting extends React.Component {
|
|
class MarkdownSetting extends React.Component {
|
|
|
|
|
|
|
|
|
|
+ async componentDidMount() {
|
|
|
|
|
+ const { adminMarkDownContainer } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await adminMarkDownContainer.retrieveMarkdownData();
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ toastError(err);
|
|
|
|
|
+ adminMarkDownContainer.setState({ retrieveError: err });
|
|
|
|
|
+ logger.error(err);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
const { t } = this.props;
|
|
const { t } = this.props;
|
|
|
|
|
|
|
@@ -18,22 +38,22 @@ class MarkdownSetting extends React.Component {
|
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
|
{/* Line Break Setting */}
|
|
{/* Line Break Setting */}
|
|
|
<div className="row mb-5">
|
|
<div className="row mb-5">
|
|
|
- <h2 className="border-bottom">{ t('markdown_setting.line_break_setting') }</h2>
|
|
|
|
|
- <p className="well">{ t('markdown_setting.line_break_setting_desc') }</p>
|
|
|
|
|
|
|
+ <h2 className="border-bottom">{t('markdown_setting.line_break_setting')}</h2>
|
|
|
|
|
+ <p className="well">{t('markdown_setting.line_break_setting_desc')}</p>
|
|
|
<LineBreakForm />
|
|
<LineBreakForm />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{/* Presentation Setting */}
|
|
{/* Presentation Setting */}
|
|
|
<div className="row mb-5">
|
|
<div className="row mb-5">
|
|
|
- <h2 className="border-bottom">{ t('markdown_setting.presentation_setting') }</h2>
|
|
|
|
|
- <p className="well">{ t('markdown_setting.presentation_setting_desc') }</p>
|
|
|
|
|
|
|
+ <h2 className="border-bottom">{t('markdown_setting.presentation_setting')}</h2>
|
|
|
|
|
+ <p className="well">{t('markdown_setting.presentation_setting_desc')}</p>
|
|
|
<PresentationForm />
|
|
<PresentationForm />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{/* XSS Setting */}
|
|
{/* XSS Setting */}
|
|
|
<div className="row mb-5">
|
|
<div className="row mb-5">
|
|
|
- <h2 className="border-bottom">{ t('markdown_setting.XSS_setting') }</h2>
|
|
|
|
|
- <p className="well">{ t('markdown_setting.XSS_setting_desc') }</p>
|
|
|
|
|
|
|
+ <h2 className="border-bottom">{t('markdown_setting.XSS_setting')}</h2>
|
|
|
|
|
+ <p className="well">{t('markdown_setting.XSS_setting_desc')}</p>
|
|
|
<XssForm />
|
|
<XssForm />
|
|
|
</div>
|
|
</div>
|
|
|
</React.Fragment>
|
|
</React.Fragment>
|
|
@@ -43,12 +63,13 @@ class MarkdownSetting extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const MarkdownSettingWrapper = (props) => {
|
|
const MarkdownSettingWrapper = (props) => {
|
|
|
- return createSubscribedElement(MarkdownSetting, props, [AppContainer]);
|
|
|
|
|
|
|
+ return createSubscribedElement(MarkdownSetting, props, [AppContainer, AdminMarkDownContainer]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
MarkdownSetting.propTypes = {
|
|
MarkdownSetting.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
|
|
+ adminMarkDownContainer: PropTypes.instanceOf(AdminMarkDownContainer).isRequired,
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|