Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove target option from examples and document consistently #5146

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import Tus from '@uppy/tus'
const uppy = new Uppy()
.use(Dashboard, { trigger: '#select-files' })
.use(RemoteSources, { companionUrl: 'https://companion.uppy.io' })
.use(Webcam, { target: Dashboard })
.use(ImageEditor, { target: Dashboard })
.use(Webcam)
.use(ImageEditor)
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })
.on('complete', (result) => {
console.log('Upload result:', result)
Expand Down
6 changes: 2 additions & 4 deletions docs/guides/migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ new Uppy()
companionAllowedHosts: COMPANION_ALLOWED_HOSTS,
})
.use(Webcam, {
target: Dashboard,
showVideoSourceDropdown: true,
showRecordingLength: true,
})
.use(Audio, {
target: Dashboard,
showRecordingLength: true,
})
.use(ScreenCapture, { target: Dashboard })
.use(ImageEditor, { target: Dashboard })
.use(ScreenCapture)
.use(ImageEditor)
.use(Transloadit, {
service: 'https://api2.transloadit.com',
async getAssemblyOptions(file) {
Expand Down
3 changes: 2 additions & 1 deletion docs/presets/remote-sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ default: `same-origin`).
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default: `Dashboard`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

[`request.credentials` value]:
https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
11 changes: 5 additions & 6 deletions docs/sources/audio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ yarn add @uppy/audio
import { Uppy, Dashboard, Audio } from "{{UPPY_JS_URL}}"
const uppy = new Uppy()
uppy.use(Dashboard, { inline: true, target: 'body' })
uppy.use(Audio, { target: Uppy.Dashboard })
uppy.use(Audio)
`}
</UppyCdnExample>
</TabItem>
Expand All @@ -67,9 +67,7 @@ import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';
import '@uppy/audio/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: 'body' })
.use(Audio, { target: Dashboard });
new Uppy().use(Dashboard, { inline: true, target: 'body' }).use(Audio);
```

### API
Expand All @@ -87,8 +85,9 @@ Configures the title / name shown in the UI, for instance, on Dashboard tabs

#### `target`

DOM element, CSS selector, or plugin to place the audio into (`string` or
`Element`, default: `null`).
DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `showAudioSourceDropdown`

Expand Down
10 changes: 5 additions & 5 deletions docs/sources/companion-plugins/box.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ import Box from '@uppy/box';
import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';

new Uppy().use(Dashboard, { inline: true, target: '#dashboard' }).use(Box, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Box, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -150,7 +149,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
10 changes: 5 additions & 5 deletions docs/sources/companion-plugins/dropbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ import Dropbox from '@uppy/dropbox';
import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';

new Uppy().use(Dashboard, { inline: true, target: '#dashboard' }).use(Dropbox, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Dropbox, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -149,7 +148,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
8 changes: 3 additions & 5 deletions docs/sources/companion-plugins/facebook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ import '@uppy/dashboard/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Facebook, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
.use(Facebook, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -148,7 +145,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
8 changes: 3 additions & 5 deletions docs/sources/companion-plugins/google-drive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ import '@uppy/dashboard/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(GoogleDrive, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
.use(GoogleDrive, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -152,7 +149,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
8 changes: 3 additions & 5 deletions docs/sources/companion-plugins/instagram.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ import '@uppy/dashboard/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Instagram, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
.use(Instagram, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -142,7 +139,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
8 changes: 3 additions & 5 deletions docs/sources/companion-plugins/onedrive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ import '@uppy/dashboard/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(OneDrive, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
.use(OneDrive, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -142,7 +139,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
8 changes: 3 additions & 5 deletions docs/sources/companion-plugins/unsplash.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ import '@uppy/dashboard/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Unsplash, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
.use(Unsplash, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -127,7 +124,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
10 changes: 5 additions & 5 deletions docs/sources/companion-plugins/url.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ import Url from '@uppy/url';
import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';

new Uppy().use(Dashboard, { inline: true, target: '#dashboard' }).use(Url, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Url, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand All @@ -110,7 +109,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
10 changes: 5 additions & 5 deletions docs/sources/companion-plugins/zoom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ import Zoom from '@uppy/zoom';
import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';

new Uppy().use(Dashboard, { inline: true, target: '#dashboard' }).use(Zoom, {
target: Dashboard,
companionUrl: 'https://your-companion.com',
});
new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(Zoom, { companionUrl: 'https://your-companion.com' });
```

### Use in Companion
Expand Down Expand Up @@ -121,7 +120,8 @@ Title / name shown in the UI, such as Dashboard tabs (`string`, default:
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string` or `Element`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

Expand Down
11 changes: 5 additions & 6 deletions docs/sources/screen-capture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ yarn add @uppy/screen-capture
import { Uppy, Dashboard, ScreenCapture } from "{{UPPY_JS_URL}}"
const uppy = new Uppy()
uppy.use(Dashboard, { inline: true, target: 'body' })
uppy.use(ScreenCapture, { target: Uppy.Dashboard })
uppy.use(ScreenCapture)
`}
</UppyCdnExample>
</TabItem>
Expand All @@ -79,9 +79,7 @@ import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';
import '@uppy/screen-capture/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: 'body' })
.use(ScreenCapture, { target: Dashboard });
new Uppy().use(Dashboard, { inline: true, target: 'body' }).use(ScreenCapture);
```

### API
Expand All @@ -99,8 +97,9 @@ Configures the title / name shown in the UI, for instance, on Dashboard tabs

#### `target`

DOM element, CSS selector, or plugin to place the screen capture into (`string`
or `Element`, default: `null`).
DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `displayMediaConstraints`

Expand Down
11 changes: 5 additions & 6 deletions docs/sources/webcam.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ yarn add @uppy/webcam
import { Uppy, Dashboard, Webcam } from "{{UPPY_JS_URL}}"
const uppy = new Uppy()
uppy.use(Dashboard, { inline: true, target: 'body' })
uppy.use(Webcam, { target: Uppy.Dashboard })
uppy.use(Webcam)
`}
</UppyCdnExample>
</TabItem>
Expand All @@ -77,9 +77,7 @@ import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';
import '@uppy/webcam/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: 'body' })
.use(Webcam, { target: Dashboard });
new Uppy().use(Dashboard, { inline: true, target: 'body' }).use(Webcam);
```

## API
Expand All @@ -92,8 +90,9 @@ A unique identifier for this plugin (`string`, default: `'Webcam'`).

#### `target`

DOM element, CSS selector, or plugin to place the webcam into (`string` or
`Element`, default: `null`).
DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `countdown`

Expand Down
3 changes: 2 additions & 1 deletion docs/user-interfaces/elements/drop-target.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ Event listener for the [`drop` event][].
#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default: `null`).
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).
Murderlon marked this conversation as resolved.
Show resolved Hide resolved

[`dragover` event]:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dragover_event
Expand Down
4 changes: 2 additions & 2 deletions docs/user-interfaces/elements/image-editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ yarn add @uppy/core @uppy/dashboard @uppy/image-editor
import { Uppy, Dashboard, ImageEditor } from "{{UPPY_JS_URL}}"
const uppy = new Uppy()
uppy.use(Dashboard, { target: '#uppy', inline: true })
uppy.use(ImageEditor, { target: Uppy.Dashboard })
uppy.use(ImageEditor)
`}
</UppyCdnExample>
</TabItem>
Expand All @@ -67,7 +67,7 @@ import '@uppy/image-editor/dist/style.min.css';

new Uppy()
.use(Dashboard, { inline: true, target: '#dashboard' })
.use(ImageEditor, { target: Dashboard });
.use(ImageEditor);
```

## API
Expand Down
5 changes: 3 additions & 2 deletions docs/user-interfaces/elements/status-bar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ Use this if you need to add several StatusBar instances.

#### `target`

DOM element, CSS selector, or plugin to mount the Status Bar into (`Element`,
`string`, `UIPlugin`, default: `'body'`).
DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `hideAfterFinish`

Expand Down
5 changes: 1 addition & 4 deletions packages/@uppy/image-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ import ImageEditor from '@uppy/image-editor'

const uppy = new Uppy()
uppy.use(Dashboard)
uppy.use(ImageEditor, {
target: Dashboard,
quality: 0.7,
})
uppy.use(ImageEditor, { quality: 0.7 })
```

## Installation
Expand Down
Loading