Skip to content

Commit 9afcd9d

Browse files
committed
Save snippet on right click on cell.
1 parent 019ce4a commit 9afcd9d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,17 @@ function activateCodeSnippet(
189189
'jp-Cell jp-mod-selected'
190190
)[1];
191191
const text = curr as HTMLElement;
192-
const textContent = text.innerText;
192+
let textContent = text.innerText;
193+
textContent = textContent.replace(/\uFFFD/g, '');
193194
const arrayInput = textContent.split('\n');
194195
const indexedInput = arrayInput.slice(1);
195-
// console.log(textContent);
196-
// for (let i = 0; i < indexedInput.length; i++) {
197-
// console.log(indexedInput[i]);
198-
// }
196+
for (let i = 0; i < indexedInput.length; i++) {
197+
for (let j = 0; j < indexedInput[i].length; j++) {
198+
if (indexedInput[i].charCodeAt(j) === 8203) {
199+
indexedInput[i] = '';
200+
}
201+
}
202+
}
199203
CodeSnippetInputDialog(codeSnippetWidget, indexedInput, -1);
200204
} else {
201205
CodeSnippetInputDialog(

0 commit comments

Comments
 (0)