Download wp-calypso/client/state/editor/actions.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/editor/actions.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/editor/actions.js
-
curl -L -o actions.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/editor/actions.js
1.41 kB
| 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'; | |
| /** | |
| * Constants | |
| */ | |
| 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', | |
| }; | |
| /** | |
| * Returns an action object to be used in signalling that the editor should | |
| * stop editing. | |
| * @param {number} siteId Site ID | |
| * @param {?number} postId Post ID | |
| * @returns {any} Action object | |
| */ | |
| export function stopEditingPost( siteId, postId ) { | |
| return { | |
| type: EDITOR_STOP, | |
| siteId, | |
| postId, | |
| }; | |
| } | |
| /** | |
| * Returns an action object used in signalling that the media modal current | |
| * view should be updated in the context of the post editor. | |
| * @param {ModalViews} view Media view | |
| * @returns {Object} Action object | |
| */ | |
| 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; | |
| } | |