Skip to content

Commit

Permalink
Merge pull request #93 from mostafaznv/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mostafaznv authored Oct 31, 2023
2 parents 50c9755 + 6f9dcbb commit 42fa7f9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions resources/js/components/media-browser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
<div class="grid nc-grid-cols-6 gap-4 mb-12 mt-6 px-6">
<div v-for="(item, key) in items" :key="item.hash" @click="select(item)" class="media-container text-center p-1 cursor-pointer" :title="item.name">
<div class="content-container" :class="{'selected': isSelected(item)}">
<div @click.stop.prevent="directSelect(item)" class="direct-select" :title="__('Direct Select')">
<Icon type="plus" />
</div>

<v-lazy-image
v-if="isImagePicker"
class="image-preview bg-white mx-auto"
Expand Down Expand Up @@ -434,6 +438,15 @@ export default {
}
},
/**
* Direct Select an Item
*/
directSelect(item) {
this.selected = [item]
this.insert()
},
/**
* Deselect Item
*
Expand Down Expand Up @@ -591,6 +604,29 @@ export default {
background: rgba(0, 0, 0, 0.3);
}
}
.direct-select {
position: absolute;
top: 4px;
right: 4px;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background: rgb(var(--colors-gray-100));
color: rgb(var(--colors-primary-600));
border-radius: 1px;
opacity: 0;
transition: all 300ms;
z-index: 1;
}
&:hover {
.direct-select {
opacity: 1;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/Image.stub
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Image extends Resource
->sortable(),

ImageUpload::make(trans('File'), 'image')
->rules('required', 'mimes:jpg,jpeg,png,gif', 'max:5000')
->rules('required', 'mimes:jpg,jpeg,png,gif,webp', 'max:5000')
->help(trans(':size Megabyte Max FileSize.', ['size' => 5])),

Text::make(trans('Filename'), 'file_name')
Expand Down

0 comments on commit 42fa7f9

Please sign in to comment.