Skip to content

Commit c3a9066

Browse files
committed
Single cell saving working with right click and shortcut
1 parent e50ea06 commit c3a9066

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

schema/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"command": "codeSnippet:save-as-snippet",
55
"keys": ["Accel Shift A"],
6-
"selector": ".jp-Cell"
6+
"selector": ".jp-Notebook"
77
},
88
{
99
"command": "codeSnippet:save-as-snippet",

src/CodeSnippetDisplay.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,7 @@ export class CodeSnippetDisplay extends React.Component<
535535
private _setPreviewPosition(id: string): void {
536536
const intID = parseInt(id, 10);
537537
const realTarget = document.getElementsByClassName(TITLE_CLASS)[intID];
538-
const newTarget = document.getElementsByClassName('jp-codeSnippet-item')[
539-
intID
540-
];
538+
const newTarget = document.getElementsByClassName(CODE_SNIPPET_ITEM)[intID];
541539
// distDown is the number of pixels to shift the preview down
542540
const distDown: number = realTarget.getBoundingClientRect().top - 43; //this is bumping it up
543541
const elementSnippet = newTarget as HTMLElement;

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ function activateCodeSnippet(
169169
'jp-Cell jp-mod-selected'
170170
)[1];
171171
const text = curr as HTMLElement;
172-
let textContent = text.innerText;
173-
textContent = textContent.replace(/\uFFFD/g, '');
172+
const textContent = text.innerText;
174173
const arrayInput = textContent.split('\n');
175174
const indexedInput = arrayInput.slice(1);
176175
for (let i = 0; i < indexedInput.length; i++) {

0 commit comments

Comments
 (0)