diff --git a/.vscode/launch.json b/.vscode/launch.json index 064e105086..8a476bb025 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "type": "edge", + "type": "msedge", "request": "launch", "name": "Launch Microsoft Edge", "url": "http://localhost:5000/samples/", diff --git a/CHANGELOG.md b/CHANGELOG.md index 537eeeabe8..e2910656b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- Resolves [#5081](https://github.com/microsoft/BotFramework-WebChat/issues/5081). Added `uploadAccept` and `uploadMultiple` style options, by [@ms-jb](https://github.com/ms-jb) + ### Changed - Moved pull request validation pipeline to GitHub Actions, by [@compulim](https://github.com/compulim), in PR [#4976](https://github.com/microsoft/BotFramework-WebChat/pull/4976) diff --git a/__tests__/html/attachment.allowedFileTypes.html b/__tests__/html/attachment.allowedFileTypes.html new file mode 100644 index 0000000000..42467e6582 --- /dev/null +++ b/__tests__/html/attachment.allowedFileTypes.html @@ -0,0 +1,38 @@ + + +
+ + + + + + + + + + diff --git a/__tests__/html/attachment.allowedFileTypes.js b/__tests__/html/attachment.allowedFileTypes.js new file mode 100644 index 0000000000..a9987e7163 --- /dev/null +++ b/__tests__/html/attachment.allowedFileTypes.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('Attachment', () => { + test('with allowed file types', () => + runHTML('attachment.allowedFileTypes.html')); +}); diff --git a/packages/api/src/StyleOptions.ts b/packages/api/src/StyleOptions.ts index e743bf2532..251432b47e 100644 --- a/packages/api/src/StyleOptions.ts +++ b/packages/api/src/StyleOptions.ts @@ -259,6 +259,18 @@ type StyleOptions = { microphoneButtonColorOnDictate?: string; sendBoxBackground?: string; + /** + * The comma-delimited file types that the upload button should accept. + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept + * @example 'image/*,.pdf' + */ + uploadAccept?: string; + /** + * If true, the upload button will accept multiple files. + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple + */ + uploadMultiple?: boolean; + /** Send box button: Icon color, defaults to subtle */ sendBoxButtonColor?: string; diff --git a/packages/api/src/defaultStyleOptions.ts b/packages/api/src/defaultStyleOptions.ts index d1543dc7b3..9b4ed3efda 100644 --- a/packages/api/src/defaultStyleOptions.ts +++ b/packages/api/src/defaultStyleOptions.ts @@ -95,6 +95,8 @@ const DEFAULT_OPTIONS: Required