fix: Focus on empty document after creation

fix: Clicking in whitespace below document should focus
Remove unused component
This commit is contained in:
Tom Moor
2020-02-26 22:29:22 -08:00
parent dac2d43f55
commit f0afa67012
5 changed files with 22 additions and 50 deletions

View File

@@ -19,11 +19,15 @@ class DocumentEditor extends React.Component<Props> {
}
focusAtStart = () => {
if (this.editor) this.editor.focusAtStart();
if (this.editor) {
this.editor.focusAtStart();
}
};
focusAtEnd = () => {
if (this.editor) this.editor.focusAtEnd();
if (this.editor) {
this.editor.focusAtEnd();
}
};
render() {
@@ -33,6 +37,7 @@ class DocumentEditor extends React.Component<Props> {
<React.Fragment>
<Editor
ref={ref => (this.editor = ref)}
autoFocus={!this.props.defaultValue}
plugins={plugins}
grow={!readOnly}
{...this.props}

View File

@@ -1,39 +0,0 @@
// @flow
import * as React from 'react';
import styled from 'styled-components';
import { pulsate } from 'shared/styles/animations';
import Flex from 'shared/components/Flex';
import Fade from 'components/Fade';
import { randomInteger } from 'shared/random';
const randomValues = Array.from(
new Array(5),
() => `${randomInteger(85, 100)}%`
);
const LoadingPlaceholder = () => {
return (
<Wrapper>
<Flex column auto>
<Mask style={{ width: randomValues[0] }} header />
<Mask style={{ width: randomValues[1] }} />
<Mask style={{ width: randomValues[2] }} />
<Mask style={{ width: randomValues[3] }} />
</Flex>
</Wrapper>
);
};
const Wrapper = styled(Fade)`
margin: 40px 0;
`;
const Mask = styled(Flex)`
height: ${props => (props.header ? 28 : 18)}px;
margin-bottom: ${props => (props.header ? 32 : 14)}px;
background-color: ${props => props.theme.smoke};
animation: ${pulsate} 1.3s infinite;
`;
export default LoadingPlaceholder;