diff --git a/.eslintrc b/.eslintrc index 0cc6e47e..b919c0ee 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,8 +1,5 @@ { - "globals": { - "HTMLOListElement": true, - "HTMLUListElement": true - }, + "globals": {}, "parserOptions": { "sourceType": "module", "ecmaVersion": 2020 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 79f91423..88494533 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -6,19 +6,6 @@ on: - master jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 19 - registry-url: https://registry.npmjs.org/ - - run: yarn install - - run: yarn build - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - publish-and-notify: uses: codex-team/github-workflows/.github/workflows/npm-publish-and-notify-reusable.yml@main secrets: diff --git a/package.json b/package.json index 8011e7b4..4666afa9 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "exports": { ".": { "import": "./dist/image.mjs", - "require": "./dist/image.umd.js" + "require": "./dist/image.umd.js", + "types": "./dist/index.d.ts" } }, "scripts": { diff --git a/src/uploader.ts b/src/uploader.ts index 38594e69..3f456ba9 100644 --- a/src/uploader.ts +++ b/src/uploader.ts @@ -72,7 +72,7 @@ export default class Uploader { // custom uploading if (this.config.uploader && typeof this.config.uploader.uploadByFile === 'function') { const uploadByFile = this.config.uploader.uploadByFile; - upload = ajax.selectFiles({ accept: this.config.types || ''}).then((files: File[]) => { + upload = ajax.selectFiles({ accept: this.config.types || 'image/*'}).then((files: File[]) => { preparePreview(files[0]); const customUpload = uploadByFile(files[0]); @@ -181,7 +181,7 @@ export default class Uploader { */ const formData = new FormData(); - formData.append(this.config.field || '', file); + formData.append(this.config.field || 'image', file); if (this.config.additionalRequestData && Object.keys(this.config.additionalRequestData).length) { Object.entries(this.config.additionalRequestData).forEach(([name, value]: [string, any]) => {