@@ -1448,6 +1448,12 @@ function RemoteFunctions(config = {}) {
14481448 </svg>
14491449 ` ,
14501450
1451+ ruler : `
1452+ <svg viewBox="0 0 24 24" fill="currentColor">
1453+ <path d="M8 3h1.5v18H8V3zm6.5 0H16v18h-1.5V3zM3 8v1.5h18V8H3zm0 6.5V16h18v-1.5H3z"/>
1454+ </svg>
1455+ ` ,
1456+
14511457 imageGallery : `
14521458 <svg viewBox="0 0 24 24" fill="currentColor">
14531459 <path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
@@ -1743,6 +1749,39 @@ function RemoteFunctions(config = {}) {
17431749 }
17441750 } ;
17451751
1752+ /**
1753+ * this is called when user clicks on the Show Ruler lines option in the more options dropdown
1754+ * @param {Event } event - click event
1755+ * @param {MoreOptionsDropdown } dropdown - the dropdown instance
1756+ */
1757+ function _handleToggleRulerLines ( event , dropdown ) {
1758+ config . showRulerLines = ! config . showRulerLines ;
1759+
1760+ window . _Brackets_MessageBroker . send ( {
1761+ livePreviewEditEnabled : true ,
1762+ type : "toggleRulerLines" ,
1763+ enabled : config . showRulerLines
1764+ } ) ;
1765+
1766+ // add checkmark in the dropdown
1767+ const checkmark = dropdown . _shadow . querySelector ( '[data-action="toggle-ruler-lines"] .item-checkmark' ) ;
1768+ if ( checkmark ) {
1769+ checkmark . textContent = config . showRulerLines ? '✓' : '' ;
1770+ }
1771+
1772+ // to apply the ruler lines or remove it when option is toggled
1773+ if ( config . showRulerLines && previouslyClickedElement ) {
1774+ if ( ! _currentRulerLines ) {
1775+ _currentRulerLines = new RulerLines ( previouslyClickedElement ) ;
1776+ }
1777+ } else {
1778+ if ( _currentRulerLines ) {
1779+ _currentRulerLines . remove ( ) ;
1780+ _currentRulerLines = null ;
1781+ }
1782+ }
1783+ }
1784+
17461785 /**
17471786 * the more options dropdown which appears when user clicks on the ellipsis button in the options box
17481787 */
@@ -1849,6 +1888,11 @@ function RemoteFunctions(config = {}) {
18491888 <span class="item-icon">${ ICONS . paste } </span>
18501889 <span class="item-label">${ config . strings . paste } </span>
18511890 </div>
1891+ <div class="dropdown-item" data-action="toggle-ruler-lines">
1892+ <span class="item-icon">${ ICONS . ruler } </span>
1893+ <span class="item-label">${ config . strings . showRulerLines } </span>
1894+ <span class="item-checkmark">${ config . showRulerLines ? '✓' : '' } </span>
1895+ </div>
18521896 </div>
18531897 ` ;
18541898
@@ -1912,6 +1956,12 @@ function RemoteFunctions(config = {}) {
19121956 .item-label {
19131957 flex: 1 !important;
19141958 }
1959+
1960+ .item-checkmark {
1961+ margin-left: auto !important;
1962+ padding-left: 12px !important;
1963+ font-size: 14px !important;
1964+ }
19151965 ` ;
19161966
19171967 shadow . innerHTML = `<style>${ styles } </style><div class="phoenix-dropdown">${ content } </div>` ;
@@ -1940,11 +1990,17 @@ function RemoteFunctions(config = {}) {
19401990 event . stopPropagation ( ) ;
19411991 event . preventDefault ( ) ;
19421992 const action = event . currentTarget . getAttribute ( 'data-action' ) ;
1943- handleOptionClick ( event , action , this . targetElement ) ;
1944- // when an option is selected we close both the dropdown as well as the options box
1945- this . remove ( ) ;
1946- if ( _nodeMoreOptionsBox ) {
1947- _nodeMoreOptionsBox . remove ( ) ;
1993+
1994+ if ( action === 'toggle-ruler-lines' ) {
1995+ // when ruler lines option is clicked we need to keep the dropdown open
1996+ _handleToggleRulerLines ( event , this ) ;
1997+ } else {
1998+ // for other options, we close both the dropdown as well as the options box
1999+ handleOptionClick ( event , action , this . targetElement ) ;
2000+ this . remove ( ) ;
2001+ if ( _nodeMoreOptionsBox ) {
2002+ _nodeMoreOptionsBox . remove ( ) ;
2003+ }
19482004 }
19492005 } ) ;
19502006 } ) ;
@@ -1956,6 +2012,14 @@ function RemoteFunctions(config = {}) {
19562012 this . body = null ;
19572013 _moreOptionsDropdown = null ;
19582014 }
2015+ } ,
2016+
2017+ refresh : function ( ) {
2018+ // update the checkmark state when config changes
2019+ const checkmark = this . _shadow . querySelector ( '[data-action="toggle-ruler-lines"] .item-checkmark' ) ;
2020+ if ( checkmark ) {
2021+ checkmark . textContent = config . showRulerLines ? '✓' : '' ;
2022+ }
19592023 }
19602024 } ;
19612025
@@ -5068,8 +5132,11 @@ function RemoteFunctions(config = {}) {
50685132 imageGallerySelected = config . imageGalleryState ;
50695133 }
50705134
5071- // handle ruler lines visibility toggle
5135+ // handle ruler lines visibility toggle and refresh the more options dropdown if its open
50725136 _handleRulerLinesConfigChange ( oldConfig ) ;
5137+ if ( _moreOptionsDropdown ) {
5138+ _moreOptionsDropdown . refresh ( ) ;
5139+ }
50735140
50745141 // Determine if configuration has changed significantly
50755142 const oldHighlightMode = oldConfig . elemHighlights ? oldConfig . elemHighlights . toLowerCase ( ) : "hover" ;
0 commit comments