File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed
js/modules/image-lightbox-gallery
exampleSite/content/gallery Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 204204 const titleDiv = createElementWithClass ( 'div' , LIGHTBOX_CLASSES . title ) ;
205205
206206 // Split the title by newline and filter out any empty lines
207- const titleLines = title . split ( '"' ) . map ( line => line . trim ( ) ) . filter ( line => line . length > 0 ) ;
207+ // Replace literal "\n" with actual newlines, then split by real newlines
208+ const normalizedTitle = title . replace ( / \\ n / g, '\n' ) ;
209+ const titleLines = normalizedTitle . split ( '\n' ) . map ( line => line . trim ( ) ) . filter ( line => line . length > 0 ) ;
208210
209211 titleLines . forEach ( ( line , index ) => {
210212 const titleSpan = document . createElement ( 'span' ) ;
216218 } else {
217219 titleSpan . classList . add ( 'additional-lines' ) ;
218220 }
219- line = line . replace ( / \\ n / g , '' ) ;
221+ // line = line.replace(' \\n' , '<br> ');
220222 titleSpan . textContent = line ;
221223 titleDiv . appendChild ( titleSpan ) ;
222224 } ) ;
Original file line number Diff line number Diff line change 105105.slide-lightbox-container {
106106 display : flex ;
107107 align-items : center ;
108- padding : 12px 12px 12px 6px ;
109108 position : absolute ;
110- top : 50% ;
111109 cursor : pointer ;
112110 z-index : 3 ;
113111 transform : translateY (-50% );
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ title: "Gallery Stack Resources Sample"
44thumbnail :
55 url : /img/bird.jpg
66
7- slug : " gallery-stack-res-img-sample1"
87resources :
98 - src : " img/bird.jpg"
109 title : " Example caption 1"
1110 params :
12- description : >
11+ description : |
1312 Description for bird image
1413 new line test
14+
1515 end of line
1616 cssClass : " size-large"
1717 - src : " img/city.jpg"
Original file line number Diff line number Diff line change 108108 {{- end -}}
109109
110110 {{ if ne $description "" }}
111- {{- $title = printf "%s"%q" $title $description -}}
111+ {{- $title = printf "%s \\n %s" $title $description -}}
112+ {{ $title = $title }}
112113 {{ end }}
113114
114115 {{ if eq $isError false }}
115116 <!-- Single Image Item -->
116- < div id ="{{ $imageUrl }} " class ="gallery-item {{ $randomClass }} " {{ $dataAttributes | safeHTMLAttr }} >
117+ < div id ="{{ $imageUrl }} " class ="gallery-item {{ $randomClass }} " {{ $dataAttributes | safeHTMLAttr }} aria-describedby =" {{ $title }} " >
117118 {{ partial "assets/image.html" (dict
118119 "url" $imageUrl
119120 "ratio" $ratio
120121 "page" $.Page
121122 "class" $imageCssClass
122123 "loading" $loading
123- "title" $title
124+ "title" $title
124125 "caption" $caption
125126 ) }}
126127 </ div >
You can’t perform that action at this time.
0 commit comments