mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated file name handling for audio card
refs https://github.com/TryGhost/Team/issues/1230 - adds a method to prettify filename from the audio file - cleanup
This commit is contained in:
parent
52530c2949
commit
e2db69d265
1 changed files with 8 additions and 14 deletions
|
@ -21,15 +21,9 @@ const PLACEHOLDERS = ['summer', 'mountains', 'ufo-attack'];
|
||||||
{
|
{
|
||||||
src: 'https://ghostsite.com/media/...',
|
src: 'https://ghostsite.com/media/...',
|
||||||
fileName: '...',
|
fileName: '...',
|
||||||
width: 640,
|
|
||||||
height: 480,
|
|
||||||
duration: 60,
|
duration: 60,
|
||||||
mimeType: 'audio/mp4'
|
mimeType: 'audio/mp4',
|
||||||
thumbnailSrc: 'https://ghostsite.com/images/...',
|
thumbnailSrc: 'https://ghostsite.com/content/media/...'
|
||||||
thumbnailWidth: 640,
|
|
||||||
thumbnailHeight: 640,
|
|
||||||
cardWidth: 'normal|wide|full',
|
|
||||||
loop: true|false (default: false)
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -97,11 +91,6 @@ export default class KoenigCardAudioComponent extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_afterRender() {
|
|
||||||
// this._placeCursorAtEnd();
|
|
||||||
// this._focusInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didInsert(element) {
|
didInsert(element) {
|
||||||
// required for snippet rects to be calculated - editor reaches in to component,
|
// required for snippet rects to be calculated - editor reaches in to component,
|
||||||
|
@ -179,10 +168,15 @@ export default class KoenigCardAudioComponent extends Component {
|
||||||
// TODO: Placeholder for any processing on audio upload
|
// TODO: Placeholder for any processing on audio upload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prettifyFileName(filename) {
|
||||||
|
let updatedName = filename.split('.').slice(0, -1).join('.').replace(/[-_]/g,' ').replace(/[^\w\s]+/g,'').replace(/\s\s+/g, ' ');
|
||||||
|
return updatedName.charAt(0).toUpperCase() + updatedName.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async audioUploadCompleted([audio]) {
|
async audioUploadCompleted([audio]) {
|
||||||
this.previewPayload.src = audio.url;
|
this.previewPayload.src = audio.url;
|
||||||
this.previewPayload.fileName = audio.fileName;
|
this.previewPayload.fileName = this.prettifyFileName(audio.fileName);
|
||||||
|
|
||||||
// save preview payload attrs into actual payload and create undo snapshot
|
// save preview payload attrs into actual payload and create undo snapshot
|
||||||
this.args.editor.run(() => {
|
this.args.editor.run(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue