|
|
import { EDITOR_STOP } from 'calypso/state/action-types'; |
|
|
import { withAnalytics, bumpStat } from 'calypso/state/analytics/actions'; |
|
|
import { setMediaModalView } from 'calypso/state/ui/media-modal/actions'; |
|
|
import { ModalViews } from 'calypso/state/ui/media-modal/constants'; |
|
|
|
|
|
import 'calypso/state/editor/init'; |
|
|
import 'calypso/state/ui/init'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const MODAL_VIEW_STATS = { |
|
|
[ ModalViews.LIST ]: 'view_list', |
|
|
[ ModalViews.DETAIL ]: 'view_detail', |
|
|
[ ModalViews.GALLERY ]: 'view_gallery', |
|
|
[ ModalViews.IMAGE_EDITOR ]: 'view_edit', |
|
|
[ ModalViews.VIDEO_EDITOR ]: 'view_edit', |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function stopEditingPost( siteId, postId ) { |
|
|
return { |
|
|
type: EDITOR_STOP, |
|
|
siteId, |
|
|
postId, |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setEditorMediaModalView( view ) { |
|
|
const action = setMediaModalView( view ); |
|
|
|
|
|
const stat = MODAL_VIEW_STATS[ view ]; |
|
|
if ( stat ) { |
|
|
return withAnalytics( bumpStat( 'editor_media_actions', stat ), action ); |
|
|
} |
|
|
|
|
|
return action; |
|
|
} |
|
|
|