@jupyterlab/codemirror
Advanced tools
Comparing version 4.0.7 to 4.0.8
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
import { closeBrackets } from '@codemirror/autocomplete'; | ||
import { closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete'; | ||
import { defaultKeymap, indentLess } from '@codemirror/commands'; | ||
import { bracketMatching, foldGutter, indentOnInput, indentUnit } from '@codemirror/language'; | ||
import { Compartment, EditorState, StateEffect } from '@codemirror/state'; | ||
import { Compartment, EditorState, Prec, StateEffect } from '@codemirror/state'; | ||
import { crosshairCursor, drawSelection, EditorView, highlightActiveLine, highlightTrailingWhitespace, highlightWhitespace, keymap, lineNumbers, rectangularSelection, scrollPastEnd, tooltips } from '@codemirror/view'; | ||
@@ -546,3 +546,7 @@ import { nullTranslator } from '@jupyterlab/translation'; | ||
default: true, | ||
factory: () => createConditionalExtension(bracketMatching()), | ||
factory: () => createConditionalExtension([ | ||
bracketMatching(), | ||
// closeBracketsKeymap must have higher precedence over defaultKeymap | ||
Prec.high(keymap.of(closeBracketsKeymap)) | ||
]), | ||
schema: { | ||
@@ -549,0 +553,0 @@ type: 'boolean', |
@@ -33,2 +33,3 @@ /* | ||
constructor(view) { | ||
var _a, _b; | ||
this.rulersContainer = view.dom.appendChild(document.createElement('div')); | ||
@@ -46,2 +47,3 @@ this.rulersContainer.style.cssText = ` | ||
const widths = view.state.facet(rulerConfig); | ||
const guttersWidths = (_b = (_a = view.scrollDOM.querySelector('.cm-gutters')) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0; | ||
this.rulers = widths.map(width => { | ||
@@ -52,3 +54,3 @@ const ruler = this.rulersContainer.appendChild(document.createElement('div')); | ||
position: absolute; | ||
left: ${width * defaultCharacterWidth}px; | ||
left: ${guttersWidths + width * defaultCharacterWidth}px; | ||
height: 100%; | ||
@@ -63,8 +65,11 @@ `; | ||
update(update) { | ||
var _a, _b; | ||
const widths = update.view.state.facet(rulerConfig); | ||
if (update.viewportChanged || | ||
update.geometryChanged || | ||
!JSONExt.deepEqual(widths, update.startState.facet(rulerConfig))) { | ||
const guttersWidth = (_b = (_a = update.view.scrollDOM.querySelector('.cm-gutters')) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0; | ||
const defaultCharacterWidth = update.view.defaultCharacterWidth; | ||
this.rulers.forEach((ruler, rulerIdx) => { | ||
ruler.style.left = `${widths[rulerIdx] * defaultCharacterWidth}px`; | ||
ruler.style.left = `${guttersWidth + widths[rulerIdx] * defaultCharacterWidth}px`; | ||
}); | ||
@@ -71,0 +76,0 @@ } |
{ | ||
"name": "@jupyterlab/codemirror", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"description": "JupyterLab - CodeMirror Editor Provider", | ||
@@ -62,7 +62,7 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"@jupyter/ydoc": "^1.0.2", | ||
"@jupyterlab/codeeditor": "^4.0.7", | ||
"@jupyterlab/coreutils": "^6.0.7", | ||
"@jupyterlab/documentsearch": "^4.0.7", | ||
"@jupyterlab/nbformat": "^4.0.7", | ||
"@jupyterlab/translation": "^4.0.7", | ||
"@jupyterlab/codeeditor": "^4.0.8", | ||
"@jupyterlab/coreutils": "^6.0.8", | ||
"@jupyterlab/documentsearch": "^4.0.8", | ||
"@jupyterlab/nbformat": "^4.0.8", | ||
"@jupyterlab/translation": "^4.0.8", | ||
"@lezer/common": "^1.0.2", | ||
@@ -78,3 +78,3 @@ "@lezer/generator": "^1.2.2", | ||
"devDependencies": { | ||
"@jupyterlab/testing": "^4.0.7", | ||
"@jupyterlab/testing": "^4.0.8", | ||
"@lezer/generator": "^1.2.2", | ||
@@ -81,0 +81,0 @@ "@lezer/lr": "^1.3.3", |
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
import { closeBrackets } from '@codemirror/autocomplete'; | ||
import { closeBrackets, closeBracketsKeymap } from '@codemirror/autocomplete'; | ||
import { defaultKeymap, indentLess } from '@codemirror/commands'; | ||
@@ -16,2 +16,3 @@ import { | ||
Extension, | ||
Prec, | ||
StateEffect | ||
@@ -719,3 +720,8 @@ } from '@codemirror/state'; | ||
default: true, | ||
factory: () => createConditionalExtension(bracketMatching()), | ||
factory: () => | ||
createConditionalExtension([ | ||
bracketMatching(), | ||
// closeBracketsKeymap must have higher precedence over defaultKeymap | ||
Prec.high(keymap.of(closeBracketsKeymap)) | ||
]), | ||
schema: { | ||
@@ -722,0 +728,0 @@ type: 'boolean', |
@@ -60,2 +60,4 @@ /* | ||
const widths = view.state.facet(rulerConfig); | ||
const guttersWidths = | ||
view.scrollDOM.querySelector('.cm-gutters')?.clientWidth ?? 0; | ||
this.rulers = widths.map(width => { | ||
@@ -68,3 +70,3 @@ const ruler = this.rulersContainer.appendChild( | ||
position: absolute; | ||
left: ${width * defaultCharacterWidth}px; | ||
left: ${guttersWidths + width * defaultCharacterWidth}px; | ||
height: 100%; | ||
@@ -85,7 +87,12 @@ `; | ||
update.viewportChanged || | ||
update.geometryChanged || | ||
!JSONExt.deepEqual(widths, update.startState.facet(rulerConfig)) | ||
) { | ||
const guttersWidth = | ||
update.view.scrollDOM.querySelector('.cm-gutters')?.clientWidth ?? 0; | ||
const defaultCharacterWidth = update.view.defaultCharacterWidth; | ||
this.rulers.forEach((ruler, rulerIdx) => { | ||
ruler.style.left = `${widths[rulerIdx] * defaultCharacterWidth}px`; | ||
ruler.style.left = `${ | ||
guttersWidth + widths[rulerIdx] * defaultCharacterWidth | ||
}px`; | ||
}); | ||
@@ -92,0 +99,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
503185
11913