Skip to content

Commit

Permalink
add a fileKey option for upload param name
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Aug 18, 2014
1 parent 407c9d2 commit 1a2d219
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 34 deletions.
23 changes: 15 additions & 8 deletions lib/simditor-all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lib/simditor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions site/_data/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
* `url` 文件上传的接口地址;
* `params` 键值对,指定文件上传接口的额外参数,上传的时候随文件一起提交;
* `fileKey` 服务器端获取文件数据的参数名;
* `connectionCount` 同时上传文件的最大数量;
* `leaveConfirm` 在文件上传过程中离开页面时提醒的文案。
Expand All @@ -83,6 +84,7 @@
upload:
url: ''
params: null
fileKey: 'upload_file'
connectionCount: 3
leaveConfirm: '正在上传文件,如果离开上传会自动取消'
```
Expand Down
23 changes: 15 additions & 8 deletions site/assets/scripts/simditor-all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/buttons/image.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ class ImageButton extends Button

createInput = =>
$input.remove() if $input
$input = $('<input type="file" title="上传图片" name="upload_file" accept="image/*">')
$input = $('<input type="file" title="上传图片" accept="image/*">')
.appendTo($uploadItem)

createInput()

$uploadItem.on 'click mousedown', 'input[name=upload_file]', (e) =>
$uploadItem.on 'click mousedown', 'input[type=file]', (e) =>
e.stopPropagation()

$uploadItem.on 'change', 'input[name=upload_file]', (e) =>
$uploadItem.on 'change', 'input[type=file]', (e) =>
if @editor.inputManager.focused
@editor.uploader.upload($input, {
inline: true
Expand Down Expand Up @@ -369,15 +369,15 @@ class ImagePopover extends Popover

createInput = =>
@input.remove() if @input
@input = $('<input type="file" title="上传图片" name="upload_file" accept="image/*">')
@input = $('<input type="file" title="上传图片" accept="image/*">')
.appendTo($uploadBtn)

createInput()

@el.on 'click mousedown', 'input[name=upload_file]', (e) =>
@el.on 'click mousedown', 'input[type=file]', (e) =>
e.stopPropagation()

@el.on 'change', 'input[name=upload_file]', (e) =>
@el.on 'change', 'input[type=file]', (e) =>
@editor.uploader.upload(@input, {
inline: true,
img: @target
Expand Down
12 changes: 6 additions & 6 deletions src/simditor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2881,15 +2881,15 @@ class ImageButton extends Button

createInput = =>
$input.remove() if $input
$input = $('<input type="file" title="上传图片" name="upload_file" accept="image/*">')
$input = $('<input type="file" title="上传图片" accept="image/*">')
.appendTo($uploadItem)

createInput()

$uploadItem.on 'click mousedown', 'input[name=upload_file]', (e) =>
$uploadItem.on 'click mousedown', 'input[type=file]', (e) =>
e.stopPropagation()

$uploadItem.on 'change', 'input[name=upload_file]', (e) =>
$uploadItem.on 'change', 'input[type=file]', (e) =>
if @editor.inputManager.focused
@editor.uploader.upload($input, {
inline: true
Expand Down Expand Up @@ -3158,15 +3158,15 @@ class ImagePopover extends Popover

createInput = =>
@input.remove() if @input
@input = $('<input type="file" title="上传图片" name="upload_file" accept="image/*">')
@input = $('<input type="file" title="上传图片" accept="image/*">')
.appendTo($uploadBtn)

createInput()

@el.on 'click mousedown', 'input[name=upload_file]', (e) =>
@el.on 'click mousedown', 'input[type=file]', (e) =>
e.stopPropagation()

@el.on 'change', 'input[name=upload_file]', (e) =>
@el.on 'change', 'input[type=file]', (e) =>
@editor.uploader.upload(@input, {
inline: true,
img: @target
Expand Down

0 comments on commit 1a2d219

Please sign in to comment.