@@ -113,6 +113,12 @@ define(function (require, exports, module) {
113113 description : Strings . LIVE_DEV_SETTINGS_ELEMENT_HIGHLIGHT_PREFERENCE
114114 } ) ;
115115
116+ // live preview image ribbon gallery preference (whether to show image gallery when clicking images)
117+ const PREFERENCE_PROJECT_IMAGE_RIBBON = "livePreviewImageRibbon" ;
118+ PreferencesManager . definePreference ( PREFERENCE_PROJECT_IMAGE_RIBBON , "boolean" , true , {
119+ description : "Show image gallery when clicked"
120+ } ) ;
121+
116122 const LIVE_PREVIEW_PANEL_ID = "live-preview-panel" ;
117123 const LIVE_PREVIEW_IFRAME_ID = "panel-live-preview-frame" ;
118124 const LIVE_PREVIEW_IFRAME_HTML = `
@@ -419,6 +425,7 @@ define(function (require, exports, module) {
419425 if ( isEditFeaturesActive ) {
420426 items . push ( "---" ) ;
421427 items . push ( Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON ) ;
428+ items . push ( "Show image gallery when clicked" ) ;
422429 }
423430
424431 const rawMode = PreferencesManager . get ( PREFERENCE_LIVE_PREVIEW_MODE ) || _getDefaultMode ( ) ;
@@ -444,6 +451,12 @@ define(function (require, exports, module) {
444451 return `✓ ${ Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON } ` ;
445452 }
446453 return `${ '\u00A0' . repeat ( 4 ) } ${ Strings . LIVE_PREVIEW_EDIT_HIGHLIGHT_ON } ` ;
454+ } else if ( item === "Show image gallery when clicked" ) {
455+ const isImageRibbonEnabled = PreferencesManager . get ( PREFERENCE_PROJECT_IMAGE_RIBBON ) !== false ;
456+ if ( isImageRibbonEnabled ) {
457+ return `✓ ${ item } ` ;
458+ }
459+ return `${ '\u00A0' . repeat ( 4 ) } ${ item } ` ;
447460 }
448461 return item ;
449462 } ) ;
@@ -492,6 +505,15 @@ define(function (require, exports, module) {
492505 const newMode = currentMode !== "click" ? "click" : "hover" ;
493506 PreferencesManager . set ( PREFERENCE_PROJECT_ELEMENT_HIGHLIGHT , newMode ) ;
494507 return ; // Don't dismiss highlights for this option
508+ } else if ( item === "Show image gallery when clicked" ) {
509+ // Don't allow image ribbon toggle if edit features are not active
510+ if ( ! isEditFeaturesActive ) {
511+ return ;
512+ }
513+ // Toggle image ribbon preference
514+ const currentEnabled = PreferencesManager . get ( PREFERENCE_PROJECT_IMAGE_RIBBON ) ;
515+ PreferencesManager . set ( PREFERENCE_PROJECT_IMAGE_RIBBON , ! currentEnabled ) ;
516+ return ; // Don't dismiss highlights for this option
495517 }
496518
497519 // need to dismiss the previous highlighting and stuff
@@ -1296,8 +1318,15 @@ define(function (require, exports, module) {
12961318 LiveDevelopment . updateElementHighlightConfig ( ) ;
12971319 } ) ;
12981320
1321+ // Handle image ribbon preference changes from this extension
1322+ PreferencesManager . on ( "change" , PREFERENCE_PROJECT_IMAGE_RIBBON , function ( ) {
1323+ LiveDevelopment . updateImageRibbonConfig ( ) ;
1324+ } ) ;
1325+
12991326 // Initialize element highlight config on startup
13001327 LiveDevelopment . updateElementHighlightConfig ( ) ;
1328+ // Initialize image ribbon config on startup
1329+ LiveDevelopment . updateImageRibbonConfig ( ) ;
13011330
13021331 LiveDevelopment . openLivePreview ( ) ;
13031332 LiveDevelopment . on ( LiveDevelopment . EVENT_OPEN_PREVIEW_URL , _openLivePreviewURL ) ;
0 commit comments