New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jupyterlab/fileeditor-extension

Package Overview
Dependencies
Maintainers
5
Versions
383
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/fileeditor-extension - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

52

lib/index.js

@@ -10,2 +10,3 @@ "use strict";

var launcher_1 = require("@jupyterlab/launcher");
var coreutils_1 = require("@jupyterlab/coreutils");
/**

@@ -106,2 +107,8 @@ * The class name for the text editor icon from the default theme.

});
// Update the command registry when the notebook state changes.
tracker.currentChanged.connect(function () {
if (tracker.size <= 1) {
commands.notifyCommandChanged(CommandIDs.lineNumbers);
}
});
/**

@@ -133,2 +140,16 @@ * Toggle editor line numbers

}
/** To detect if there is no current selection */
function hasSelection() {
var widget = tracker.currentWidget;
if (!widget) {
return false;
}
var editor = widget.editor;
var selection = editor.getSelection();
if (selection.start.column === selection.end.column &&
selection.start.line === selection.end.line) {
return false;
}
return true;
}
commands.addCommand(CommandIDs.lineNumbers, {

@@ -168,14 +189,29 @@ execute: toggleLineNums,

}
// Get the selected code from the editor.
var code = "";
var editor = widget.editor;
var selection = editor.getSelection();
var start = editor.getOffsetAt(selection.start);
var end = editor.getOffsetAt(selection.end);
var targetText = editor.model.value.text.substring(start, end);
if (start == end) {
targetText = editor.getLine(selection.start.line);
var extension = widget.context.path.substring(widget.context.path.lastIndexOf("."));
if (!hasSelection() && coreutils_1.MarkdownCodeBlocks.isMarkdown(extension)) {
var codeBlocks = coreutils_1.MarkdownCodeBlocks.findMarkdownCodeBlocks(editor.model.value.text);
for (var _i = 0, codeBlocks_1 = codeBlocks; _i < codeBlocks_1.length; _i++) {
var codeBlock = codeBlocks_1[_i];
if (codeBlock.startLine <= editor.getSelection().start.line &&
editor.getSelection().start.line <= codeBlock.endLine) {
code = codeBlock.code;
break;
}
}
}
else {
// Get the selected code from the editor.
var selection = editor.getSelection();
var start = editor.getOffsetAt(selection.start);
var end = editor.getOffsetAt(selection.end);
code = editor.model.value.text.substring(start, end);
if (start == end) {
code = editor.getLine(selection.start.line);
}
}
var options = {
path: widget.context.path,
code: targetText,
code: code,
activate: false

@@ -182,0 +218,0 @@ };

15

package.json
{
"name": "@jupyterlab/fileeditor-extension",
"version": "0.5.0",
"version": "0.6.0",
"description": "JupyterLab - Editor Widget Extension",

@@ -15,8 +15,9 @@ "main": "lib/index.js",

"dependencies": {
"@jupyterlab/application": "^0.5.0",
"@jupyterlab/apputils": "^0.5.0",
"@jupyterlab/codeeditor": "^0.5.0",
"@jupyterlab/docregistry": "^0.5.0",
"@jupyterlab/fileeditor": "^0.5.0",
"@jupyterlab/launcher": "^0.5.0"
"@jupyterlab/application": "^0.6.0",
"@jupyterlab/apputils": "^0.6.0",
"@jupyterlab/codeeditor": "^0.6.0",
"@jupyterlab/coreutils": "^0.6.0",
"@jupyterlab/docregistry": "^0.6.0",
"@jupyterlab/fileeditor": "^0.6.0",
"@jupyterlab/launcher": "^0.6.0"
},

@@ -23,0 +24,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc