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

Feat: allow cross origin check setting for curations #547

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions config/curator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
'cloudinary',
'imgix',
],
'cropper' => [
'check_cross_origin' => true,
],
'curation_formats' => [
'jpg',
'jpeg',
Expand Down
4 changes: 2 additions & 2 deletions resources/dist/curation.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion resources/js/curation.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Cropper from "cropperjs";

export default function curation({statePath, fileName, fileType, presets = {}}) {
export default function curation({statePath, fileName, fileType, presets = {}, checkCrossOrigin = true}) {
return {
statePath: statePath,
filename: fileName,
filetype: fileType,
checkCrossOrigin: checkCrossOrigin,
cropper: null,
presets: presets,
preset: 'custom',
Expand Down Expand Up @@ -35,6 +36,7 @@ export default function curation({statePath, fileName, fileType, presets = {}})

setTimeout(() => {
this.cropper = new Cropper(this.$refs.image, {
checkCrossOrigin: this.checkCrossOrigin,
background: false,
});
}, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class="flex-1 relative flex flex-col lg:flex-row overflow-hidden"
fileName: '{{ $media->name }}',
fileType: '{{ $media->type }}',
presets: @js($presets),
checkCrossOrigin: {{ config('curator.cropper.check_cross_origin') }}
})"
x-on:add-curation.window="$dispatch('close-modal', { id: '{{ $modalId }}' })"
>
Expand Down