File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,13 @@ export function makeCodeCopyButton(): HTMLButtonElement {
88}
99
1010export function initMarkupCodeCopy ( elMarkup : HTMLElement ) : void {
11- const el = elMarkup . querySelector ( '.code-wrapper' ) ; // .markup .code-block code
12- if ( ! el || ! el . textContent ) return ;
11+ const els = elMarkup . querySelectorAll ( '.code-wrapper' ) ; // .markup .code-block code
1312
14- const btn = makeCodeCopyButton ( ) ;
15- // remove final trailing newline introduced during HTML rendering
16- btn . setAttribute ( 'data-clipboard-text' , el . textContent . replace ( / \r ? \n $ / , '' ) ) ;
17- el . append ( btn ) ;
13+ for ( const el of els ) {
14+ if ( ! el || ! el . textContent ) return ;
15+ const btn = makeCodeCopyButton ( ) ;
16+ // remove final trailing newline introduced during HTML rendering
17+ btn . setAttribute ( 'data-clipboard-text' , el . textContent . replace ( / \r ? \n $ / , '' ) ) ;
18+ el . append ( btn ) ;
19+ }
1820}
You can’t perform that action at this time.
0 commit comments