Skip to content

Commit cc7171e

Browse files
committed
feat: add resetOnInitialAttributes prop
1 parent 0aab288 commit cc7171e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/ModernCropper.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ const {
3636
src = '',
3737
crossorigin = 'anonymous',
3838
39+
resetOnInitialAttributes = true,
40+
3941
passThrough,
4042
} = defineProps<{
4143
id?: string
4244
src?: string
4345
crossorigin?: 'anonymous' | 'use-credentials'
4446
47+
/**
48+
* Automatically call $reset() on initial attributes changes
49+
* @default true
50+
*/
51+
resetOnInitialAttributes?: boolean
52+
4553
passThrough?: PassThroughOptions
4654
}>()
4755
@@ -110,7 +118,7 @@ function setElementAttributes(element: HTMLElement, attributes: Record<any, any>
110118
if (value === undefined)
111119
return
112120
113-
if (attribute.includes('initial'))
121+
if (attribute.includes('initial') && resetOnInitialAttributes)
114122
doReset = true
115123
116124
if (value === false || value === null)

0 commit comments

Comments
 (0)