@jupyterlab/codemirror
Advanced tools
Comparing version 4.3.4 to 4.3.5
@@ -12,2 +12,3 @@ /* | ||
import { ViewPlugin } from '@codemirror/view'; | ||
import { yUndoManager, YUndoManagerConfig, yUndoManagerFacet } from './yundomanager'; | ||
import { createAbsolutePositionFromRelativePosition, createRelativePositionFromJSON, createRelativePositionFromTypeIndex, relativePositionToJSON } from 'yjs'; | ||
@@ -211,21 +212,11 @@ /** | ||
const ySyncConfig = new YSyncConfig(ytext); | ||
// We don't need the undo manager extension as in y-codemirror.next | ||
// because we deal with undo/redo with our own keyboard shortcut mechanism. | ||
return [ | ||
ySyncFacet.of(ySyncConfig), | ||
ySync, | ||
const plugins = [ySyncFacet.of(ySyncConfig), ySync]; | ||
if (undoManager) { | ||
plugins.push( | ||
// We need to add a new origin to the undo manager to ensure text updates | ||
// are tracked. | ||
undoManager | ||
? ViewPlugin.define(() => { | ||
undoManager.addTrackedOrigin(ySyncConfig); | ||
return { | ||
destroy: () => { | ||
undoManager.removeTrackedOrigin(ySyncConfig); | ||
} | ||
}; | ||
}) | ||
: [] | ||
]; | ||
// are tracked; we also need to restore selection after undo/redo. | ||
yUndoManagerFacet.of(new YUndoManagerConfig(undoManager)), yUndoManager); | ||
} | ||
return plugins; | ||
} | ||
//# sourceMappingURL=ybinding.js.map |
{ | ||
"name": "@jupyterlab/codemirror", | ||
"version": "4.3.4", | ||
"version": "4.3.5", | ||
"description": "JupyterLab - CodeMirror Editor Provider", | ||
@@ -61,7 +61,7 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"@jupyter/ydoc": "^3.0.0", | ||
"@jupyterlab/codeeditor": "^4.3.4", | ||
"@jupyterlab/coreutils": "^6.3.4", | ||
"@jupyterlab/documentsearch": "^4.3.4", | ||
"@jupyterlab/nbformat": "^4.3.4", | ||
"@jupyterlab/translation": "^4.3.4", | ||
"@jupyterlab/codeeditor": "^4.3.5", | ||
"@jupyterlab/coreutils": "^6.3.5", | ||
"@jupyterlab/documentsearch": "^4.3.5", | ||
"@jupyterlab/nbformat": "^4.3.5", | ||
"@jupyterlab/translation": "^4.3.5", | ||
"@lezer/common": "^1.2.1", | ||
@@ -77,3 +77,3 @@ "@lezer/generator": "^1.7.0", | ||
"devDependencies": { | ||
"@jupyterlab/testing": "^4.3.4", | ||
"@jupyterlab/testing": "^4.3.5", | ||
"@lezer/generator": "^1.7.0", | ||
@@ -80,0 +80,0 @@ "@lezer/lr": "^1.4.0", |
@@ -18,2 +18,7 @@ /* | ||
import { EditorView, ViewPlugin, ViewUpdate } from '@codemirror/view'; | ||
import { | ||
yUndoManager, | ||
YUndoManagerConfig, | ||
yUndoManagerFacet | ||
} from './yundomanager'; | ||
import type { | ||
@@ -278,20 +283,12 @@ RelativePosition, | ||
const ySyncConfig = new YSyncConfig(ytext); | ||
// We don't need the undo manager extension as in y-codemirror.next | ||
// because we deal with undo/redo with our own keyboard shortcut mechanism. | ||
return [ | ||
ySyncFacet.of(ySyncConfig), | ||
ySync, | ||
// We need to add a new origin to the undo manager to ensure text updates | ||
// are tracked. | ||
undoManager | ||
? ViewPlugin.define(() => { | ||
undoManager.addTrackedOrigin(ySyncConfig); | ||
return { | ||
destroy: () => { | ||
undoManager.removeTrackedOrigin(ySyncConfig); | ||
} | ||
}; | ||
}) | ||
: [] | ||
]; | ||
const plugins = [ySyncFacet.of(ySyncConfig), ySync]; | ||
if (undoManager) { | ||
plugins.push( | ||
// We need to add a new origin to the undo manager to ensure text updates | ||
// are tracked; we also need to restore selection after undo/redo. | ||
yUndoManagerFacet.of(new YUndoManagerConfig(undoManager)), | ||
yUndoManager | ||
); | ||
} | ||
return plugins; | ||
} |
Sorry, the diff of this file is not supported yet
556061
74
13058
4