Use curry instead of partial
[MAILPOET-2455]
This commit is contained in:
committed by
Jack Kitterhing
parent
c0b3ccfecc
commit
1287152d0f
@@ -7,7 +7,7 @@ import {
|
|||||||
import { useSelect } from '@wordpress/data';
|
import { useSelect } from '@wordpress/data';
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
import ReactStringReplace from 'react-string-replace';
|
import ReactStringReplace from 'react-string-replace';
|
||||||
import _ from 'underscore';
|
import { curry } from 'lodash';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [copyAreaContent, setCopyAreaContent] = useState(null);
|
const [copyAreaContent, setCopyAreaContent] = useState(null);
|
||||||
@@ -17,7 +17,7 @@ export default () => {
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
const exportLinkClicked = (type, event) => {
|
const exportLinkClicked = curry((type, event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (type === 'php') {
|
if (type === 'php') {
|
||||||
return setCopyAreaContent(formExports.php);
|
return setCopyAreaContent(formExports.php);
|
||||||
@@ -26,7 +26,7 @@ export default () => {
|
|||||||
return setCopyAreaContent(formExports.iframe);
|
return setCopyAreaContent(formExports.iframe);
|
||||||
}
|
}
|
||||||
return setCopyAreaContent(formExports.shortcode);
|
return setCopyAreaContent(formExports.shortcode);
|
||||||
};
|
});
|
||||||
|
|
||||||
const addFormWidgetHint = ReactStringReplace(
|
const addFormWidgetHint = ReactStringReplace(
|
||||||
MailPoet.I18n.t('addFormWidgetHint'),
|
MailPoet.I18n.t('addFormWidgetHint'),
|
||||||
@@ -40,7 +40,7 @@ export default () => {
|
|||||||
MailPoet.I18n.t('addFormShortcodeHint'),
|
MailPoet.I18n.t('addFormShortcodeHint'),
|
||||||
/\[link\](.*?)\[\/link\]/g,
|
/\[link\](.*?)\[\/link\]/g,
|
||||||
(match) => (
|
(match) => (
|
||||||
<a key="exportShortcode" href="#" onClick={_.partial(exportLinkClicked, 'shortcode')}>{match}</a>
|
<a key="exportShortcode" href="#" onClick={exportLinkClicked('shortcode')}>{match}</a>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ export default () => {
|
|||||||
/\[link\](.*?)\[\/link\]/g,
|
/\[link\](.*?)\[\/link\]/g,
|
||||||
(match) => {
|
(match) => {
|
||||||
if (match === 'PHP') {
|
if (match === 'PHP') {
|
||||||
return (<a key="exportPHP" href="#" onClick={_.partial(exportLinkClicked, 'php')}>{match}</a>);
|
return (<a key="exportPHP" href="#" onClick={exportLinkClicked('php')}>{match}</a>);
|
||||||
}
|
}
|
||||||
return (<a key="exportIframe" href="#" onClick={_.partial(exportLinkClicked, 'iframe')}>{match}</a>);
|
return (<a key="exportIframe" href="#" onClick={exportLinkClicked('iframe')}>{match}</a>);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
"html2canvas": "^1.0.0-alpha.12",
|
"html2canvas": "^1.0.0-alpha.12",
|
||||||
"interact.js": "~1.2.8",
|
"interact.js": "~1.2.8",
|
||||||
"jquery": "3.4.0",
|
"jquery": "3.4.0",
|
||||||
|
"lodash": "^4.17.15",
|
||||||
"moment": "^2.22.1",
|
"moment": "^2.22.1",
|
||||||
"mousetrap": "^1.6.3",
|
"mousetrap": "^1.6.3",
|
||||||
"papaparse": "4.1.1",
|
"papaparse": "4.1.1",
|
||||||
@@ -100,7 +101,6 @@
|
|||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"jsdom": "^11.12.0",
|
"jsdom": "^11.12.0",
|
||||||
"json-loader": "^0.5.7",
|
"json-loader": "^0.5.7",
|
||||||
"lodash": "^4.17.15",
|
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"node-sass": "^4.12.0",
|
"node-sass": "^4.12.0",
|
||||||
"postcss-cli": "^6.1.2",
|
"postcss-cli": "^6.1.2",
|
||||||
|
Reference in New Issue
Block a user