2018-11-29 18:38:20 +01:00
|
|
|
import jQuery from 'jquery';
|
|
|
|
import MapboxField from 'components/MapboxField/MapboxField';
|
|
|
|
|
|
|
|
jQuery.entwine('ss', ($) => {
|
|
|
|
$('.cms-edit-form .mapbox').entwine({
|
|
|
|
MapboxField: null,
|
|
|
|
|
|
|
|
onmatch() {
|
|
|
|
if (!this.getMapboxField()) {
|
|
|
|
this.setMapboxField(new MapboxField(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-01-23 11:23:23 +01:00
|
|
|
// Render when tab containing field is selected
|
2018-11-29 18:38:20 +01:00
|
|
|
$('.cms-edit-form [aria-hidden="false"] .mapbox').entwine({
|
|
|
|
onmatch() {
|
|
|
|
this._super();
|
2019-01-23 11:23:23 +01:00
|
|
|
this.getMapboxField().render();
|
|
|
|
}
|
|
|
|
});
|
2018-11-29 18:38:20 +01:00
|
|
|
|
2019-01-23 11:23:23 +01:00
|
|
|
// Assume field not contained in a tabset is already visible
|
|
|
|
$('.cms-edit-form .mapbox:not(.tabset .mapbox)').entwine({
|
|
|
|
onmatch() {
|
|
|
|
this._super();
|
2018-11-29 18:38:20 +01:00
|
|
|
this.getMapboxField().render();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|