Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
cded5dff
Commit
cded5dff
authored
Sep 22, 2016
by
baiyaaaaa
Committed by
GitHub
Sep 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #125 from baiyaaaaa/master
misc update
parents
5bec4d7f
a94d35fb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
23 deletions
+1
-23
Makefile
Makefile
+1
-3
examples/assets/images/guide.png
examples/assets/images/guide.png
+0
-0
packages/upload/src/ajax.js
packages/upload/src/ajax.js
+0
-20
No files found.
Makefile
View file @
cded5dff
...
@@ -2,9 +2,7 @@
...
@@ -2,9 +2,7 @@
default
:
help
default
:
help
# build all theme
# build all theme
build-theme
:
build-theme-default
build-theme
:
build-theme-default
:
npm run build:theme
npm run build:theme
install
:
install
:
...
...
examples/assets/images/guide.png
View replaced file @
5bec4d7f
View file @
cded5dff
10.9 KB
|
W:
|
H:
10.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
packages/upload/src/ajax.js
View file @
cded5dff
...
@@ -20,17 +20,6 @@ function getBody(xhr) {
...
@@ -20,17 +20,6 @@ function getBody(xhr) {
}
}
}
}
// option {
// onProgress: (event: { percent: number }): void,
// onError: (event: Error, body?: Object): void,
// onSuccess: (body: Object): void,
// data: Object,
// filename: String,
// file: File,
// withCredentials: Boolean,
// action: String,
// headers: Object,
// }
export
default
function
upload
(
action
,
option
)
{
export
default
function
upload
(
action
,
option
)
{
if
(
typeof
XMLHttpRequest
===
'
undefined
'
)
{
if
(
typeof
XMLHttpRequest
===
'
undefined
'
)
{
return
;
return
;
...
@@ -61,8 +50,6 @@ export default function upload(action, option) {
...
@@ -61,8 +50,6 @@ export default function upload(action, option) {
};
};
xhr
.
onload
=
function
onload
()
{
xhr
.
onload
=
function
onload
()
{
// allow success when 2xx status
// see https://github.com/react-component/upload/issues/34
if
(
xhr
.
status
<
200
||
xhr
.
status
>=
300
)
{
if
(
xhr
.
status
<
200
||
xhr
.
status
>=
300
)
{
return
option
.
onError
(
getError
(
action
,
option
,
xhr
),
getBody
(
xhr
));
return
option
.
onError
(
getError
(
action
,
option
,
xhr
),
getBody
(
xhr
));
}
}
...
@@ -72,19 +59,12 @@ export default function upload(action, option) {
...
@@ -72,19 +59,12 @@ export default function upload(action, option) {
xhr
.
open
(
'
post
'
,
action
,
true
);
xhr
.
open
(
'
post
'
,
action
,
true
);
// Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
if
(
option
.
withCredentials
&&
'
withCredentials
'
in
xhr
)
{
if
(
option
.
withCredentials
&&
'
withCredentials
'
in
xhr
)
{
xhr
.
withCredentials
=
true
;
xhr
.
withCredentials
=
true
;
}
}
const
headers
=
option
.
headers
||
{};
const
headers
=
option
.
headers
||
{};
// when set headers['X-Requested-With'] = null , can close default XHR header
// see https://github.com/react-component/upload/issues/33
// if (headers['X-Requested-With'] !== null) {
// xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
// }
for
(
let
item
in
headers
)
{
for
(
let
item
in
headers
)
{
if
(
headers
.
hasOwnProperty
(
item
)
&&
headers
[
item
]
!==
null
)
{
if
(
headers
.
hasOwnProperty
(
item
)
&&
headers
[
item
]
!==
null
)
{
xhr
.
setRequestHeader
(
item
,
headers
[
item
]);
xhr
.
setRequestHeader
(
item
,
headers
[
item
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment