Skip to content

Commit

Permalink
docs: add faq (ant-design#45050)
Browse files Browse the repository at this point in the history
* docs: add faq

* link

* fix docs

* Update components/upload/index.zh-CN.md

Co-authored-by: 红 <[email protected]>
Signed-off-by: Amumu <[email protected]>

* Update components/upload/index.zh-CN.md

Co-authored-by: afc163 <[email protected]>
Signed-off-by: Amumu <[email protected]>

* Update components/upload/index.zh-CN.md

Signed-off-by: Amumu <[email protected]>

* Update components/upload/index.en-US.md

Signed-off-by: Amumu <[email protected]>

---------

Signed-off-by: Amumu <[email protected]>
Co-authored-by: 红 <[email protected]>
Co-authored-by: afc163 <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2023
1 parent 55190b6 commit bfc5728
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/upload/demo/directory.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## zh-CN

支持上传一个文件夹里的所有文件。
支持上传一个文件夹里的所有文件。 [Safari 里仍然能选择文件?]('#/%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8A%E4%BC%A0%E5%9C%A8%20Safari%20%E4%BB%8D%E7%84%B6%E5%8F%AF%E4%BB%A5%E9%80%89%E4%B8%AD%E6%96%87%E4%BB%B6')

## en-US

You can select and upload a whole directory.
You can select and upload a whole directory. [Can still select files when uploading a folder in Safari?]('#/Can%20still%20select%20files%20when%20uploading%20a%20folder%20in%20Safari')
8 changes: 8 additions & 0 deletions components/upload/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,11 @@ Ref:
- [#32672](https://github.com/ant-design/ant-design/issues/32672)
- [#32913](https://github.com/ant-design/ant-design/issues/32913)
- [#33988](https://github.com/ant-design/ant-design/issues/33988)

### Can still select files when uploading a folder in Safari?

Inside the upload component, we use the `directory` and `webkitdirectory` properties to control only directories can be selected. However, in Safari's implementation it doesn't seem to work. See [here](https://stackoverflow.com/q/55649945/3040605). Please try passing an additional `accept` attribute that cannot match any files. For example:

```jsx
accept: `.${'n'.repeat(100)}`;
```
8 changes: 8 additions & 0 deletions components/upload/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,11 @@ demo:
- [#32672](https://github.com/ant-design/ant-design/issues/32672)
- [#32913](https://github.com/ant-design/ant-design/issues/32913)
- [#33988](https://github.com/ant-design/ant-design/issues/33988)

### 文件夹上传在 Safari 仍然可以选中文件?

组件内部是以 `directory``webkitdirectory` 属性控制 input 来实现文件夹选择的, 但似乎在 Safari 的实现中,[并不会阻止用户选择文件](https://stackoverflow.com/q/55649945/3040605),请尝试额外传递无法匹配文件的 `accept` 属性来规避此问题 例如:

```jsx
accept: `.${'n'.repeat(100)}`;
```

0 comments on commit bfc5728

Please sign in to comment.