diff --git a/manifest.json b/manifest.json index 1c542c7..75c5e00 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "JDN", "description": "", "devtools_page": "index.html", - "version": "3.0.39", + "version": "3.0.40", "permissions": [ "activeTab", "tabs", diff --git a/package.json b/package.json index e9383ce..15353c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jdi-react-extension", - "version": "3.0.39", + "version": "3.0.40", "description": "jdi react extension", "scripts": { "start": "npm run webpack", diff --git a/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx b/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx index baf5c30..d35de19 100644 --- a/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx +++ b/src/js/blocks/autoFind/autoFindProvider/AutoFindProvider.jsx @@ -104,11 +104,11 @@ const AutoFindProvider = inject("mainModel")( }); }; - const changeElementName = (id, name) => { + const changeElementName = ({id, name}) => { setPredictedElements((previousValue) => { const renamed = previousValue.map((el) => { if (el.element_id === id) { - el.jdi_class_name = name; + el.jdi_custom_class_name = name; sendMessage.changeElementName(el); } return el; diff --git a/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js b/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js index 1a6a180..a021cec 100644 --- a/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js +++ b/src/js/blocks/autoFind/autoFindProvider/contentScripts/contextMenu/contextmenu.js @@ -354,11 +354,11 @@ export const runContextMenu = () => { let predictedElement; const menuItems = ( - { jdi_class_name, element_id, skipGeneration }, + { jdi_class_name, jdi_custom_class_name = null, element_id, skipGeneration }, types ) => [ { - text: `Change name: ${jdi_class_name} `, + text: `Change name: ${jdi_custom_class_name ? jdi_custom_class_name : jdi_class_name} `, events: { click: () => changeElementNameModal(element_id, jdi_class_name), }, diff --git a/src/js/blocks/autoFind/autoFindProvider/pageObject.js b/src/js/blocks/autoFind/autoFindProvider/pageObject.js index 720fc14..78d5fa4 100644 --- a/src/js/blocks/autoFind/autoFindProvider/pageObject.js +++ b/src/js/blocks/autoFind/autoFindProvider/pageObject.js @@ -26,15 +26,22 @@ export const predictedToConvert = (elements) => { return f.map((e, i) => { let elementName = getElementName(e); let elementTagId = e.predictedAttrId; + let customElementName = e.jdi_custom_class_name; if (uniqueNames.indexOf(elementName) >= 0) elementName += i; if (elementTagId && uniqueNames.indexOf(elementTagId) >= 0) elementTagId += i; uniqueNames.push(elementTagId, elementName); + const name = customElementName + ? customElementName + : elementTagId + ? elementTagId + : elementName; + return { ...e, Locator: e.xpath, - Name: elementTagId ? elementTagId : elementName, + Name: name, Type: getJDILabel(e.predicted_label), parent: null, parentId: null,