Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
EuiForm,
EuiFlexGroup,
EuiFlexItem,
EuiImage,
Expand All @@ -15,7 +16,10 @@ import {
EuiButton,
EuiFieldText,
} from '@elastic/eui';
import { Loading } from '../../../../public/components/loading';

// TODO: (clintandrewhall) This is a quick fix for #25342 -- we should figure out how to use the overall component.
import { Loading } from '../../../../public/components/loading/loading';

import { FileUpload } from '../../../../public/components/file_upload';
import { elasticOutline } from '../../../lib/elastic_outline';
import { resolveFromArgs } from '../../../../common/lib/resolve_dataurl';
Expand Down Expand Up @@ -123,18 +127,19 @@ class ImageUpload extends React.Component {
}

const pasteImageUrl = urlTypeSrc ? (
<form onSubmit={this.setSrcUrl} className="eui-textRight">
<EuiForm onSubmit={this.setSrcUrl} className="eui-textRight">
<EuiFieldText
compressed
value={this.state.url}
defaultValue={this.state.url}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just had a lot of issues with uncontrolled forms, so my initial reaction here is fear of bringing them back ;).

I know you touched on this in the description, but I don't really understand why this needs to be uncontrolled. Can you clarify why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a props warning in the code I was testing, so I decided to fix it as was recommended. I can revert it, but it seems to me this is a pretty bad code smell issue.

inputRef={ref => (this.inputRefs.srcUrlText = ref)}
placeholder="Image URL"
aria-label="Image URL"
/>
<EuiSpacer size="m" />
<EuiButton type="submit" size="s" onClick={this.setSrcUrl}>
Set
</EuiButton>
</form>
</EuiForm>
) : null;

const shouldPreview =
Expand Down