Fixed #647, urls are not editable in shared preferences

Summary:
As reported in https://github.com/facebook/flipper/issues/647 urls are not editable in our generic data inspector, as clicking an url will immediately open it, rather than going to edit mode.

This diff fixes that by appending an edit icon to URL previews.

Reviewed By: jknoxville

Differential Revision: D19428925

fbshipit-source-id: 428e8e4c10fb472792b61986d915658f7581c38d
This commit is contained in:
Michel Weststrate
2020-01-16 06:51:47 -08:00
committed by Facebook Github Bot
parent df753ffa06
commit e7780530df
2 changed files with 16 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import Popover from '../Popover';
import {colors} from '../colors';
import Input from '../Input';
import React, {KeyboardEvent} from 'react';
import Glyph from '../Glyph';
const NullValue = styled.span({
color: 'rgb(128, 128, 128)',
@@ -595,7 +596,18 @@ class DataDescriptionContainer extends Component<{
case 'text':
case 'string':
if (val.startsWith('http://') || val.startsWith('https://')) {
return <Link href={val}>{val}</Link>;
return (
<>
<Link href={val}>{val}</Link>
<Glyph
name="pencil"
variant="outline"
color={colors.light20}
size={16}
style={{cursor: 'pointer', marginLeft: 8}}
/>
</>
);
} else {
return <StringValue>"{String(val || '')}"</StringValue>;
}

View File

@@ -318,5 +318,8 @@
],
"card-person": [
12
],
"pencil-outline": [
16
]
}