@@ -116,6 +116,12 @@ define(function (require, exports, module) {
116116 description : Strings . LIVE_DEV_SETTINGS_SHOW_SPACING_HANDLES_PREFERENCE
117117 } ) ;
118118
119+ // live preview sync source and preview preference
120+ const PREFERENCE_LIVE_PREVIEW_SYNC = CONSTANTS . PREFERENCE_LIVE_PREVIEW_SYNC ;
121+ PreferencesManager . definePreference ( PREFERENCE_LIVE_PREVIEW_SYNC , "boolean" , true , {
122+ description : Strings . LIVE_DEV_SETTINGS_SYNC_SOURCE_AND_PREVIEW_PREFERENCE
123+ } ) ;
124+
119125 const LIVE_PREVIEW_PANEL_ID = "live-preview-panel" ;
120126 const LIVE_PREVIEW_IFRAME_ID = "panel-live-preview-frame" ;
121127 const LIVE_PREVIEW_IFRAME_HTML = `
@@ -333,22 +339,30 @@ define(function (require, exports, module) {
333339
334340 function _showModeSelectionDropdown ( event ) {
335341 const isEditFeaturesActive = isProEditUser ;
342+ const currentMode = LiveDevelopment . getCurrentMode ( ) ;
343+ const isNotPreviewMode = currentMode !== LiveDevelopment . CONSTANTS . LIVE_PREVIEW_MODE ;
336344 const items = [
337345 Strings . LIVE_PREVIEW_MODE_PREVIEW ,
338346 Strings . LIVE_PREVIEW_MODE_HIGHLIGHT ,
339347 Strings . LIVE_PREVIEW_MODE_EDIT
340348 ] ;
341349
350+ // Add sync toggle for highlight and edit modes
351+ if ( isNotPreviewMode ) {
352+ items . push ( "---" ) ;
353+ items . push ( Strings . LIVE_PREVIEW_SYNC_SOURCE_AND_PREVIEW ) ;
354+ }
355+
342356 // Only add edit highlight option if edit features are active
343357 if ( isEditFeaturesActive ) {
344- items . push ( "---" ) ;
358+ if ( ! isNotPreviewMode ) {
359+ items . push ( "---" ) ;
360+ }
345361 items . push ( Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON ) ;
346362 items . push ( Strings . LIVE_PREVIEW_SHOW_RULER_LINES ) ;
347363 items . push ( Strings . LIVE_PREVIEW_SHOW_SPACING_HANDLES ) ;
348364 }
349365
350- const currentMode = LiveDevelopment . getCurrentMode ( ) ;
351-
352366 $dropdown = new DropdownButton . DropdownButton ( "" , items , function ( item , index ) {
353367 if ( item === Strings . LIVE_PREVIEW_MODE_PREVIEW ) {
354368 // using empty spaces to keep content aligned
@@ -366,6 +380,12 @@ define(function (require, exports, module) {
366380 html : `${ checkmark } ${ item } ${ crownIcon } ` ,
367381 enabled : true
368382 } ;
383+ } else if ( item === Strings . LIVE_PREVIEW_SYNC_SOURCE_AND_PREVIEW ) {
384+ const isEnabled = PreferencesManager . get ( PREFERENCE_LIVE_PREVIEW_SYNC ) !== false ;
385+ if ( isEnabled ) {
386+ return `✓ ${ Strings . LIVE_PREVIEW_SYNC_SOURCE_AND_PREVIEW } ` ;
387+ }
388+ return `${ '\u00A0' . repeat ( 4 ) } ${ Strings . LIVE_PREVIEW_SYNC_SOURCE_AND_PREVIEW } ` ;
369389 } else if ( item === Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON ) {
370390 const isHoverMode =
371391 PreferencesManager . get ( PREFERENCE_PROJECT_ELEMENT_HIGHLIGHT ) === CONSTANTS . HIGHLIGHT_HOVER ;
@@ -422,6 +442,11 @@ define(function (require, exports, module) {
422442 Metrics . countEvent ( Metrics . EVENT_TYPE . PRO , "proUpsellDlg" , "fail" ) ;
423443 }
424444 }
445+ } else if ( item === Strings . LIVE_PREVIEW_SYNC_SOURCE_AND_PREVIEW ) {
446+ // Toggle sync source and preview on/off
447+ const currentValue = PreferencesManager . get ( PREFERENCE_LIVE_PREVIEW_SYNC ) ;
448+ PreferencesManager . set ( PREFERENCE_LIVE_PREVIEW_SYNC , currentValue === false ) ;
449+ return ; // Don't dismiss for this option
425450 } else if ( item === Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON ) {
426451 // Don't allow edit highlight toggle if edit features are not active
427452 if ( ! isEditFeaturesActive ) {
@@ -1252,11 +1277,15 @@ define(function (require, exports, module) {
12521277 PreferencesManager . on ( "change" , PREFERENCE_SHOW_SPACING_HANDLES , function ( ) {
12531278 LiveDevelopment . updateSpacingHandlesConfig ( ) ;
12541279 } ) ;
1280+ PreferencesManager . on ( "change" , PREFERENCE_LIVE_PREVIEW_SYNC , function ( ) {
1281+ LiveDevelopment . updateSyncConfig ( ) ;
1282+ } ) ;
12551283
1256- // Initialize element highlight, ruler lines, and spacing handles config on startup
1284+ // Initialize element highlight, ruler lines, spacing handles, and sync config on startup
12571285 LiveDevelopment . updateElementHighlightConfig ( ) ;
12581286 LiveDevelopment . updateRulerLinesConfig ( ) ;
12591287 LiveDevelopment . updateSpacingHandlesConfig ( ) ;
1288+ LiveDevelopment . updateSyncConfig ( ) ;
12601289
12611290 LiveDevelopment . openLivePreview ( ) ;
12621291 LiveDevelopment . on ( LiveDevelopment . EVENT_OPEN_PREVIEW_URL , _openLivePreviewURL ) ;
0 commit comments