Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
home
/
ophq1335
/
public_html
/
wp-content
/
themes
/
Divi
/
core
/
code-snippets
/
app
/
store
/
edit
/
//home/ophq1335/public_html/wp-content/themes/Divi/core/code-snippets/app/store/edit/actions.js
// External dependencies. import { state, } from 'cerebral'; import { noop } from 'lodash'; // Internal dependencies. import { saveToCloudPure } from '@cloud/app/lib/api'; const saveToCloud = ({ get, props, path }) => { const itemId = get(state`edit.item.id`); const context = get(state`context`); let snippetContent = get(state`edit.content`); snippetContent = { ...snippetContent, data: props.content, }; return saveToCloudPure(context, { content: JSON.stringify(snippetContent) }, [], noop, itemId) .then(() => path.success()) .catch(() => path.error()); }; const saveToLocal = ({ codeSnippetsLibApi, path, props: { content }, get }) => { const itemId = get(state`edit.item.id`); return codeSnippetsLibApi.saveItemContent(itemId, content) .then(response => path.success({ snippet: response.snippet })) .catch(() => path.error()); }; export { saveToCloud, saveToLocal, };