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",
"default": "installPlugin"
},
"pluginZipFile": {
"pluginData": {
"type": "object",
"default": {
"resource": "url",

View file

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

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

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

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

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

View file

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

View file

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

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

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

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

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