Add default options for codemirror wrap
[MAILPOET-2455]
This commit is contained in:
committed by
Jack Kitterhing
parent
01c0381418
commit
63431e48ea
@@ -31,12 +31,22 @@ CodemirrorWrap.propTypes = {
|
||||
value: PropTypes.string.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
options: PropTypes.shape({
|
||||
lineNumbers: PropTypes.bool.isRequired,
|
||||
tabMode: PropTypes.string.isRequired,
|
||||
matchBrackets: PropTypes.bool.isRequired,
|
||||
theme: PropTypes.string.isRequired,
|
||||
mode: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
lineNumbers: PropTypes.bool,
|
||||
tabMode: PropTypes.string,
|
||||
matchBrackets: PropTypes.bool,
|
||||
theme: PropTypes.string,
|
||||
mode: PropTypes.string,
|
||||
}),
|
||||
};
|
||||
|
||||
CodemirrorWrap.defaultProps = {
|
||||
options: {
|
||||
lineNumbers: true,
|
||||
tabMode: 'indent',
|
||||
matchBrackets: true,
|
||||
theme: 'neo',
|
||||
mode: 'css',
|
||||
},
|
||||
};
|
||||
|
||||
export default CodemirrorWrap;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import React, { useRef } from 'react';
|
||||
import React from 'react';
|
||||
import {
|
||||
Panel,
|
||||
PanelBody,
|
||||
@@ -12,24 +12,13 @@ export default () => {
|
||||
(select) => select('mailpoet-form-editor').getFormStyles(),
|
||||
[]
|
||||
);
|
||||
const options = useRef({
|
||||
lineNumbers: true,
|
||||
tabMode: 'indent',
|
||||
matchBrackets: true,
|
||||
theme: 'neo',
|
||||
mode: 'css',
|
||||
});
|
||||
|
||||
const { changeFormStyles } = useDispatch('mailpoet-form-editor');
|
||||
|
||||
return (
|
||||
<Panel>
|
||||
<PanelBody title={MailPoet.I18n.t('customCss')} initialOpen={false}>
|
||||
<CodeMirror
|
||||
value={styles}
|
||||
options={options.current}
|
||||
onChange={changeFormStyles}
|
||||
/>
|
||||
<CodeMirror value={styles} onChange={changeFormStyles} />
|
||||
</PanelBody>
|
||||
</Panel>
|
||||
);
|
||||
|
Reference in New Issue
Block a user