2016-10-04 17:58:26 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-06-16 19:20:36 -03:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2016-10-04 17:58:26 +02:00
|
|
|
import { ScrollSync, ScrollSyncPane } from '../ScrollSync';
|
2016-09-29 19:02:28 +02:00
|
|
|
import ControlPane from '../ControlPanel/ControlPane';
|
2016-09-30 16:25:15 +02:00
|
|
|
import PreviewPane from '../PreviewPane/PreviewPane';
|
2016-10-13 14:31:44 +02:00
|
|
|
import Toolbar from './EntryEditorToolbar';
|
2016-09-11 23:08:18 +02:00
|
|
|
import styles from './EntryEditor.css';
|
2016-05-30 16:55:32 -07:00
|
|
|
|
2016-10-04 17:58:26 +02:00
|
|
|
export default function EntryEditor(
|
|
|
|
{
|
2016-10-11 18:24:55 +02:00
|
|
|
collection,
|
|
|
|
entry,
|
2016-10-21 20:42:14 -02:00
|
|
|
fields,
|
2016-10-11 18:24:55 +02:00
|
|
|
getMedia,
|
|
|
|
onChange,
|
|
|
|
onAddMedia,
|
|
|
|
onRemoveMedia,
|
|
|
|
onPersist,
|
|
|
|
onCancelEdit,
|
2016-10-04 17:58:26 +02:00
|
|
|
}) {
|
|
|
|
return (
|
|
|
|
<div className={styles.root}>
|
|
|
|
<ScrollSync>
|
2016-09-29 22:17:29 +02:00
|
|
|
<div className={styles.container}>
|
2016-10-04 17:58:26 +02:00
|
|
|
<ScrollSyncPane>
|
|
|
|
<div className={styles.controlPane}>
|
|
|
|
<ControlPane
|
|
|
|
collection={collection}
|
|
|
|
entry={entry}
|
2016-10-21 20:42:14 -02:00
|
|
|
fields={fields}
|
2016-10-04 17:58:26 +02:00
|
|
|
getMedia={getMedia}
|
|
|
|
onChange={onChange}
|
|
|
|
onAddMedia={onAddMedia}
|
|
|
|
onRemoveMedia={onRemoveMedia}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</ScrollSyncPane>
|
2016-09-29 22:17:29 +02:00
|
|
|
<div className={styles.previewPane}>
|
|
|
|
<PreviewPane
|
|
|
|
collection={collection}
|
|
|
|
entry={entry}
|
2016-10-21 20:42:14 -02:00
|
|
|
fields={fields}
|
2016-09-29 22:17:29 +02:00
|
|
|
getMedia={getMedia}
|
|
|
|
/>
|
|
|
|
</div>
|
2016-09-12 11:14:21 +02:00
|
|
|
</div>
|
2016-10-04 17:58:26 +02:00
|
|
|
</ScrollSync>
|
|
|
|
<div className={styles.footer}>
|
2016-10-13 14:31:44 +02:00
|
|
|
<Toolbar
|
|
|
|
isPersisting={entry.get('isPersisting')}
|
|
|
|
onPersist={onPersist}
|
|
|
|
onCancelEdit={onCancelEdit}
|
|
|
|
/>
|
2016-05-30 16:55:32 -07:00
|
|
|
</div>
|
2016-10-04 17:58:26 +02:00
|
|
|
</div>
|
|
|
|
);
|
2016-05-30 16:55:32 -07:00
|
|
|
}
|
2016-06-05 01:52:18 -07:00
|
|
|
|
2016-06-16 19:20:36 -03:00
|
|
|
EntryEditor.propTypes = {
|
|
|
|
collection: ImmutablePropTypes.map.isRequired,
|
|
|
|
entry: ImmutablePropTypes.map.isRequired,
|
2016-10-21 20:42:14 -02:00
|
|
|
fields: ImmutablePropTypes.list.isRequired,
|
2016-06-16 19:20:36 -03:00
|
|
|
getMedia: PropTypes.func.isRequired,
|
|
|
|
onAddMedia: PropTypes.func.isRequired,
|
|
|
|
onChange: PropTypes.func.isRequired,
|
|
|
|
onPersist: PropTypes.func.isRequired,
|
|
|
|
onRemoveMedia: PropTypes.func.isRequired,
|
2016-10-11 18:24:55 +02:00
|
|
|
onCancelEdit: PropTypes.func.isRequired,
|
2016-06-16 19:20:36 -03:00
|
|
|
};
|