fix various bugs

This commit is contained in:
Shawn Erquhart 2018-07-17 11:37:17 -04:00
parent b7b90aaa65
commit 2e7406862e
15 changed files with 119 additions and 67 deletions

View File

@ -6,8 +6,10 @@
}],
],
"plugins": [
"transform-object-rest-spread",
"transform-class-properties",
"lodash",
["babel-plugin-transform-builtin-extend", {
"globals": ["Error"]
}],
["transform-runtime", {
"useBuiltIns": true,
"useESModules": true,
@ -29,7 +31,16 @@
"ValueObjects": "./src/valueObjects/",
}
}],
"inline-svg",
"transform-export-extensions",
"transform-class-properties",
"transform-object-rest-spread",
["inline-svg", {
"svgo": {
"plugins": [
{"removeViewBox": false},
],
},
}],
],
"env": {
"production": {

View File

@ -18,7 +18,7 @@
"scripts": {
"start": "lerna run --parallel watch",
"clean": "cd packages && rimraf */.cache */*.js */*.css */*.svg */*.map",
"reset": "yarn clean && lerna clean --yes && lerna bootstrap && cd packages/netlify-cms-core && yarn link netlify-cms-lib-auth netlify-cms-lib-util netlify-cms-ui-default netlify-cms-editor-component-image react-split-pane"
"reset": "yarn clean && lerna clean --yes && lerna bootstrap && cd packages/netlify-cms-core && yarn link netlify-cms-lib-auth netlify-cms-lib-util netlify-cms-ui-default netlify-cms-editor-component-image"
},
"jest": {
"moduleNameMapper": {
@ -61,8 +61,11 @@
"babel-plugin-emotion": "^9.2.4",
"babel-plugin-inline-import": "^3.0.0",
"babel-plugin-inline-svg": "^1.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^3.0.0",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",

View File

@ -46,12 +46,12 @@
"mdast-util-definitions": "^1.2.2",
"mdast-util-to-string": "^1.0.4",
"moment": "^2.11.2",
"netlify-cms-editor-component-image": "file:../netlify-cms-editor-component-image",
"netlify-cms-lib-auth": "file:../netlify-cms-lib-auth",
"netlify-cms-lib-util": "file:../netlify-cms-lib-util",
"netlify-cms-ui-default": "file:../netlify-cms-ui-default",
"netlify-cms-editor-component-image": "file:../netlify-cms-editor-component-image",
"prop-types": "^15.5.10",
"react": "15.x || 16.x",
"react": "^16.4.1",
"react-aria-menubutton": "^5.1.0",
"react-autosuggest": "^9.3.2",
"react-datetime": "^2.11.0",
@ -69,7 +69,7 @@
"react-router-redux": "^5.0.0-alpha.8",
"react-scroll-sync": "^0.4.0",
"react-sortable-hoc": "^0.6.8",
"react-split-pane": "^0.1.81",
"react-split-pane": "^0.1.82",
"react-textarea-autosize": "^5.2.0",
"react-toggled": "^1.1.2",
"react-topbar-progress-indicator": "^2.0.0",

View File

@ -4,7 +4,8 @@ import { uniq, initial, last, get, find, hasIn, partial } from "lodash";
import { filterPromises, resolvePromiseProperties } from "netlify-cms-lib-util/promise";
import AssetProxy from "ValueObjects/AssetProxy";
import { SIMPLE, EDITORIAL_WORKFLOW, status } from "Constants/publishModes";
import { APIError, EditorialWorkflowError } from "netlify-cms-lib-util";
import APIError from "netlify-cms-lib-util/APIError";
import EditorialWorkflowError from "netlify-cms-lib-util/EditorialWorkflowError";
const CMS_BRANCH_PREFIX = 'cms/';

View File

@ -16,7 +16,7 @@ const PREVIEW_VISIBLE = 'cms.preview-visible';
const SCROLL_SYNC_ENABLED = 'cms.scroll-sync-enabled';
const styles = {
noPreviewContainer: css`
splitPane: css`
${components.card};
border-radius: 0;
height: 100%;
@ -53,18 +53,21 @@ injectGlobal`
}
}
`
const StyledSplitPane = styled(SplitPane)`
${styles.splitPane};
/**
* Quick fix for preview pane not fully displaying in Safari
*/
.SplitPane {
.Pane {
height: 100%;
}
}
`
const NoPreviewContainer = styled.div`
${styles.noPreviewContainer};
${styles.splitPane};
`
const EditorContainer = styled.div`
@ -202,7 +205,7 @@ class EditorInterface extends Component {
const editorWithPreview = (
<ScrollSync enabled={this.state.scrollSyncEnabled}>
<div>
<SplitPane
<StyledSplitPane
maxSize={-100}
defaultSize="50%"
onDragStarted={this.handleSplitPaneDragStart}
@ -218,7 +221,7 @@ class EditorInterface extends Component {
getAsset={getAsset}
/>
</PreviewPaneContainer>
</SplitPane>
</StyledSplitPane>
</div>
</ScrollSync>
);

View File

@ -2,30 +2,25 @@ import React from 'react';
import PropTypes from 'prop-types';
import styled from 'react-emotion';
import Icon from 'netlify-cms-ui-default/Icon';
import { colors, colorsRaw, shadows } from 'netlify-cms-ui-default/styles';
import { colors, colorsRaw, shadows, buttons } from 'netlify-cms-ui-default/styles';
const EditorToggleButton = styled.button`
${buttons.button};
${shadows.dropMiddle};
background-color: ${colorsRaw.white};
color: ${props => colors[props.active ? `active` : `inactive`]};
color: ${props => colors[props.isActive ? `active` : `inactive`]};
border-radius: 32px;
display: block;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
padding: 0;
margin-bottom: 12px;
${Icon} {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
`
const EditorToggle = ({ enabled, active, onClick, icon }) => !enabled ? null :
<EditorToggleButton onClick={onClick}>
<EditorToggleButton onClick={onClick} isActive={active}>
<Icon type={icon} size="large"/>
</EditorToggleButton>;

View File

@ -18,6 +18,7 @@ const styles = {
height: 100%;
display: flex;
align-items: center;
border: 0 solid ${colors.textFieldBorder};
`,
}
@ -38,6 +39,7 @@ const ToolbarContainer = styled.div`
`
const ToolbarSectionMain = styled.div`
${styles.toolbarSection};
flex: 10;
display: flex;
justify-content: space-between;
@ -54,7 +56,6 @@ const ToolbarSubSectionLast = styled(ToolbarSubSectionFirst)`
const ToolbarSectionBackLink = styled(Link)`
${styles.toolbarSection};
border: 0 solid ${colors.textFieldBorder};
border-right-width: 1px;
font-weight: normal;
padding: 0 20px;
@ -116,6 +117,7 @@ const BackStatusChanged = styled(BackStatus)`
`
const ToolbarButton = styled.button`
${buttons.button};
${buttons.default};
${styles.buttonMargin};
display: block;
@ -151,6 +153,12 @@ const StatusButton = styled(StyledDropdownButton)`
color: ${colorsRaw.teal};
`
const StatusDropdownItem = styled(DropdownItem)`
${Icon} {
color: ${colors.infoText};
}
`
export default class EditorToolbar extends React.Component {
static propTypes = {
isPersisting: PropTypes.bool,
@ -265,17 +273,17 @@ export default class EditorToolbar extends React.Component {
<StatusButton>{isUpdatingStatus ? 'Updating...' : 'Set status'}</StatusButton>
)}
>
<DropdownItem
<StatusDropdownItem
label="Draft"
onClick={() => onChangeStatus('DRAFT')}
icon={currentStatus === status.get('DRAFT') && 'check'}
/>
<DropdownItem
<StatusDropdownItem
label="In review"
onClick={() => onChangeStatus('PENDING_REVIEW')}
icon={currentStatus === status.get('PENDING_REVIEW') && 'check'}
/>
<DropdownItem
<StatusDropdownItem
label="Ready"
onClick={() => onChangeStatus('PENDING_PUBLISH')}
icon={currentStatus === status.get('PENDING_PUBLISH') && 'check'}

View File

@ -15,6 +15,9 @@ const CloseButton = styled.button`
border-radius: 50%;
background-color: white;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
`
const LibraryTitle = styled.h1`

View File

@ -1,5 +1,5 @@
import { Map } from 'immutable';
import { resolvePath } from 'netlify-cms-lib-util';
import { resolvePath } from 'netlify-cms-lib-util/path';
import { ADD_ASSET, REMOVE_ASSET } from 'Actions/media';
import AssetProxy from 'ValueObjects/AssetProxy';

View File

@ -1,5 +1,5 @@
import { resolvePath } from 'netlify-cms-lib-util';
import { currentBackend } from "Backends/backend";
import { resolvePath } from 'netlify-cms-lib-util/path';
import { currentBackend } from 'Backends/backend';
import { getIntegrationProvider } from 'Integrations';
import { selectIntegration } from 'Reducers';

View File

@ -1,20 +0,0 @@
import localForage from './localForage';
import { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
import { filterPromises, resolvePromiseProperties, then } from './promise';
import unsentRequest from './unsentRequest';
import APIError from './APIError';
import EditorialWorkflowError from './EditorialWorkflowError';
export {
localForage,
resolvePath,
basename,
fileExtensionWithSeparator,
fileExtension,
filterPromises,
resolvePromiseProperties,
then,
unsentRequest,
APIError,
EditorialWorkflowError,
};

View File

@ -16,7 +16,7 @@
"emotion": "^9.1.3",
"lodash": "^4.13.1",
"prop-types": "^15.5.10",
"react": "15.x || 16.x",
"react": "^16.4.1",
"react-aria-menubutton": "^5.1.0",
"react-emotion": "^9.2.6",
"react-toggled": "^1.1.2",

View File

@ -85,10 +85,11 @@ const Dropdown = ({
dropdownWidth = 'auto',
dropdownPosition = 'left',
dropdownTopOverlap = '0',
className,
children,
}) => {
return (
<StyledWrapper onSelection={handler => handler()}>
<StyledWrapper onSelection={handler => handler()} className={className}>
{renderButton()}
<Menu>
<DropdownList width={dropdownWidth} top={dropdownTopOverlap} position={dropdownPosition}>
@ -99,8 +100,8 @@ const Dropdown = ({
);
};
const DropdownItem = ({ label, icon, iconDirection, onClick }) => (
<StyledMenuItem value={onClick}>
const DropdownItem = ({ label, icon, iconDirection, onClick, className }) => (
<StyledMenuItem value={onClick} className={className}>
<span>{label}</span>
{
icon

View File

@ -7,7 +7,7 @@ const IconWrapper = styled.span`
line-height: 0;
width: ${props => props.size};
height: ${props => props.size};
transform: ${props => `rotation(${props.rotation})`};
transform: ${props => `rotate(${props.rotation})`};
& path:not(.no-fill),
& circle:not(.no-fill),

View File

@ -22,6 +22,13 @@
"@babel/types" "7.0.0-beta.51"
lodash "^4.17.5"
"@babel/helper-module-imports@^7.0.0-beta.49":
version "7.0.0-beta.54"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.54.tgz#c2d8e14ff034225bf431356db77ef467b8d35aac"
dependencies:
"@babel/types" "7.0.0-beta.54"
lodash "^4.17.5"
"@babel/highlight@7.0.0-beta.52":
version "7.0.0-beta.52"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.52.tgz#ef24931432f06155e7bc39cdb8a6b37b4a28b3d0"
@ -46,6 +53,14 @@
lodash "^4.17.5"
to-fast-properties "^2.0.0"
"@babel/types@7.0.0-beta.54", "@babel/types@^7.0.0-beta.49":
version "7.0.0-beta.54"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.54.tgz#025ad68492fed542c13f14c579a44c848e531063"
dependencies:
esutils "^2.0.2"
lodash "^4.17.5"
to-fast-properties "^2.0.0"
"@emotion/babel-utils@^0.6.4":
version "0.6.5"
resolved "https://registry.yarnpkg.com/@emotion/babel-utils/-/babel-utils-0.6.5.tgz#34d7844eb532d1175c8fc70175beb74d071bfbeb"
@ -660,6 +675,16 @@ babel-plugin-jest-hoist@^22.4.4:
version "22.4.4"
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.4.tgz#b9851906eab34c7bf6f8c895a2b08bea1a844c0b"
babel-plugin-lodash@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/babel-plugin-lodash/-/babel-plugin-lodash-3.3.4.tgz#4f6844358a1340baed182adbeffa8df9967bc196"
dependencies:
"@babel/helper-module-imports" "^7.0.0-beta.49"
"@babel/types" "^7.0.0-beta.49"
glob "^7.1.1"
lodash "^4.17.10"
require-package-name "^2.0.1"
babel-plugin-macros@^2.0.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.2.2.tgz#049c93f4b934453688a6ec38bba529c55bf0fa1f"
@ -688,6 +713,10 @@ babel-plugin-syntax-exponentiation-operator@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"
babel-plugin-syntax-export-extensions@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz#70a1484f0f9089a4e84ad44bac353c95b9b12721"
babel-plugin-syntax-flow@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d"
@ -712,6 +741,13 @@ babel-plugin-transform-async-to-generator@^6.22.0:
babel-plugin-syntax-async-functions "^6.8.0"
babel-runtime "^6.22.0"
babel-plugin-transform-builtin-extend@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-builtin-extend/-/babel-plugin-transform-builtin-extend-1.1.2.tgz#5e96fecf58b8fa1ed74efcad88475b2af3c9116e"
dependencies:
babel-runtime "^6.2.0"
babel-template "^6.3.0"
babel-plugin-transform-class-properties@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz#6a79763ea61d33d36f37b611aa9def81a81b46ac"
@ -897,6 +933,13 @@ babel-plugin-transform-exponentiation-operator@^6.22.0:
babel-plugin-syntax-exponentiation-operator "^6.8.0"
babel-runtime "^6.22.0"
babel-plugin-transform-export-extensions@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz#53738b47e75e8218589eea946cbbd39109bbe653"
dependencies:
babel-plugin-syntax-export-extensions "^6.8.0"
babel-runtime "^6.22.0"
babel-plugin-transform-flow-strip-types@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf"
@ -1041,14 +1084,14 @@ babel-register@^6.26.0:
mkdirp "^0.5.1"
source-map-support "^0.4.15"
babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0:
babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0:
babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0, babel-template@^6.3.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02"
dependencies:
@ -5055,7 +5098,7 @@ needle@^2.2.0:
emotion "^9.1.3"
lodash "^4.13.1"
prop-types "^15.5.10"
react "15.x || 16.x"
react "^16.4.1"
react-aria-menubutton "^5.1.0"
react-emotion "^9.2.6"
react-toggled "^1.1.2"
@ -6567,9 +6610,9 @@ react-sortable-hoc@^0.6.8:
lodash "^4.12.0"
prop-types "^15.5.7"
react-split-pane@^0.1.81:
version "0.1.81"
resolved "https://registry.yarnpkg.com/react-split-pane/-/react-split-pane-0.1.81.tgz#b1e8b82e0a6edd10f18fd639a5f512db3cbbb4e6"
react-split-pane@^0.1.82:
version "0.1.82"
resolved "https://registry.yarnpkg.com/react-split-pane/-/react-split-pane-0.1.82.tgz#42fbb9fd4823f05e037de0dab3cd6cf9bf0cf4ea"
dependencies:
inline-style-prefixer "^3.0.6"
prop-types "^15.5.10"
@ -6639,7 +6682,7 @@ react-waypoint@^7.1.0:
consolidated-events "^1.1.0"
prop-types "^15.0.0"
"react@15.x || 16.x", react@^16.4.1:
react@^16.4.1:
version "16.4.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32"
dependencies:
@ -7025,6 +7068,10 @@ require-main-filename@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
require-package-name@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/require-package-name/-/require-package-name-2.0.1.tgz#c11e97276b65b8e2923f75dabf5fb2ef0c3841b9"
require-resolve@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/require-resolve/-/require-resolve-0.0.2.tgz#bab410ab1aee2f3f55b79317451dd3428764e6f3"