@ -919,7 +919,7 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
case TASK _PAGE _DELETE :
case TASK _PAGE _DELETE :
url = API _DELETE _PAGE ;
url = API _DELETE _PAGE ;
event = TASK _PAGE _DELETE ;
event = TASK _PAGE _DELETE ;
content = CONTENT _TYPE _ JSON ;
content = CONTENT _TYPE _ FORM ;
break ;
break ;
default :
default :
break ;
break ;
@ -1685,7 +1685,7 @@ class PostEditor {
// event handlers
// event handlers
//--------------------------
//--------------------------
handlePostOptions ( e ) {
handlePostOptions ( e ) {
let currentOption ;
let currentOption = null ;
switch ( e . target . id ) {
switch ( e . target . id ) {
case "option-page-icon" :
case "option-page-icon" :
case "option-menu-pin" :
case "option-menu-pin" :
@ -1700,8 +1700,10 @@ class PostEditor {
currentOption = document . getElementById ( "option-published" ) ;
currentOption = document . getElementById ( "option-published" ) ;
break ;
break ;
}
}
let active = currentOption . getAttribute ( "data-active" ) ;
if ( currentOption != null ) {
active == "false" ? currentOption . setAttribute ( "data-active" , "true" ) : currentOption . setAttribute ( "data-active" , "false" ) ;
let active = currentOption . getAttribute ( "data-active" ) ;
active == "false" ? currentOption . setAttribute ( "data-active" , "true" ) : currentOption . setAttribute ( "data-active" , "false" ) ;
}
}
}
handleEditorOptions ( e1 ) {
handleEditorOptions ( e1 ) {
if ( this . processing ) return ;
if ( this . processing ) return ;
@ -1733,19 +1735,17 @@ class PostEditor {
notify . alert ( "Index cannot be deleted" , false ) ;
notify . alert ( "Index cannot be deleted" , false ) ;
return ;
return ;
}
}
if ( confirm ( "AYE! You know you're deleting this post, right?" ) ) {
if ( confirm ( "AYE! You know you're deleting this post, right?" ) ) new _pageActionsDefault . default ( ) . collectInfo ( document . getElementById ( "featured-image-upload" ) . files [ 0 ] ) . then ( ( page ) => {
let id = {
id : this . postUUID
} ;
self . processing = true ;
self . processing = true ;
this . admin . pageActions ( _fipamoAdminAPI . TASK _PAGE _DELETE , id ) . then ( ( ) => {
this . admin . pageActions ( _fipamoAdminAPI . TASK _PAGE _DELETE , page ) . then ( ( ) => {
self . processing = false ;
self . processing = false ;
window . location = "/dashboard/pages" ;
window . location = "/dashboard/pages" ;
} ) . catch ( ( err ) => {
} ) . catch ( ( err ) => {
self . processing = false ;
self . processing = false ;
notify . alert ( err , false ) ;
notify . alert ( err , false ) ;
} ) ;
} ) ;
}
} ) . catch ( ( ) => {
} ) ;
break ;
break ;
case _editorEvent . EDITOR _UPLOAD _POST _IMAGE :
case _editorEvent . EDITOR _UPLOAD _POST _IMAGE :
document . getElementById ( "post-image-upload" ) . click ( ) ;
document . getElementById ( "post-image-upload" ) . click ( ) ;
@ -1995,13 +1995,15 @@ class TextEditor extends _eventEmitterDefault.default {
case _dataEvent . PAGE _ADDED :
case _dataEvent . PAGE _ADDED :
break ;
break ;
case _editorEvent . EDITOR _UPLOAD _POST _IMAGE :
case _editorEvent . EDITOR _UPLOAD _POST _IMAGE :
let len = this . textEditor . value . length ;
{
let start = this . textEditor . selectionStart ;
let len = this . textEditor . value . length ;
let end = this . textEditor . selectionEnd ;
let start = this . textEditor . selectionStart ;
let insert = "![image alt text](" + data + ")" ;
let end = this . textEditor . selectionEnd ;
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
let insert = "![image alt text](" + data + ")" ;
document . getElementById ( "edit" ) . dispatchEvent ( new Event ( "input" ) ) ;
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
break ;
document . getElementById ( "edit" ) . dispatchEvent ( new Event ( "input" ) ) ;
break ;
}
}
}
}
}
// event handlers
// event handlers
@ -2039,10 +2041,12 @@ class TextEditor extends _eventEmitterDefault.default {
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
break ;
break ;
case "edit-link" :
case "edit-link" :
let url = prompt ( "Let's get that url, boss" ) ;
{
let link = url . toLowerCase ( ) ;
let url = prompt ( "Let's get that url, boss" ) ;
insert = "[" + selectedText + "](" + link + ")" ;
let link = url . toLowerCase ( ) ;
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
insert = "[" + selectedText + "](" + link + ")" ;
this . textEditor . value = this . textEditor . value . substring ( 0 , start ) + insert + this . textEditor . value . substring ( end , len ) ;
}
break ;
break ;
case "edit-image" :
case "edit-image" :
this . caretPos = _caretPos . position ( this . textEditor ) . pos ;
this . caretPos = _caretPos . position ( this . textEditor ) . pos ;