Skip to content

Commit

Permalink
feat(client): add uplodImage custom method
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming committed Dec 9, 2020
1 parent 134ecb2 commit 35abb56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function Context(props) {
ds: gravatarSetting.ds,
params: `?d=${(gravatarSetting.ds.indexOf(props.avatar) > -1 ? props.avatar : 'mp')}${props.avatarForce ? '&q=' + Math.random().toString(32).substring(2) : ''}`
},
uploadImage(file) {
uploadImage: typeof props.uploadImage === 'function' ? props.uploadImage : function(file) {
const formData = new FormData();
formData.append('file', file);

Expand Down
4 changes: 3 additions & 1 deletion packages/client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default function Waline({
emojiMaps,
requiredFields = [],
copyRight = true,
visitor = false
visitor = false,
uploadImage
} = {}) {
//阅读统计
if(visitor) {
Expand Down Expand Up @@ -70,6 +71,7 @@ export default function Waline({
avatar={avatar}
avatarCDN={avatarCDN}
avatarFore={avatarForce}
uploadImage={uploadImage}
>
<App
boxConfig={{serverURL, placeholder, meta, highlight, requiredFields, path}}
Expand Down

0 comments on commit 35abb56

Please sign in to comment.