@@ -5032,6 +5032,28 @@ function RemoteFunctions(config = {}) {
50325032 _editHandler . apply ( edits ) ;
50335033 }
50345034
5035+ /**
5036+ * Handle ruler lines visibility toggle when config changes
5037+ * @param {Object } oldConfig - the prev config state
5038+ */
5039+ function _handleRulerLinesConfigChange ( oldConfig ) {
5040+ const rulerLinesChanged = oldConfig . showRulerLines !== config . showRulerLines ;
5041+ if ( rulerLinesChanged && previouslyClickedElement ) {
5042+ if ( config . showRulerLines ) {
5043+ // if user turned it on: create ruler lines for the element
5044+ if ( ! _currentRulerLines ) {
5045+ _currentRulerLines = new RulerLines ( previouslyClickedElement ) ;
5046+ }
5047+ } else {
5048+ // if user turned it off: remove the lines
5049+ if ( _currentRulerLines ) {
5050+ _currentRulerLines . remove ( ) ;
5051+ _currentRulerLines = null ;
5052+ }
5053+ }
5054+ }
5055+ }
5056+
50355057 function updateConfig ( newConfig ) {
50365058 const oldConfig = config ;
50375059 config = JSON . parse ( newConfig ) ;
@@ -5041,6 +5063,9 @@ function RemoteFunctions(config = {}) {
50415063 imageGallerySelected = config . imageGalleryState ;
50425064 }
50435065
5066+ // handle ruler lines visibility toggle
5067+ _handleRulerLinesConfigChange ( oldConfig ) ;
5068+
50445069 // Determine if configuration has changed significantly
50455070 const oldHighlightMode = oldConfig . elemHighlights ? oldConfig . elemHighlights . toLowerCase ( ) : "hover" ;
50465071 const newHighlightMode = getHighlightMode ( ) ;
0 commit comments