react-dropzone
Advanced tools
Comparing version 11.7.0 to 11.7.1
@@ -88,3 +88,4 @@ var _excluded = ["children"], | ||
noDragEventsBubbling: false, | ||
validator: null | ||
validator: null, | ||
useFsAccessApi: false | ||
}; | ||
@@ -191,2 +192,8 @@ Dropzone.defaultProps = defaultProps; | ||
/** | ||
* Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API | ||
* to open the file picker instead of using an `<input type="file">` click event. | ||
*/ | ||
useFsAccessApi: PropTypes.bool, | ||
/** | ||
* Cb for when the `dragenter` event occurs. | ||
@@ -384,2 +391,4 @@ * | ||
* @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection | ||
* @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API | ||
* to open the file picker instead of using an `<input type="file">` click event. | ||
* @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog | ||
@@ -438,2 +447,3 @@ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs. | ||
onFileDialogOpen = _defaultProps$options.onFileDialogOpen, | ||
useFsAccessApi = _defaultProps$options.useFsAccessApi, | ||
preventDropOnDocument = _defaultProps$options.preventDropOnDocument, | ||
@@ -483,3 +493,3 @@ noClick = _defaultProps$options.noClick, | ||
useEffect(function () { | ||
if (canUseFileSystemAccessAPI()) { | ||
if (useFsAccessApi && canUseFileSystemAccessAPI()) { | ||
return function () {}; | ||
@@ -492,3 +502,3 @@ } | ||
}; | ||
}, [inputRef, isFileDialogActive, onFileDialogCancelCb]); | ||
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]); | ||
var dragTargetsRef = useRef([]); | ||
@@ -682,3 +692,3 @@ | ||
var openFileDialog = useCallback(function () { | ||
if (canUseFileSystemAccessAPI()) { | ||
if (useFsAccessApi && canUseFileSystemAccessAPI()) { | ||
dispatch({ | ||
@@ -715,3 +725,3 @@ type: 'openDialog' | ||
} | ||
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone | ||
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone | ||
@@ -718,0 +728,0 @@ var onKeyDownCb = useCallback(function (event) { |
@@ -173,3 +173,3 @@ { | ||
"typings": "typings/react-dropzone.d.ts", | ||
"version": "11.7.0", | ||
"version": "11.7.1", | ||
"engines": { | ||
@@ -176,0 +176,0 @@ "node": ">= 10.13" |
@@ -66,3 +66,4 @@ /* eslint prefer-template: 0 */ | ||
noDragEventsBubbling: false, | ||
validator: null | ||
validator: null, | ||
useFsAccessApi: false, | ||
} | ||
@@ -170,2 +171,8 @@ | ||
/** | ||
* Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API | ||
* to open the file picker instead of using an `<input type="file">` click event. | ||
*/ | ||
useFsAccessApi: PropTypes.bool, | ||
/** | ||
* Cb for when the `dragenter` event occurs. | ||
@@ -366,2 +373,4 @@ * | ||
* @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection | ||
* @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API | ||
* to open the file picker instead of using an `<input type="file">` click event. | ||
* @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog | ||
@@ -417,2 +426,3 @@ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs. | ||
onFileDialogOpen, | ||
useFsAccessApi, | ||
preventDropOnDocument, | ||
@@ -459,3 +469,3 @@ noClick, | ||
useEffect(() => { | ||
if (canUseFileSystemAccessAPI()) { | ||
if (useFsAccessApi && canUseFileSystemAccessAPI()) { | ||
return () => {} | ||
@@ -468,3 +478,3 @@ } | ||
} | ||
}, [inputRef, isFileDialogActive, onFileDialogCancelCb]) | ||
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]) | ||
@@ -669,3 +679,3 @@ const dragTargetsRef = useRef([]) | ||
const openFileDialog = useCallback(() => { | ||
if (canUseFileSystemAccessAPI()) { | ||
if (useFsAccessApi && canUseFileSystemAccessAPI()) { | ||
dispatch({type: 'openDialog'}) | ||
@@ -696,2 +706,3 @@ onFileDialogOpenCb() | ||
onFileDialogCancelCb, | ||
useFsAccessApi, | ||
setFiles, | ||
@@ -698,0 +709,0 @@ accept, |
@@ -77,2 +77,6 @@ /* eslint import/no-extraneous-dependencies: 0 */ | ||
{ | ||
name: 'No JSX', | ||
content: 'examples/no-jsx/README.md' | ||
}, | ||
{ | ||
name: 'Extending Dropzone', | ||
@@ -79,0 +83,0 @@ content: 'examples/plugins/README.md' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394306
50
5998