@codemirror/view 6.35.1 → 6.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +6 -4
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -7180,8 +7180,10 @@ class EditContextManager {
|
|
|
7180
7180
|
if (change.from == change.to && !change.insert.length)
|
|
7181
7181
|
return;
|
|
7182
7182
|
this.pendingContextChange = change;
|
|
7183
|
-
if (!view.state.readOnly)
|
|
7184
|
-
|
|
7183
|
+
if (!view.state.readOnly) {
|
|
7184
|
+
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
7185
|
+
applyDOMChangeInner(view, change, state.EditorSelection.single(this.toEditorPos(e.selectionStart, newLen), this.toEditorPos(e.selectionEnd, newLen)));
|
|
7186
|
+
}
|
|
7185
7187
|
// If the transaction didn't flush our change, revert it so
|
|
7186
7188
|
// that the context is in sync with the editor state again.
|
|
7187
7189
|
if (this.pendingContextChange) {
|
|
@@ -7320,8 +7322,8 @@ class EditContextManager {
|
|
|
7320
7322
|
this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ ||
|
|
7321
7323
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7322
7324
|
}
|
|
7323
|
-
toEditorPos(contextPos) {
|
|
7324
|
-
contextPos = Math.min(contextPos,
|
|
7325
|
+
toEditorPos(contextPos, clipLen = this.to - this.from) {
|
|
7326
|
+
contextPos = Math.min(contextPos, clipLen);
|
|
7325
7327
|
let c = this.composing;
|
|
7326
7328
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7327
7329
|
}
|
package/dist/index.js
CHANGED
|
@@ -7175,8 +7175,10 @@ class EditContextManager {
|
|
|
7175
7175
|
if (change.from == change.to && !change.insert.length)
|
|
7176
7176
|
return;
|
|
7177
7177
|
this.pendingContextChange = change;
|
|
7178
|
-
if (!view.state.readOnly)
|
|
7179
|
-
|
|
7178
|
+
if (!view.state.readOnly) {
|
|
7179
|
+
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
7180
|
+
applyDOMChangeInner(view, change, EditorSelection.single(this.toEditorPos(e.selectionStart, newLen), this.toEditorPos(e.selectionEnd, newLen)));
|
|
7181
|
+
}
|
|
7180
7182
|
// If the transaction didn't flush our change, revert it so
|
|
7181
7183
|
// that the context is in sync with the editor state again.
|
|
7182
7184
|
if (this.pendingContextChange) {
|
|
@@ -7315,8 +7317,8 @@ class EditContextManager {
|
|
|
7315
7317
|
this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ ||
|
|
7316
7318
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7317
7319
|
}
|
|
7318
|
-
toEditorPos(contextPos) {
|
|
7319
|
-
contextPos = Math.min(contextPos,
|
|
7320
|
+
toEditorPos(contextPos, clipLen = this.to - this.from) {
|
|
7321
|
+
contextPos = Math.min(contextPos, clipLen);
|
|
7320
7322
|
let c = this.composing;
|
|
7321
7323
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7322
7324
|
}
|