Skip to content

Commit

Permalink
Fix CodeMirrorEditor for JupyterLab support
Browse files Browse the repository at this point in the history
Modified the regexp used to detect the CodeMirror root element during
CodeMirror detection. Now it checks to make sure the class it is looking for
*starts* with CodeMirror, as opposed to just containing “CodeMirror”.
This prevents it from matching `jp-CodeMirrorEditor`, which is a Jupyter
wrapper class that doesn’t expose the correct API.
  • Loading branch information
smackesey authored and glacambre committed Jul 5, 2020
1 parent 45188db commit d788cf6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/editors/CodeMirrorEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class CodeMirrorEditor extends AbstractEditor {
let parent = e;
for (let i = 0; i < 3; ++i) {
if (parent !== undefined && parent !== null) {
if ((/CodeMirror/gi).test(parent.className)) {
if ((/(\A| )CodeMirror/gi).test(parent.className)) {
return true;
}
parent = parent.parentElement;
Expand Down

0 comments on commit d788cf6

Please sign in to comment.