@@ -165,21 +165,24 @@ function activateCodeSnippet(
165165 const highlightedCode = getSelectedText ( ) ;
166166 if ( highlightedCode === '' ) {
167167 //if user just right-clicks the whole cell to save
168- const curr = document . getElementsByClassName (
169- 'jp-Cell jp-mod-selected'
170- ) [ 1 ] ;
171- const text = curr as HTMLElement ;
172- const textContent = text . innerText ;
173- const arrayInput = textContent . split ( '\n' ) ;
174- const indexedInput = arrayInput . slice ( 1 ) ;
175- for ( let i = 0 ; i < indexedInput . length ; i ++ ) {
176- for ( let j = 0 ; j < indexedInput [ i ] . length ; j ++ ) {
177- if ( indexedInput [ i ] . charCodeAt ( j ) === 8203 ) {
178- indexedInput [ i ] = '' ;
168+ const curr = document . getElementsByClassName ( 'jp-Cell jp-mod-selected' ) ;
169+ const resultArray = [ ] ;
170+ for ( let i = 1 ; i < curr . length ; i ++ ) {
171+ const text = curr [ i ] as HTMLElement ;
172+ const textContent = text . innerText ;
173+ const arrayInput = textContent . split ( '\n' ) ;
174+ const indexedInput = arrayInput . slice ( 1 ) ;
175+ for ( let i = 0 ; i < indexedInput . length ; i ++ ) {
176+ for ( let j = 0 ; j < indexedInput [ i ] . length ; j ++ ) {
177+ if ( indexedInput [ i ] . charCodeAt ( j ) === 8203 ) {
178+ indexedInput [ i ] = '' ;
179+ }
179180 }
181+ resultArray . push ( indexedInput [ i ] ) ;
180182 }
181183 }
182- CodeSnippetInputDialog ( codeSnippetWidget , indexedInput , - 1 ) ;
184+ console . log ( resultArray ) ;
185+ CodeSnippetInputDialog ( codeSnippetWidget , resultArray , - 1 ) ;
183186 } else {
184187 CodeSnippetInputDialog (
185188 codeSnippetWidget ,
0 commit comments