|
@@ -6,6 +6,7 @@ import { withTranslation } from 'react-i18next';
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
|
|
|
|
|
import AppContainer from '../../../services/AppContainer';
|
|
import AppContainer from '../../../services/AppContainer';
|
|
|
|
|
+import MarkDownSettingContainer from '../../../services/MarkDownSettingContainer';
|
|
|
|
|
|
|
|
class WhiteListInput extends React.Component {
|
|
class WhiteListInput extends React.Component {
|
|
|
|
|
|
|
@@ -19,9 +20,28 @@ class WhiteListInput extends React.Component {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ renderTagValue() {
|
|
|
|
|
+ const { customizable, markDownSettingContainer } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ if (customizable) {
|
|
|
|
|
+ return markDownSettingContainer.state.tagWhiteList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return 'recommendedWhitelist.attrs';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ renderAttrValue() {
|
|
|
|
|
+ const { customizable, markDownSettingContainer } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ if (customizable) {
|
|
|
|
|
+ return markDownSettingContainer.state.attrWhiteList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return 'recommendedWhitelist.attrs';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
- const { t, customizable } = this.props;
|
|
|
|
|
- const { onChangeTagWhiteList, onChangeAttrWhiteList } = this.props;
|
|
|
|
|
|
|
+ const { t, customizable, markDownSettingContainer } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
@@ -30,16 +50,14 @@ class WhiteListInput extends React.Component {
|
|
|
{ t('markdown_setting.Tag names') }
|
|
{ t('markdown_setting.Tag names') }
|
|
|
{customizable && this.renderRecommendBtn()}
|
|
{customizable && this.renderRecommendBtn()}
|
|
|
</div>
|
|
</div>
|
|
|
- {/* TODO GW-304 fetch correct defaultValue */}
|
|
|
|
|
- <textarea className="form-control xss-list" name="recommendedTags" rows="6" cols="40" readOnly={!customizable} defaultValue="recommendedWhitelist.tags" onChange={(e) => { onChangeTagWhiteList(e.target.value) }} />
|
|
|
|
|
|
|
+ <textarea className="form-control xss-list" name="recommendedTags" rows="6" cols="40" readOnly={!customizable} value={this.renderTagValue()} onChange={(e) => { markDownSettingContainer.onChangeTagWhiteList(e.target.value) }} />
|
|
|
</div>
|
|
</div>
|
|
|
<div className="m-t-15">
|
|
<div className="m-t-15">
|
|
|
<div className="d-flex justify-content-between">
|
|
<div className="d-flex justify-content-between">
|
|
|
{ t('markdown_setting.Tag attributes') }
|
|
{ t('markdown_setting.Tag attributes') }
|
|
|
{customizable && this.renderRecommendBtn()}
|
|
{customizable && this.renderRecommendBtn()}
|
|
|
</div>
|
|
</div>
|
|
|
- {/* TODO GW-304 fetch correct defaultValue */}
|
|
|
|
|
- <textarea className="form-control xss-list" name="recommendedAttrs" rows="6" cols="40" readOnly={!customizable} defaultValue="recommendedWhitelist.attrs" onChange={(e) => { onChangeAttrWhiteList(e.target.value) }} />
|
|
|
|
|
|
|
+ <textarea className="form-control xss-list" name="recommendedAttrs" rows="6" cols="40" readOnly={!customizable} value={this.renderAttrValue()} onChange={(e) => { markDownSettingContainer.onChangeAttrWhiteList(e.target.value) }} />
|
|
|
</div>
|
|
</div>
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
@@ -48,16 +66,15 @@ class WhiteListInput extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const WhiteListWrapper = (props) => {
|
|
const WhiteListWrapper = (props) => {
|
|
|
- return createSubscribedElement(WhiteListInput, props, [AppContainer]);
|
|
|
|
|
|
|
+ return createSubscribedElement(WhiteListInput, props, [AppContainer, MarkDownSettingContainer]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
WhiteListInput.propTypes = {
|
|
WhiteListInput.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
|
|
+ markDownSettingContainer: PropTypes.instanceOf(MarkDownSettingContainer).isRequired,
|
|
|
|
|
|
|
|
customizable: PropTypes.bool.isRequired,
|
|
customizable: PropTypes.bool.isRequired,
|
|
|
- onChangeTagWhiteList: PropTypes.func,
|
|
|
|
|
- onChangeAttrWhiteList: PropTypes.func,
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default withTranslation()(WhiteListWrapper);
|
|
export default withTranslation()(WhiteListWrapper);
|