Skip to content

Commit

Permalink
ENH Use the EmotionCssCacheProvider component
Browse files Browse the repository at this point in the history
This ensures we can override the react-select CSS if we need to.
  • Loading branch information
GuySartorelli committed Jan 11, 2023
1 parent b9115f3 commit ef4122d
Show file tree
Hide file tree
Showing 5 changed files with 404 additions and 300 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-anchor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-internal.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/dist/js/bundle.js

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions client/src/components/AnchorSelectorField/AnchorSelectorField.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as anchorSelectorActions from 'state/anchorSelector/AnchorSelectorActio
import anchorSelectorStates from 'state/anchorSelector/AnchorSelectorStates';
import fieldHolder from 'components/FieldHolder/FieldHolder';
import CreatableSelect from 'react-select/creatable';
import EmotionCssCacheProvider from 'containers/EmotionCssCacheProvider/EmotionCssCacheProvider';
import getFormState from 'lib/getFormState';
import classnames from 'classnames';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -95,7 +96,6 @@ class AnchorSelectorField extends SilverStripeComponent {
* @param {String} value
*/
handleChange(value) {
console.log(value);
if (typeof this.props.onChange === 'function') {
this.props.onChange(value ? value.value : '');
}
Expand Down Expand Up @@ -123,19 +123,21 @@ class AnchorSelectorField extends SilverStripeComponent {
const rawValue = this.props.value || '';
const placeholder = i18n._t('CMS.ANCHOR_SELECT_OR_TYPE', 'Select or enter anchor');
return (
<CreatableSelect
isSearchable
isClearable
options={options}
className={className}
name={this.props.name}
onChange={this.handleChange}
value={{value: rawValue}}
noOptionsMessage={() => i18n._t('CMS.ANCHOR_NO_OPTIONS', 'No options')}
placeholder={placeholder}
getOptionLabel={({ value }) => value}
classNamePrefix="anchorselectorfield"
/>
<EmotionCssCacheProvider>
<CreatableSelect
isSearchable
isClearable
options={options}
className={className}
name={this.props.name}
onChange={this.handleChange}
value={{value: rawValue}}
noOptionsMessage={() => i18n._t('CMS.ANCHOR_NO_OPTIONS', 'No options')}
placeholder={placeholder}
getOptionLabel={({ value }) => value}
classNamePrefix="anchorselectorfield"
/>
</EmotionCssCacheProvider>
);
}
}
Expand Down
Loading

0 comments on commit ef4122d

Please sign in to comment.