mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(n8n Form Node): Duplicate popup in manual mode (#11925)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -82,25 +82,28 @@ export const executionFilterToQueryFilter = (
|
||||
return queryFilter;
|
||||
};
|
||||
|
||||
export const openPopUpWindow = (
|
||||
url: string,
|
||||
options?: { width?: number; height?: number; alwaysInNewTab?: boolean },
|
||||
) => {
|
||||
const windowWidth = window.innerWidth;
|
||||
const smallScreen = windowWidth <= 800;
|
||||
if (options?.alwaysInNewTab || smallScreen) {
|
||||
return window.open(url, '_blank');
|
||||
} else {
|
||||
const height = options?.width || 700;
|
||||
const width = options?.height || window.innerHeight - 50;
|
||||
let formPopupWindow: Window | null = null;
|
||||
|
||||
export const openFormPopupWindow = (url: string) => {
|
||||
if (!formPopupWindow || formPopupWindow.closed) {
|
||||
const height = 700;
|
||||
const width = window.innerHeight - 50;
|
||||
const left = (window.innerWidth - height) / 2;
|
||||
const top = 50;
|
||||
const features = `width=${height},height=${width},left=${left},top=${top},resizable=yes,scrollbars=yes`;
|
||||
const windowName = `form-waiting-since-${Date.now()}`;
|
||||
return window.open(url, windowName, features);
|
||||
formPopupWindow = window.open(url, windowName, features);
|
||||
} else {
|
||||
formPopupWindow.location = url;
|
||||
formPopupWindow.focus();
|
||||
}
|
||||
};
|
||||
|
||||
export const closeFormPopupWindow = () => {
|
||||
formPopupWindow?.close();
|
||||
formPopupWindow = null;
|
||||
};
|
||||
|
||||
export function displayForm({
|
||||
nodes,
|
||||
runData,
|
||||
@@ -131,7 +134,7 @@ export function displayForm({
|
||||
if (node.name === destinationNode || !node.disabled) {
|
||||
let testUrl = '';
|
||||
if (node.type === FORM_TRIGGER_NODE_TYPE) testUrl = getTestUrl(node);
|
||||
if (testUrl && source !== 'RunData.ManualChatMessage') openPopUpWindow(testUrl);
|
||||
if (testUrl && source !== 'RunData.ManualChatMessage') openFormPopupWindow(testUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user