|
@@ -11,6 +11,7 @@ import {
|
|
|
|
|
|
|
|
import path from 'path';
|
|
import path from 'path';
|
|
|
import validator from 'validator';
|
|
import validator from 'validator';
|
|
|
|
|
+import { withTranslation } from 'react-i18next';
|
|
|
import PreviewWithSuspense from './PreviewWithSuspense';
|
|
import PreviewWithSuspense from './PreviewWithSuspense';
|
|
|
import PagePreviewIcon from '../Icons/PagePreviewIcon';
|
|
import PagePreviewIcon from '../Icons/PagePreviewIcon';
|
|
|
|
|
|
|
@@ -147,6 +148,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async setMarkdown() {
|
|
async setMarkdown() {
|
|
|
|
|
+ const { t } = this.props;
|
|
|
const path = this.state.linkInputValue;
|
|
const path = this.state.linkInputValue;
|
|
|
let markdown = '';
|
|
let markdown = '';
|
|
|
let previewError = '';
|
|
let previewError = '';
|
|
@@ -168,7 +170,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- previewError = `'${path}' is not a GROWI page.`;
|
|
|
|
|
|
|
+ previewError = t('link_edit.page_not_found_in_preview', path);
|
|
|
}
|
|
}
|
|
|
this.setState({ markdown, previewError, permalink });
|
|
this.setState({ markdown, previewError, permalink });
|
|
|
}
|
|
}
|
|
@@ -283,20 +285,21 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
renderLinkAndLabelForm() {
|
|
renderLinkAndLabelForm() {
|
|
|
|
|
+ const { t } = this.props;
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- <h3 className="grw-modal-head">Set link and label</h3>
|
|
|
|
|
|
|
+ <h3 className="grw-modal-head">{t('Set link and label')}</h3>
|
|
|
<form className="form-group">
|
|
<form className="form-group">
|
|
|
<div className="form-gorup my-3">
|
|
<div className="form-gorup my-3">
|
|
|
<div className="input-group flex-nowrap">
|
|
<div className="input-group flex-nowrap">
|
|
|
<div className="input-group-prepend">
|
|
<div className="input-group-prepend">
|
|
|
- <span className="input-group-text">link</span>
|
|
|
|
|
|
|
+ <span className="input-group-text">{t('link')}</span>
|
|
|
</div>
|
|
</div>
|
|
|
<SearchTypeahead
|
|
<SearchTypeahead
|
|
|
onChange={this.handleChangeTypeahead}
|
|
onChange={this.handleChangeTypeahead}
|
|
|
onInputChange={this.handleChangeLinkInput}
|
|
onInputChange={this.handleChangeLinkInput}
|
|
|
inputName="link"
|
|
inputName="link"
|
|
|
- placeholder="Input page path or URL"
|
|
|
|
|
|
|
+ placeholder={t('Input page path or URL')}
|
|
|
keywordOnInit={this.state.linkInputValue}
|
|
keywordOnInit={this.state.linkInputValue}
|
|
|
behaviorOfResetBtn="clear"
|
|
behaviorOfResetBtn="clear"
|
|
|
autoFocus
|
|
autoFocus
|
|
@@ -335,11 +338,12 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
renderPathFormatForm() {
|
|
renderPathFormatForm() {
|
|
|
|
|
+ const { t } = this.props;
|
|
|
return (
|
|
return (
|
|
|
<div className="card well pt-3">
|
|
<div className="card well pt-3">
|
|
|
<form className="form-group mb-0">
|
|
<form className="form-group mb-0">
|
|
|
<div className="form-group row">
|
|
<div className="form-group row">
|
|
|
- <label className="col-sm-3">Path format</label>
|
|
|
|
|
|
|
+ <label className="col-sm-3">{t('Path format')}</label>
|
|
|
<div className="col-sm-9">
|
|
<div className="col-sm-9">
|
|
|
<div className="custom-control custom-checkbox custom-checkbox-info custom-control-inline">
|
|
<div className="custom-control custom-checkbox custom-checkbox-info custom-control-inline">
|
|
|
<input
|
|
<input
|
|
@@ -351,7 +355,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
disabled={!this.state.linkInputValue.startsWith('/') || this.state.linkerType === Linker.types.growiLink}
|
|
disabled={!this.state.linkInputValue.startsWith('/') || this.state.linkerType === Linker.types.growiLink}
|
|
|
/>
|
|
/>
|
|
|
<label className="custom-control-label" htmlFor="relativePath">
|
|
<label className="custom-control-label" htmlFor="relativePath">
|
|
|
- Use relative path
|
|
|
|
|
|
|
+ {t('Use relative path')}
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="custom-control custom-checkbox custom-checkbox-info custom-control-inline">
|
|
<div className="custom-control custom-checkbox custom-checkbox-info custom-control-inline">
|
|
@@ -364,7 +368,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
disabled={this.state.permalink === '' || this.state.linkerType === Linker.types.growiLink}
|
|
disabled={this.state.permalink === '' || this.state.linkerType === Linker.types.growiLink}
|
|
|
/>
|
|
/>
|
|
|
<label className="custom-control-label" htmlFor="permanentLink">
|
|
<label className="custom-control-label" htmlFor="permanentLink">
|
|
|
- Use permanent link
|
|
|
|
|
|
|
+ {t('Use permanent link')}
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -395,7 +399,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
onChange={e => this.handleSelecteLinkerType(e.target.value)}
|
|
onChange={e => this.handleSelecteLinkerType(e.target.value)}
|
|
|
/>
|
|
/>
|
|
|
<label className="custom-control-label" htmlFor="growiType">
|
|
<label className="custom-control-label" htmlFor="growiType">
|
|
|
- Growi original
|
|
|
|
|
|
|
+ {t('Growi original')}
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
{this.isApplyPukiwikiLikeLinkerPlugin && (
|
|
{this.isApplyPukiwikiLikeLinkerPlugin && (
|
|
@@ -421,10 +425,11 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
+ const { t } = this.props;
|
|
|
return (
|
|
return (
|
|
|
<Modal className="link-edit-modal" isOpen={this.state.show} toggle={this.cancel} size="lg" autoFocus={false}>
|
|
<Modal className="link-edit-modal" isOpen={this.state.show} toggle={this.cancel} size="lg" autoFocus={false}>
|
|
|
<ModalHeader tag="h4" toggle={this.cancel} className="bg-primary text-light">
|
|
<ModalHeader tag="h4" toggle={this.cancel} className="bg-primary text-light">
|
|
|
- Edit Links
|
|
|
|
|
|
|
+ {t('Edit Links')}
|
|
|
</ModalHeader>
|
|
</ModalHeader>
|
|
|
|
|
|
|
|
<ModalBody className="container">
|
|
<ModalBody className="container">
|
|
@@ -436,17 +441,17 @@ class LinkEditModal extends React.PureComponent {
|
|
|
</div>
|
|
</div>
|
|
|
<div className="row">
|
|
<div className="row">
|
|
|
<div className="col-12">
|
|
<div className="col-12">
|
|
|
- <h3 className="grw-modal-head">Preview</h3>
|
|
|
|
|
|
|
+ <h3 className="grw-modal-head">{t('Preview')}</h3>
|
|
|
{this.renderLinkPreview()}
|
|
{this.renderLinkPreview()}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="row">
|
|
<div className="row">
|
|
|
<div className="col-12 text-center">
|
|
<div className="col-12 text-center">
|
|
|
<button type="button" className="btn btn-sm btn-outline-secondary mx-1" onClick={this.hide}>
|
|
<button type="button" className="btn btn-sm btn-outline-secondary mx-1" onClick={this.hide}>
|
|
|
- Cancel
|
|
|
|
|
|
|
+ {t('Cancel')}
|
|
|
</button>
|
|
</button>
|
|
|
<button type="submit" className="btn btn-sm btn-primary mx-1" onClick={this.save}>
|
|
<button type="submit" className="btn btn-sm btn-primary mx-1" onClick={this.save}>
|
|
|
- Done
|
|
|
|
|
|
|
+ {t('Done')}
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -458,6 +463,7 @@ class LinkEditModal extends React.PureComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
LinkEditModal.propTypes = {
|
|
LinkEditModal.propTypes = {
|
|
|
|
|
+ t: PropTypes.func.isRequired,
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
|
onSave: PropTypes.func,
|
|
onSave: PropTypes.func,
|
|
@@ -468,4 +474,4 @@ LinkEditModal.propTypes = {
|
|
|
*/
|
|
*/
|
|
|
const LinkEditModalWrapper = withUnstatedContainers(LinkEditModal, [AppContainer, PageContainer]);
|
|
const LinkEditModalWrapper = withUnstatedContainers(LinkEditModal, [AppContainer, PageContainer]);
|
|
|
|
|
|
|
|
-export default LinkEditModalWrapper;
|
|
|
|
|
|
|
+export default withTranslation('translation', { withRef: true })(LinkEditModalWrapper);
|