register extensions for development
This commit is contained in:
@ -1,10 +1,6 @@
|
||||
import { attempt, flatten, isError } from 'lodash';
|
||||
import { fromJS, Map } from 'immutable';
|
||||
import fuzzy from 'fuzzy';
|
||||
import { GitHubBackend } from "netlify-cms-backend-github";
|
||||
import { GitLabBackend } from "netlify-cms-backend-gitlab";
|
||||
import { GitGatewayBackend } from "netlify-cms-backend-git-gateway";
|
||||
import { TestBackend } from "netlify-cms-backend-test";
|
||||
import { resolveFormat } from "Formats/formats";
|
||||
import { selectIntegration } from 'Reducers/integrations';
|
||||
import {
|
||||
@ -24,16 +20,6 @@ import { registerBackend, getBackend } from 'Lib/registry';
|
||||
import { Cursor, CURSOR_COMPATIBILITY_SYMBOL } from 'netlify-cms-lib-util';
|
||||
import { EDITORIAL_WORKFLOW, status } from 'Constants/publishModes';
|
||||
|
||||
/**
|
||||
* Register internal backends
|
||||
*/
|
||||
registerBackend('git-gateway', GitGatewayBackend);
|
||||
registerBackend('github', GitHubBackend);
|
||||
registerBackend('gitlab', GitLabBackend);
|
||||
registerBackend('bitbucket', BitBucketBackend);
|
||||
registerBackend('test-repo', TestBackend);
|
||||
|
||||
|
||||
class LocalStorageAuthStore {
|
||||
storageKey = "netlify-cms-user";
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import styled from 'react-emotion';
|
||||
|
||||
function isVisible(field) {
|
||||
return field.get('widget') !== 'hidden';
|
||||
}
|
||||
|
||||
const style = {
|
||||
fontFamily: 'Roboto, "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif',
|
||||
};
|
||||
const PreviewContainer = styled.div`
|
||||
fontFamily: Roboto, "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif;
|
||||
`
|
||||
|
||||
/**
|
||||
* Use a stateful component so that child components can effectively utilize
|
||||
@ -21,9 +22,11 @@ export default class Preview extends React.Component {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div style={style}>
|
||||
{fields.filter(isVisible).map(field => widgetFor(field.get('name')))}
|
||||
</div>
|
||||
<PreviewContainer>
|
||||
{fields.filter(isVisible).map(field => (
|
||||
<div>{widgetFor(field.get('name'))}</div>
|
||||
))}
|
||||
</PreviewContainer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,3 @@
|
||||
:root {
|
||||
--widgetNestDistance: 14px;
|
||||
}
|
||||
|
||||
.nc-widgetPreview {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
export default class StringControl extends React.Component {
|
||||
static propTypes = {
|
||||
onChange: PropTypes.func.isRequired,
|
||||
forID: PropTypes.string,
|
||||
value: PropTypes.node,
|
||||
classNameWrapper: PropTypes.string.isRequired,
|
||||
setActiveStyle: PropTypes.func.isRequired,
|
||||
setInactiveStyle: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
value: '',
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
forID,
|
||||
value,
|
||||
onChange,
|
||||
classNameWrapper,
|
||||
setActiveStyle,
|
||||
setInactiveStyle
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<input
|
||||
type="text"
|
||||
id={forID}
|
||||
className={classNameWrapper}
|
||||
value={value || ''}
|
||||
onChange={e => onChange(e.target.value)}
|
||||
onFocus={setActiveStyle}
|
||||
onBlur={setInactiveStyle}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
export default function StringPreview({ value }) {
|
||||
return <div className="nc-widgetPreview">{ value }</div>;
|
||||
}
|
||||
|
||||
StringPreview.propTypes = {
|
||||
value: PropTypes.node,
|
||||
};
|
@ -1,8 +1,6 @@
|
||||
import { registerWidget } from 'Lib/registry';
|
||||
import UnknownControl from './Unknown/UnknownControl';
|
||||
import UnknownPreview from './Unknown/UnknownPreview';
|
||||
import StringControl from './String/StringControl';
|
||||
import StringPreview from './String/StringPreview';
|
||||
import NumberControl from './Number/NumberControl';
|
||||
import NumberPreview from './Number/NumberPreview';
|
||||
import TextControl from './Text/TextControl';
|
||||
@ -27,8 +25,6 @@ import RelationControl from './Relation/RelationControl';
|
||||
import RelationPreview from './Relation/RelationPreview';
|
||||
import BooleanControl from './Boolean/BooleanControl';
|
||||
|
||||
|
||||
registerWidget('string', StringControl, StringPreview);
|
||||
registerWidget('text', TextControl, TextPreview);
|
||||
registerWidget('number', NumberControl, NumberPreview);
|
||||
registerWidget('list', ListControl, ListPreview);
|
||||
|
Reference in New Issue
Block a user