@jupyterlab/codemirror
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var CodeMirror = require("codemirror"); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var CodeMirror = require("codemirror"); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -77,3 +77,3 @@ var CodeMirror = require("codemirror"); | ||
CodeMirror.on(editor, 'cursorActivity', function () { return _this._onCursorActivity(); }); | ||
CodeMirror.on(editor.getDoc(), 'change', function (instance, change) { | ||
CodeMirror.on(editor.getDoc(), 'beforeChange', function (instance, change) { | ||
_this._onDocChanged(instance, change); | ||
@@ -569,3 +569,19 @@ }); | ||
this._changeGuard = true; | ||
this.doc.setValue(this._model.value.text); | ||
var doc = this.doc; | ||
switch (args.type) { | ||
case 'insert': | ||
var pos = doc.posFromIndex(args.start); | ||
doc.replaceRange(args.value, pos, pos); | ||
break; | ||
case 'remove': | ||
var from = doc.posFromIndex(args.start); | ||
var to = doc.posFromIndex(args.end); | ||
doc.replaceRange('', from, to); | ||
break; | ||
case 'set': | ||
doc.setValue(args.value); | ||
break; | ||
default: | ||
break; | ||
} | ||
this._changeGuard = false; | ||
@@ -581,3 +597,12 @@ }; | ||
this._changeGuard = true; | ||
this._model.value.text = this.doc.getValue(); | ||
var value = this._model.value; | ||
var start = doc.indexFromPos(change.from); | ||
var end = doc.indexFromPos(change.to); | ||
var inserted = change.text.join('\n'); | ||
if (end !== start) { | ||
value.remove(start, end); | ||
} | ||
if (inserted) { | ||
value.insert(start, inserted); | ||
} | ||
this._changeGuard = false; | ||
@@ -584,0 +609,0 @@ }; |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var editor_1 = require("./editor"); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
function __export(m) { | ||
@@ -5,0 +5,0 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; |
@@ -0,7 +1,8 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var CodeMirror = require("codemirror"); | ||
var codeeditor_1 = require("@jupyterlab/codeeditor"); | ||
var coreutils_1 = require("@jupyterlab/coreutils"); | ||
var _1 = require("."); | ||
@@ -44,2 +45,5 @@ /** | ||
CodeMirrorMimeTypeService.prototype.getMimeTypeByFilePath = function (path) { | ||
if (coreutils_1.PathExt.extname(path) === '.ipy') { | ||
return 'text/x-python'; | ||
} | ||
var mode = CodeMirror.findModeByFileName(path); | ||
@@ -46,0 +50,0 @@ return mode ? mode.mime : codeeditor_1.IEditorMimeTypeService.defaultMimeType; |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var CodeMirror = require("codemirror"); |
{ | ||
"name": "@jupyterlab/codemirror", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "JupyterLab - CodeMirror Editor Provider", | ||
@@ -16,4 +16,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@jupyterlab/codeeditor": "^0.3.0", | ||
"@jupyterlab/coreutils": "^0.3.0", | ||
"@jupyterlab/codeeditor": "^0.3.1", | ||
"@jupyterlab/coreutils": "^0.3.1", | ||
"@phosphor/algorithm": "^1.0.0", | ||
@@ -20,0 +20,0 @@ "@phosphor/disposable": "^1.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48915
1463