fixed deprecated step from install-plugin and install-theme

This commit is contained in:
Cy-Yaksh 2025-01-16 18:17:03 +05:30 committed by Ajit Bohra
parent 2253c4cc3f
commit 08812b6483
4 changed files with 18 additions and 18 deletions

View file

@ -16,7 +16,7 @@
"type": "string", "type": "string",
"default": "installPlugin" "default": "installPlugin"
}, },
"pluginZipFile": { "pluginData": {
"type": "object", "type": "object",
"default": { "default": {
"resource": "url", "resource": "url",

View file

@ -31,8 +31,8 @@ import { Picker } from '../../../components';
* @return {Element} Element to render. * @return {Element} Element to render.
*/ */
function Edit({ attributes, setAttributes, isSelected }) { function Edit({ attributes, setAttributes, isSelected }) {
const { pluginZipFile, options } = attributes; const { pluginData, options } = attributes;
const { resource, path, url, slug } = pluginZipFile; const { resource, path, url, slug } = pluginData;
const { activate } = options; const { activate } = options;


const handleResourceChange = (newResource) => { const handleResourceChange = (newResource) => {
@ -42,22 +42,22 @@ function Edit({ attributes, setAttributes, isSelected }) {


// Conditionally add attributes based on the selected resource // Conditionally add attributes based on the selected resource
if (newResource === 'vfs') { if (newResource === 'vfs') {
newAttributes.path = pluginZipFile.path || ''; newAttributes.path = pluginData.path || '';
} else if (newResource === 'url') { } else if (newResource === 'url') {
newAttributes.url = pluginZipFile.url || ''; newAttributes.url = pluginData.url || '';
} else if (newResource === 'wordpress.org/plugins') { } else if (newResource === 'wordpress.org/plugins') {
newAttributes.slug = pluginZipFile.slug || ''; newAttributes.slug = pluginData.slug || '';
} }


setAttributes({ setAttributes({
pluginZipFile: newAttributes pluginData: newAttributes
}); });
}; };


const handleInputChange = (field, value) => { const handleInputChange = (field, value) => {
setAttributes({ setAttributes({
pluginZipFile: { pluginData: {
...pluginZipFile, ...pluginData,
[field]: value [field]: value
} }
}); });

View file

@ -15,7 +15,7 @@
"type": "string", "type": "string",
"default": "installTheme" "default": "installTheme"
}, },
"themeZipFile": { "themeData": {
"type": "object", "type": "object",
"default": { "default": {
"resource": "url", "resource": "url",

View file

@ -33,8 +33,8 @@ import { Picker } from '../../../components';
* @return {Element} Element to render. * @return {Element} Element to render.
*/ */
function Edit({ attributes, setAttributes, isSelected }) { function Edit({ attributes, setAttributes, isSelected }) {
const { themeZipFile, options } = attributes; const { themeData, options } = attributes;
const { resource, path, url, slug } = themeZipFile; const { resource, path, url, slug } = themeData;
const { activate, importStarterContent } = options; const { activate, importStarterContent } = options;


const handleResourceChange = (newResource) => { const handleResourceChange = (newResource) => {
@ -44,22 +44,22 @@ function Edit({ attributes, setAttributes, isSelected }) {


// Conditionally add attributes based on the selected resource // Conditionally add attributes based on the selected resource
if (newResource === 'vfs') { if (newResource === 'vfs') {
newAttributes.path = themeZipFile.path || ''; newAttributes.path = themeData.path || '';
} else if (newResource === 'url') { } else if (newResource === 'url') {
newAttributes.url = themeZipFile.url || ''; newAttributes.url = themeData.url || '';
} else if (newResource === 'wordpress.org/themes') { } else if (newResource === 'wordpress.org/themes') {
newAttributes.slug = themeZipFile.slug || ''; newAttributes.slug = themeData.slug || '';
} }


setAttributes({ setAttributes({
themeZipFile: newAttributes themeData: newAttributes
}); });
}; };


const handleInputChange = (field, value) => { const handleInputChange = (field, value) => {
setAttributes({ setAttributes({
themeZipFile: { themeData: {
...themeZipFile, ...themeData,
[field]: value [field]: value
} }
}); });