Skip to content

Commit cccf2b9

Browse files
committed
Update Media Library Pro docs.
1 parent 82bd20c commit cccf2b9

File tree

3 files changed

+13
-75
lines changed

3 files changed

+13
-75
lines changed

docs/handling-uploads-with-media-library-pro/creating-custom-react-components.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,6 @@ Renders a button with an icon. Requires [icons](#icons) to be rendered on the pa
211211
}
212212
```
213213

214-
### useDragula
215-
216-
[See code on GitHub](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-react/src/useDragula.ts)
217-
218-
Custom hook to use [Dragula](https://github.com/bevacqua/react-dragula), to allow sorting of files.
219-
220214
**Parameters**
221215

222216
```ts

docs/handling-uploads-with-media-library-pro/creating-custom-vue-components.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ You can find a full list of available props for the renderless component [at the
6767

6868
For extensive examples you can have a look at the source of the pre-built UI components:
6969

70-
- [Vue 2 attachment component](https://github.com/spatie/laravel-medialibrary-pro/tree/master/resources/js/media-library-pro-vue2-attachment)
71-
- [Vue 2 collection component](https://github.com/spatie/laravel-medialibrary-pro/tree/master/resources/js/media-library-pro-vue2-collection)
7270
- [Vue 3 attachment component](https://github.com/spatie/laravel-medialibrary-pro/tree/master/resources/js/media-library-pro-vue3-attachment)
7371
- [Vue 3 collection component](https://github.com/spatie/laravel-medialibrary-pro/tree/master/resources/js/media-library-pro-vue3-collection)
7472

@@ -78,7 +76,7 @@ When building your own UI component using the Media Library Pro, you can also ma
7876

7977
### DropZone
8078

81-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/DropZone.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/DropZone.vue)
79+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/DropZone.vue)
8280

8381
Renderless component that exposes some props needed to render a file dropzone. Has a scoped slot that exposes `hasDragObject`, `isDropTarget` and `isValid`.
8482

@@ -94,7 +92,7 @@ props: {
9492

9593
### HiddenFields
9694

97-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/HiddenFields.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/HiddenFields.vue)
95+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/HiddenFields.vue)
9896

9997
Component that renders hidden input fields with the values of the entire MediaLibrary instance's media state. Only needed if you're planning on submitting forms traditionally (not with AJAX).
10098

@@ -109,7 +107,7 @@ props: {
109107

110108
### ItemErrors
111109

112-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/ItemErrors.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/ItemErrors.vue)
110+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/ItemErrors.vue)
113111

114112
Component that renders the errors for one media object.
115113

@@ -125,7 +123,7 @@ props: {
125123

126124
### ListErrors
127125

128-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/listErrors/ListErrors.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/listErrors/ListErrors.vue)
126+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/listErrors/ListErrors.vue)
129127

130128
Component that can render the MediaLibrary instance's invalid media (`mediaLibrary.state.invalidMedia`).
131129

@@ -142,7 +140,7 @@ props: {
142140

143141
### Thumb
144142

145-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/Thumb.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/Thumb.vue)
143+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/Thumb.vue)
146144

147145
Component to display a file's thumbnail. If no preview for the file exists, it will attempt to display its extension. Also implements the [Uploader](#uploader) component to replace files.
148146

@@ -160,7 +158,7 @@ props: {
160158

161159
### Uploader
162160

163-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/Uploader.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/Uploader.vue)
161+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/Uploader.vue)
164162

165163
Component used to upload new media objects, or to replace an existing object's file. Is used by the [Thumb](#thumb) component.
166164

@@ -181,13 +179,13 @@ props: {
181179

182180
### Icons
183181

184-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/components/Icons.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/Icons.vue)
182+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/Icons.vue)
185183

186184
Component that sets svg values for the packaged icons, required if you're planning on using the [icon](#icon) component.
187185

188186
### Icon
189187

190-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/components/Icon.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/Icon.vue)
188+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/Icon.vue)
191189

192190
Renders an icon. Requires [icons](#icons) to be rendered on the page.
193191

@@ -201,7 +199,7 @@ props: {
201199

202200
### IconButton
203201

204-
See code on GitHub: [Vue 2](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue2/src/components/IconButton.vue) / [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/IconButton.vue)
202+
See code on GitHub: [Vue 3](https://github.com/spatie/laravel-medialibrary-pro/blob/master/resources/js/media-library-pro-vue3/src/components/IconButton.vue)
205203

206204
Renders a button with an icon. Requires [icons](#icons) to be rendered on the page.
207205

docs/handling-uploads-with-media-library-pro/handling-uploads-with-vue.md

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Handling uploads with Vue
33
weight: 6
44
---
55

6-
Media Library Pro provides beautiful UI components for Vue 2 and Vue 3. They pack a lot of features: temporary uploads, custom property inputs, frontend validation, and robust error handling.
6+
Media Library Pro provides beautiful UI components for Vue 3. They pack a lot of features: temporary uploads, custom property inputs, frontend validation, and robust error handling.
77

88
The `MediaLibraryAttachment` component can upload one or more files with little or no extra information. The attachment component is a lightweight solution for small bits of UI like avatar fields.
99

@@ -81,11 +81,9 @@ mix.webpackConfig({
8181
});
8282
```
8383

84-
This will force Webpack to look in `vendor/spatie/laravel-medialibrary-pro/resources/js` when resolving imports, and allows you to shorten your import. Notice that the Vue 2 and Vue 3 components are separate components.
84+
This will force Webpack to look in `vendor/spatie/laravel-medialibrary-pro/resources/js` when resolving imports, and allows you to shorten your import.
8585

8686
```js
87-
import { MediaLibraryAttachment } from "media-library-pro-vue2-attachment";
88-
// or
8987
import { MediaLibraryAttachment } from "media-library-pro-vue3-attachment";
9088
```
9189

@@ -105,23 +103,6 @@ If you're using TypeScript, you will also have to add this to your tsconfig:
105103

106104
To use a component in your Blade templates, import the components you plan to use in your `app.js` file, and add them to your main Vue app's `components` object.
107105

108-
**Vue 2**
109-
110-
```js
111-
import Vue from "vue";
112-
import { MediaLibraryAttachment } from "media-library-pro-vue2-attachment";
113-
import { MediaLibraryCollection } from "media-library-pro-vue2-collection";
114-
115-
new Vue({
116-
el: "#app",
117-
118-
components: {
119-
MediaLibraryAttachment,
120-
MediaLibraryCollection,
121-
},
122-
});
123-
```
124-
125106
**Vue 3**
126107

127108
```js
@@ -362,13 +343,12 @@ The Media Library supports [custom properties](/docs/laravel-medialibrary/v11/ad
362343

363344
Use the `fields` scoped slot to add some fields:
364345

365-
**Vue 2**
346+
**Vue 3**
366347

367348
```html
368349
<media-library-collection name="images" :initial-value="{{ $images }}">
369350
<template
370-
slot="fields"
371-
slot-scope="{
351+
#fields="{
372352
getCustomPropertyInputProps,
373353
getCustomPropertyInputListeners,
374354
getCustomPropertyInputErrors,
@@ -414,25 +394,6 @@ Use the `fields` scoped slot to add some fields:
414394
</media-library-collection>
415395
```
416396

417-
**Vue 3**
418-
419-
```html
420-
<media-library-collection name="images" :initial-value="{{ $images }}">
421-
<template
422-
#fields="{
423-
getCustomPropertyInputProps,
424-
getCustomPropertyInputListeners,
425-
getCustomPropertyInputErrors,
426-
getNameInputProps,
427-
getNameInputListeners,
428-
getNameInputErrors,
429-
}"
430-
>
431-
… (see Vue 2 example above)
432-
</template>
433-
</media-library-collection>
434-
```
435-
436397
When you add an image to your collection, it will look like this.
437398

438399
![Screenshot of custom property](/docs/laravel-medialibrary/v11/images/pro/extra.png)
@@ -443,21 +404,6 @@ When uploading a file, some properties appear by default: its extension, filesiz
443404

444405
You can customize what is displayed here by using the `properties` scoped slot:
445406

446-
**Vue 2**
447-
448-
```html
449-
<media-library-attachment
450-
name="images"
451-
:initial-value="{{ $images }}"
452-
>
453-
<template slot="properties" slot-scope="{ object }">
454-
<div class="media-library-property">
455-
{{ object.attributes.name }}
456-
</div>
457-
</template>
458-
</media-library-collection>
459-
```
460-
461407
**Vue 3**
462408

463409
```html

0 commit comments

Comments
 (0)