-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1820 from pnp/imagePicker
Image picker
- Loading branch information
Showing
53 changed files
with
4,230 additions
and
1,346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": [ | ||
"development" | ||
], | ||
"hints": { | ||
"axe/aria": "off", | ||
"no-inline-styles": "off", | ||
"axe/text-alternatives": [ | ||
"default", | ||
{ | ||
"frame-title": "off" | ||
} | ||
] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# HoverReactionsBar | ||
|
||
This control allows you to select or Upload Image from SharePoint, Ondrive or Stock Images. | ||
|
||
## ImagePicker | ||
|
||
![imagepicker](../assets/ImagePicker00.png) | ||
|
||
![imagepicker](../assets/ImagePicker01.png) | ||
|
||
![imagepicker](../assets/ImagePicker02.png) | ||
|
||
![imagepicker](../assets/ImagePicker03.png) | ||
|
||
![imagepicker](../assets/ImagePicker04.png) | ||
|
||
![imagepicker](../assets/ImagePicker05.png) | ||
|
||
## How to use this control in your solutions | ||
|
||
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency. | ||
- Import the following modules to your component: | ||
|
||
```TypeScript | ||
import { ImagePicker } from '@pnp/spfx-controls-react/lib/ImagePicker'; | ||
``` | ||
|
||
- Use the `ImagePicker` control in your code as follows: | ||
|
||
```Typescript | ||
|
||
<ImagePicker | ||
onFileSelected={handleFileSelected} | ||
onDeleteFile={handleDeleteFile} | ||
selectedFileUrl={selectedImageUrl} | ||
context={appContext} | ||
> | ||
``` | ||
|
||
- With the `onFileSelect` property you can get the selected image: | ||
|
||
```typescript | ||
const handleFileSelected = React.useCallback(async (file: IFilePickerResult) => { | ||
console.log("file", file); | ||
}, []); | ||
``` | ||
|
||
- With the `onDelete` property you can execute a callback after delete the image: | ||
|
||
```typescript | ||
const onDeleteFile = React.useCallback(async () => { | ||
console.log("onDeleteFile"); | ||
}, []); | ||
``` | ||
|
||
## Implementation | ||
|
||
The HoverReactionsBar control can be configured with the following properties: | ||
|
||
| Property | Type | Required | Description | | ||
| --------------- | ------------------------------------------------- | -------- | ----------------------- | | ||
| onFileSelected | onFileSelect: (file: IFilePickerResult ) => void; | yes | OnSelectedFile Callback | | ||
| onDeleteFile | onDeleteFile: () => void | no | onDeleteFile CallBack | | ||
| selectedFileUrl | string | no | Default Selected Image | | ||
| context | BaseComponentContext | yes | Context | | ||
|
||
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ImagePicker) |
Oops, something went wrong.