chore: lint
This commit is contained in:
@@ -110,29 +110,27 @@ export const BrowserWindow = () => {
|
|||||||
}, [screenShot, canvasRef, socket, screencastHandler]);
|
}, [screenShot, canvasRef, socket, screencastHandler]);
|
||||||
|
|
||||||
const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => {
|
const highlighterHandler = useCallback((data: { rect: DOMRect, selector: string, elementInfo: ElementInfo | null, childSelectors?: string[] }) => {
|
||||||
if (getList === true) {
|
if (getList === true) {
|
||||||
socket?.emit('setGetList', { getList: true });
|
socket?.emit('setGetList', { getList: true });
|
||||||
|
if (listSelector) {
|
||||||
if (listSelector) {
|
socket?.emit('listSelector', { selector: listSelector });
|
||||||
socket?.emit('listSelector', { selector: listSelector });
|
if (paginationMode) {
|
||||||
|
// In pagination mode, we want to set the highlighterData regardless of childSelectors
|
||||||
if (paginationMode) {
|
setHighlighterData(data);
|
||||||
// In pagination mode, we want to set the highlighterData regardless of childSelectors
|
} else if (data.childSelectors && data.childSelectors.includes(data.selector)) {
|
||||||
setHighlighterData(data);
|
// !Pagination mode: highlight only valid child elements within the listSelector
|
||||||
} else if (data.childSelectors && data.childSelectors.includes(data.selector)) {
|
setHighlighterData(data);
|
||||||
// !Pagination mode: highlight only valid child elements within the listSelector
|
} else {
|
||||||
setHighlighterData(data);
|
// If not a valid child in normal mode, clear the highlighter
|
||||||
|
setHighlighterData(null);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If not a valid child in normal mode, clear the highlighter
|
setHighlighterData(data); // Set highlighterData for the initial listSelector selection
|
||||||
setHighlighterData(null);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setHighlighterData(data); // Set highlighterData for the initial listSelector selection
|
setHighlighterData(data); // For non-list steps
|
||||||
}
|
}
|
||||||
} else {
|
}, [highlighterData, getList, socket, listSelector, paginationMode]);
|
||||||
setHighlighterData(data); // For non-list steps
|
|
||||||
}
|
|
||||||
}, [highlighterData, getList, socket, listSelector, paginationMode]);
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -191,11 +189,11 @@ export const BrowserWindow = () => {
|
|||||||
const paginationType = 'clickNext'; // You can get this from user selection or UI
|
const paginationType = 'clickNext'; // You can get this from user selection or UI
|
||||||
addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector });
|
addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector });
|
||||||
console.log(
|
console.log(
|
||||||
`Pagination mode: ${paginationType} with selector: ${highlighterData.selector}`
|
`Pagination mode: ${paginationType} with selector: ${highlighterData.selector}`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getList === true && !listSelector) {
|
if (getList === true && !listSelector) {
|
||||||
// Set listSelector
|
// Set listSelector
|
||||||
setListSelector(highlighterData.selector);
|
setListSelector(highlighterData.selector);
|
||||||
@@ -216,12 +214,12 @@ export const BrowserWindow = () => {
|
|||||||
attribute
|
attribute
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setFields(prevFields => ({
|
setFields(prevFields => ({
|
||||||
...prevFields,
|
...prevFields,
|
||||||
[newField.label]: newField
|
[newField.label]: newField
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (listSelector) {
|
if (listSelector) {
|
||||||
addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector });
|
addListStep(listSelector, { ...fields, [newField.label]: newField }, currentListId, { type: 'clickNext', selector: highlighterData.selector });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user