mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(editor): Fix emitting n8nReady notification via postmessage on new canvas (#11558)
This commit is contained in:
@@ -1276,7 +1276,13 @@ function removeSourceControlEventBindings() {
|
|||||||
|
|
||||||
function addPostMessageEventBindings() {
|
function addPostMessageEventBindings() {
|
||||||
window.addEventListener('message', onPostMessageReceived);
|
window.addEventListener('message', onPostMessageReceived);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removePostMessageEventBindings() {
|
||||||
|
window.removeEventListener('message', onPostMessageReceived);
|
||||||
|
}
|
||||||
|
|
||||||
|
function emitPostMessageReady() {
|
||||||
if (window.parent) {
|
if (window.parent) {
|
||||||
window.parent.postMessage(
|
window.parent.postMessage(
|
||||||
JSON.stringify({ command: 'n8nReady', version: rootStore.versionCli }),
|
JSON.stringify({ command: 'n8nReady', version: rootStore.versionCli }),
|
||||||
@@ -1285,10 +1291,6 @@ function addPostMessageEventBindings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePostMessageEventBindings() {
|
|
||||||
window.removeEventListener('message', onPostMessageReceived);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onPostMessageReceived(messageEvent: MessageEvent) {
|
async function onPostMessageReceived(messageEvent: MessageEvent) {
|
||||||
if (
|
if (
|
||||||
!messageEvent ||
|
!messageEvent ||
|
||||||
@@ -1516,6 +1518,8 @@ onBeforeMount(() => {
|
|||||||
if (!isDemoRoute.value) {
|
if (!isDemoRoute.value) {
|
||||||
pushConnectionStore.pushConnect();
|
pushConnectionStore.pushConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addPostMessageEventBindings();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -1536,6 +1540,8 @@ onMounted(() => {
|
|||||||
canvasStore.stopLoading();
|
canvasStore.stopLoading();
|
||||||
|
|
||||||
void externalHooks.run('nodeView.mount').catch(() => {});
|
void externalHooks.run('nodeView.mount').catch(() => {});
|
||||||
|
|
||||||
|
emitPostMessageReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
void usersStore.showPersonalizationSurvey();
|
void usersStore.showPersonalizationSurvey();
|
||||||
@@ -1544,7 +1550,6 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
addSourceControlEventBindings();
|
addSourceControlEventBindings();
|
||||||
addPostMessageEventBindings();
|
|
||||||
addWorkflowSavedEventBindings();
|
addWorkflowSavedEventBindings();
|
||||||
addBeforeUnloadEventBindings();
|
addBeforeUnloadEventBindings();
|
||||||
addImportEventBindings();
|
addImportEventBindings();
|
||||||
|
|||||||
Reference in New Issue
Block a user