@ -398,17 +398,14 @@ async function onEditContent(event) {
}
}
} ;
} ;
const saveAndRefresh = ( dz , $dropzone ) => {
const saveAndRefresh = ( dz ) => {
showElem ( $renderContent ) ;
showElem ( $renderContent ) ;
hideElem ( $editContentZone ) ;
hideElem ( $editContentZone ) ;
const $attachments = $dropzone . find ( '.files' ) . find ( '[name=files]' ) . map ( function ( ) {
return $ ( this ) . val ( ) ;
} ) . get ( ) ;
$ . post ( $editContentZone . attr ( 'data-update-url' ) , {
$ . post ( $editContentZone . attr ( 'data-update-url' ) , {
_csrf : csrfToken ,
_csrf : csrfToken ,
content : comboMarkdownEditor . value ( ) ,
content : comboMarkdownEditor . value ( ) ,
context : $editContentZone . attr ( 'data-context' ) ,
context : $editContentZone . attr ( 'data-context' ) ,
files : $attachments ,
files : dz . files . map ( ( file ) => file . uuid ) ,
} , ( data ) => {
} , ( data ) => {
if ( ! data . content ) {
if ( ! data . content ) {
$renderContent . html ( $ ( '#no-content' ) . html ( ) ) ;
$renderContent . html ( $ ( '#no-content' ) . html ( ) ) ;
@ -452,7 +449,7 @@ async function onEditContent(event) {
} ) ;
} ) ;
$editContentZone . find ( '.save.button' ) . on ( 'click' , ( e ) => {
$editContentZone . find ( '.save.button' ) . on ( 'click' , ( e ) => {
e . preventDefault ( ) ;
e . preventDefault ( ) ;
saveAndRefresh ( dz , $dropzone ) ;
saveAndRefresh ( dz ) ;
} ) ;
} ) ;
} else {
} else {
comboMarkdownEditor = getComboMarkdownEditor ( $editContentZone . find ( '.combo-markdown-editor' ) ) ;
comboMarkdownEditor = getComboMarkdownEditor ( $editContentZone . find ( '.combo-markdown-editor' ) ) ;