Skip to content

Commit

Permalink
feat: custom operation support sortablejs method
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Feb 8, 2021
1 parent 52c3159 commit 939d453
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ReactDOM.render(
## :clipboard: API

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| --- | --- | --- | --- | --- | --- | --- |
| className | `string` | `-` | Additional CSS class for the root DOM node |
| audioLists | [AudioListProps[]](#bulb-audiolistprops) | `-` | [Detail](#bulb-audiolistprops) |
| theme | `light` \| `dark` \| `auto` | `dark` | color of the music player theme `dark`, `light`, `auto (follow system)` | `light` |
Expand Down Expand Up @@ -223,6 +223,7 @@ Support feature:
- `play prev audio`
- `play audio by custom play index`
- `update play index`
- [SortableJS methods](https://github.com/SortableJS/Sortable#methods)

```jsx
class App extends React.Component {
Expand Down Expand Up @@ -280,8 +281,8 @@ class App extends React.Component {
```
<p>
<img alt="glass-1" src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/glass-1.png" width="200" max-width="49%">
<img alt="glass-2" src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/glass-2.png" width="200" max-width="49%">
<img alt="glass-1" src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/glass-1.png?raw=true" width="200" max-width="49%">
<img alt="glass-2" src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/glass-2.png?raw=true" width="200" max-width="49%">
</p>
## :bulb: Custom downloader
Expand Down Expand Up @@ -526,7 +527,7 @@ export interface ReactJkMusicPlayerIcon {
<ReactJkMusicPlayer theme="auto" />
```

![auto-theme](https://github.com/lijinke666/react-music-player/blob/master/assetsImg/auto-theme.gif)
![auto-theme](https://github.com/lijinke666/react-music-player/blob/master/assetsImg/auto-theme.gif?raw=true)

## :bulb: Quiet update

Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface ReactJkMusicPlayerInstance extends HTMLAudioElement {
fromIndex: number,
audioLists: ReactJkMusicPlayerAudioListProps[],
) => void
sortable?: any
}

export interface ReactJkMusicPlayerIcon {
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,10 @@ export default class ReactJkMusicPlayer extends PureComponent {
name: 'appendAudio',
value: this.appendAudio,
},
{
name: 'sortable',
value: this.sortable,
},
].forEach(({ name, value }) => {
Object.defineProperty(audio, name, {
value,
Expand Down Expand Up @@ -2423,7 +2427,7 @@ export default class ReactJkMusicPlayer extends PureComponent {
this.addMobileListener()
this.addSystemThemeListener()
this.initPlayer()
this.onGetAudioInstance()
this.initSortableAudioLists()
this.onGetAudioInstance()
}
}

0 comments on commit 939d453

Please sign in to comment.