Commit 0f42a453ccc for woocommerce

commit 0f42a453cccab9aa45dc21c9c3cfd1caaea43b92
Author: Yuliyan Slavchev <yuliyan.slavchev@gmail.com>
Date:   Sat Mar 28 14:07:00 2026 +0200

    Disable Real-time Collaboration in the email editor (#63770)

    * Disable Real-time Collaboration in the email editor

    * Add changelog

    * Prevent adding the disable collab filter multiple times

    * Disable _wpCollaborationEnabled

diff --git a/packages/js/email-editor/changelog/stomail-7892-turn-off-real-time-collaboration-in-email-editor b/packages/js/email-editor/changelog/stomail-7892-turn-off-real-time-collaboration-in-email-editor
new file mode 100644
index 00000000000..73268d3b3bf
--- /dev/null
+++ b/packages/js/email-editor/changelog/stomail-7892-turn-off-real-time-collaboration-in-email-editor
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Disable Real-time Collaboration in the email editor
diff --git a/packages/js/email-editor/src/editor.tsx b/packages/js/email-editor/src/editor.tsx
index b8c801292f9..b6ace3a7663 100644
--- a/packages/js/email-editor/src/editor.tsx
+++ b/packages/js/email-editor/src/editor.tsx
@@ -9,7 +9,7 @@ import {
 	useState,
 	useMemo,
 } from '@wordpress/element';
-import { applyFilters } from '@wordpress/hooks';
+import { addFilter, applyFilters, hasFilter } from '@wordpress/hooks';
 import { store as editorStore } from '@wordpress/editor';
 import { useMergeRefs } from '@wordpress/compose';
 import '@wordpress/format-library'; // Enables text formatting capabilities
@@ -100,7 +100,31 @@ function Editor( {
 	);
 }

+/**
+ * WordPress 7.0 introduces Real-time Collaboration. The email editor does not
+ * yet fully support it, so we temporarily opt out by clearing sync providers.
+ */
+function disableCollab() {
+	if (
+		hasFilter( 'sync.providers', 'woocommerce/email-editor/disable-collab' )
+	) {
+		return;
+	}
+
+	if ( window._wpCollaborationEnabled ) {
+		window._wpCollaborationEnabled = false;
+	}
+
+	addFilter(
+		'sync.providers',
+		'woocommerce/email-editor/disable-collab',
+		() => [],
+		1000
+	);
+}
+
 function onInit() {
+	disableCollab();
 	initEventCollector();
 	initStoreTracking();
 	initDomTracking();
diff --git a/packages/js/email-editor/src/global.d.ts b/packages/js/email-editor/src/global.d.ts
index d78d7aa19d6..9378c2340de 100644
--- a/packages/js/email-editor/src/global.d.ts
+++ b/packages/js/email-editor/src/global.d.ts
@@ -1,4 +1,5 @@
 interface Window {
+	_wpCollaborationEnabled?: boolean;
 	WooCommerceEmailEditor: {
 		current_wp_user_email: string;
 		user_theme_post_id: number;