fix entry editor bugs in kitchen sink entry
This commit is contained in:
parent
195f822739
commit
3176fa1b3f
@ -147,7 +147,7 @@
|
|||||||
"react-simple-dnd": "^0.1.2",
|
"react-simple-dnd": "^0.1.2",
|
||||||
"react-sortable": "^1.2.0",
|
"react-sortable": "^1.2.0",
|
||||||
"react-split-pane": "^0.1.57",
|
"react-split-pane": "^0.1.57",
|
||||||
"react-textarea-autosize-inputref": "^4.1.0",
|
"react-textarea-autosize": "^4.3.2",
|
||||||
"react-toolbox": "^1.2.1",
|
"react-toolbox": "^1.2.1",
|
||||||
"react-topbar-progress-indicator": "^1.0.0",
|
"react-topbar-progress-indicator": "^1.0.0",
|
||||||
"react-waypoint": "^3.1.3",
|
"react-waypoint": "^3.1.3",
|
||||||
|
@ -15,7 +15,7 @@ export default class PreviewPane extends React.Component {
|
|||||||
getWidget = (field, value, props) => {
|
getWidget = (field, value, props) => {
|
||||||
const { fieldsMetaData, getAsset } = props;
|
const { fieldsMetaData, getAsset } = props;
|
||||||
const widget = resolveWidget(field.get('widget'));
|
const widget = resolveWidget(field.get('widget'));
|
||||||
return React.createElement(widget.preview, {
|
return !widget.preview ? null : React.createElement(widget.preview, {
|
||||||
field,
|
field,
|
||||||
key: field.get('name'),
|
key: field.get('name'),
|
||||||
value: value && Map.isMap(value) ? value.get(field.get('name')) : value,
|
value: value && Map.isMap(value) ? value.get(field.get('name')) : value,
|
||||||
|
3
src/components/Widgets/BooleanControl.css
Normal file
3
src/components/Widgets/BooleanControl.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.switch {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import ImmutablePropTypes from "react-immutable-proptypes";
|
import ImmutablePropTypes from "react-immutable-proptypes";
|
||||||
import Switch from 'react-toolbox/lib/switch';
|
import Switch from 'react-toolbox/lib/switch';
|
||||||
|
import { isBoolean } from 'lodash';
|
||||||
|
import styles from './BooleanControl.css';
|
||||||
|
|
||||||
export default class BooleanControl extends React.Component {
|
export default class BooleanControl extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
@ -8,7 +10,8 @@ export default class BooleanControl extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Switch
|
<Switch
|
||||||
id={forID}
|
id={forID}
|
||||||
checked={value === undefined ? field.get('defaultValue', false) : value}
|
className={styles.switch}
|
||||||
|
checked={isBoolean(value) ? value : field.get('defaultValue', false)}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -9,8 +9,10 @@ class ControlHOC extends Component {
|
|||||||
controlComponent: PropTypes.func.isRequired,
|
controlComponent: PropTypes.func.isRequired,
|
||||||
field: ImmutablePropTypes.map.isRequired,
|
field: ImmutablePropTypes.map.isRequired,
|
||||||
value: PropTypes.oneOfType([
|
value: PropTypes.oneOfType([
|
||||||
|
PropTypes.node,
|
||||||
PropTypes.object,
|
PropTypes.object,
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
|
PropTypes.bool,
|
||||||
]),
|
]),
|
||||||
metadata: ImmutablePropTypes.map,
|
metadata: ImmutablePropTypes.map,
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
|
@ -6,5 +6,5 @@ export default function DatePreview({ value }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatePreview.propTypes = {
|
DatePreview.propTypes = {
|
||||||
value: PropTypes.node,
|
value: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import previewStyle from './defaultPreviewStyle';
|
import previewStyle from './defaultPreviewStyle';
|
||||||
|
|
||||||
export default function DatePreview({ value }) {
|
export default function DateTimePreview({ value }) {
|
||||||
return <div style={previewStyle}>{value ? value.toString() : null}</div>;
|
return <div style={previewStyle}>{value ? value.toString() : null}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatePreview.propTypes = {
|
DateTimePreview.propTypes = {
|
||||||
value: PropTypes.node,
|
value: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ import MarkupIt from 'markup-it';
|
|||||||
import markdownSyntax from 'markup-it/syntaxes/markdown';
|
import markdownSyntax from 'markup-it/syntaxes/markdown';
|
||||||
import htmlSyntax from 'markup-it/syntaxes/html';
|
import htmlSyntax from 'markup-it/syntaxes/html';
|
||||||
import CaretPosition from 'textarea-caret-position';
|
import CaretPosition from 'textarea-caret-position';
|
||||||
import TextareaAutosize from 'react-textarea-autosize-inputref';
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
import registry from '../../../../lib/registry';
|
import registry from '../../../../lib/registry';
|
||||||
import { createAssetProxy } from '../../../../valueObjects/AssetProxy';
|
import { createAssetProxy } from '../../../../valueObjects/AssetProxy';
|
||||||
import Toolbar from '../Toolbar/Toolbar';
|
import Toolbar from '../Toolbar/Toolbar';
|
||||||
|
@ -10,7 +10,11 @@ export default class ObjectControl extends Component {
|
|||||||
onAddAsset: PropTypes.func.isRequired,
|
onAddAsset: PropTypes.func.isRequired,
|
||||||
onRemoveAsset: PropTypes.func.isRequired,
|
onRemoveAsset: PropTypes.func.isRequired,
|
||||||
getAsset: PropTypes.func.isRequired,
|
getAsset: PropTypes.func.isRequired,
|
||||||
value: PropTypes.node,
|
value: PropTypes.oneOfType([
|
||||||
|
PropTypes.node,
|
||||||
|
PropTypes.object,
|
||||||
|
PropTypes.bool,
|
||||||
|
]),
|
||||||
field: PropTypes.object,
|
field: PropTypes.object,
|
||||||
forID: PropTypes.string,
|
forID: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
@ -35,6 +39,7 @@ export default class ObjectControl extends Component {
|
|||||||
onAddAsset,
|
onAddAsset,
|
||||||
onRemoveAsset,
|
onRemoveAsset,
|
||||||
getAsset,
|
getAsset,
|
||||||
|
forID: field.get('name'),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,7 @@ export default class ObjectPreview extends Component {
|
|||||||
widgetFor = (field) => {
|
widgetFor = (field) => {
|
||||||
const { value, getAsset } = this.props;
|
const { value, getAsset } = this.props;
|
||||||
const widget = resolveWidget(field.get('widget'));
|
const widget = resolveWidget(field.get('widget'));
|
||||||
return (
|
return !widget.preview ? null : (
|
||||||
<div key={field.get('name')}>
|
<div key={field.get('name')}>
|
||||||
{React.createElement(widget.preview, {
|
{React.createElement(widget.preview, {
|
||||||
key: field.get('name'),
|
key: field.get('name'),
|
||||||
|
@ -34,7 +34,7 @@ SelectControl.propTypes = {
|
|||||||
value: PropTypes.node,
|
value: PropTypes.node,
|
||||||
forID: PropTypes.string.isRequired,
|
forID: PropTypes.string.isRequired,
|
||||||
field: ImmutablePropTypes.contains({
|
field: ImmutablePropTypes.contains({
|
||||||
options: ImmutablePropTypes.listOf(PropTypes.oneOf([
|
options: ImmutablePropTypes.listOf(PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
ImmutablePropTypes.contains({
|
ImmutablePropTypes.contains({
|
||||||
label: PropTypes.string.isRequired,
|
label: PropTypes.string.isRequired,
|
||||||
|
@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';
|
|||||||
import previewStyle from './defaultPreviewStyle';
|
import previewStyle from './defaultPreviewStyle';
|
||||||
|
|
||||||
export default function TextPreview({ value }) {
|
export default function TextPreview({ value }) {
|
||||||
return <div style={previewStyle}>{value ? value.toString() : null}</div>;
|
return <div style={previewStyle}>{value}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPreview.propTypes = {
|
TextPreview.propTypes = {
|
||||||
|
@ -7090,9 +7090,11 @@ react-style-proptype@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
prop-types "^15.5.4"
|
prop-types "^15.5.4"
|
||||||
|
|
||||||
react-textarea-autosize-inputref@^4.1.0:
|
react-textarea-autosize@^4.3.2:
|
||||||
version "4.1.0"
|
version "4.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/react-textarea-autosize-inputref/-/react-textarea-autosize-inputref-4.1.0.tgz#4a12921f9c992a8e2c6ce569ab46982a96ca48f6"
|
resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-4.3.2.tgz#962a52c68caceae408c18acecec29049b81e42fa"
|
||||||
|
dependencies:
|
||||||
|
prop-types "^15.5.8"
|
||||||
|
|
||||||
react-themeable@^1.1.0:
|
react-themeable@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user