@codemirror/view 6.35.1 → 6.35.3
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 +16 -0
- package/dist/index.cjs +9 -5
- package/dist/index.js +9 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 6.35.3 (2024-12-09)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where mark decorations that got merged or split weren't properly redrawn.
|
|
6
|
+
|
|
7
|
+
Avoid spurious focus events by not updating the DOM selection when the editor is unfocused but focusable.
|
|
8
|
+
|
|
9
|
+
Disable `writingsuggestions` for the editable element, to opt out of Safari's new intelligence completions (which mess up in the editor).
|
|
10
|
+
|
|
11
|
+
## 6.35.2 (2024-12-07)
|
|
12
|
+
|
|
13
|
+
### Bug fixes
|
|
14
|
+
|
|
15
|
+
Fix an issue on Chrome where typing at the end of the document would insert a character after the cursor.
|
|
16
|
+
|
|
1
17
|
## 6.35.1 (2024-12-06)
|
|
2
18
|
|
|
3
19
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -2927,7 +2927,7 @@ class DocView extends ContentView {
|
|
|
2927
2927
|
if (mustRead || !this.view.observer.selectionRange.focusNode)
|
|
2928
2928
|
this.view.observer.readSelectionRange();
|
|
2929
2929
|
let activeElt = this.view.root.activeElement, focused = activeElt == this.dom;
|
|
2930
|
-
let selectionNotFocus = !focused &&
|
|
2930
|
+
let selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) &&
|
|
2931
2931
|
hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
|
|
2932
2932
|
if (!(focused || fromPointer || selectionNotFocus))
|
|
2933
2933
|
return;
|
|
@@ -3353,6 +3353,7 @@ let DecorationComparator$1 = class DecorationComparator {
|
|
|
3353
3353
|
}
|
|
3354
3354
|
compareRange(from, to) { addRange(from, to, this.changes); }
|
|
3355
3355
|
comparePoint(from, to) { addRange(from, to, this.changes); }
|
|
3356
|
+
boundChange(pos) { addRange(pos, pos, this.changes); }
|
|
3356
3357
|
};
|
|
3357
3358
|
function findChangedDeco(a, b, diff) {
|
|
3358
3359
|
let comp = new DecorationComparator$1;
|
|
@@ -7180,8 +7181,10 @@ class EditContextManager {
|
|
|
7180
7181
|
if (change.from == change.to && !change.insert.length)
|
|
7181
7182
|
return;
|
|
7182
7183
|
this.pendingContextChange = change;
|
|
7183
|
-
if (!view.state.readOnly)
|
|
7184
|
-
|
|
7184
|
+
if (!view.state.readOnly) {
|
|
7185
|
+
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
7186
|
+
applyDOMChangeInner(view, change, state.EditorSelection.single(this.toEditorPos(e.selectionStart, newLen), this.toEditorPos(e.selectionEnd, newLen)));
|
|
7187
|
+
}
|
|
7185
7188
|
// If the transaction didn't flush our change, revert it so
|
|
7186
7189
|
// that the context is in sync with the editor state again.
|
|
7187
7190
|
if (this.pendingContextChange) {
|
|
@@ -7320,8 +7323,8 @@ class EditContextManager {
|
|
|
7320
7323
|
this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ ||
|
|
7321
7324
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7322
7325
|
}
|
|
7323
|
-
toEditorPos(contextPos) {
|
|
7324
|
-
contextPos = Math.min(contextPos,
|
|
7326
|
+
toEditorPos(contextPos, clipLen = this.to - this.from) {
|
|
7327
|
+
contextPos = Math.min(contextPos, clipLen);
|
|
7325
7328
|
let c = this.composing;
|
|
7326
7329
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7327
7330
|
}
|
|
@@ -7794,6 +7797,7 @@ class EditorView {
|
|
|
7794
7797
|
spellcheck: "false",
|
|
7795
7798
|
autocorrect: "off",
|
|
7796
7799
|
autocapitalize: "off",
|
|
7800
|
+
writingsuggestions: "false",
|
|
7797
7801
|
translate: "no",
|
|
7798
7802
|
contenteditable: !this.state.facet(editable) ? "false" : "true",
|
|
7799
7803
|
class: "cm-content",
|
package/dist/index.js
CHANGED
|
@@ -2923,7 +2923,7 @@ class DocView extends ContentView {
|
|
|
2923
2923
|
if (mustRead || !this.view.observer.selectionRange.focusNode)
|
|
2924
2924
|
this.view.observer.readSelectionRange();
|
|
2925
2925
|
let activeElt = this.view.root.activeElement, focused = activeElt == this.dom;
|
|
2926
|
-
let selectionNotFocus = !focused &&
|
|
2926
|
+
let selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) &&
|
|
2927
2927
|
hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));
|
|
2928
2928
|
if (!(focused || fromPointer || selectionNotFocus))
|
|
2929
2929
|
return;
|
|
@@ -3349,6 +3349,7 @@ let DecorationComparator$1 = class DecorationComparator {
|
|
|
3349
3349
|
}
|
|
3350
3350
|
compareRange(from, to) { addRange(from, to, this.changes); }
|
|
3351
3351
|
comparePoint(from, to) { addRange(from, to, this.changes); }
|
|
3352
|
+
boundChange(pos) { addRange(pos, pos, this.changes); }
|
|
3352
3353
|
};
|
|
3353
3354
|
function findChangedDeco(a, b, diff) {
|
|
3354
3355
|
let comp = new DecorationComparator$1;
|
|
@@ -7175,8 +7176,10 @@ class EditContextManager {
|
|
|
7175
7176
|
if (change.from == change.to && !change.insert.length)
|
|
7176
7177
|
return;
|
|
7177
7178
|
this.pendingContextChange = change;
|
|
7178
|
-
if (!view.state.readOnly)
|
|
7179
|
-
|
|
7179
|
+
if (!view.state.readOnly) {
|
|
7180
|
+
let newLen = this.to - this.from + (change.to - change.from + change.insert.length);
|
|
7181
|
+
applyDOMChangeInner(view, change, EditorSelection.single(this.toEditorPos(e.selectionStart, newLen), this.toEditorPos(e.selectionEnd, newLen)));
|
|
7182
|
+
}
|
|
7180
7183
|
// If the transaction didn't flush our change, revert it so
|
|
7181
7184
|
// that the context is in sync with the editor state again.
|
|
7182
7185
|
if (this.pendingContextChange) {
|
|
@@ -7315,8 +7318,8 @@ class EditContextManager {
|
|
|
7315
7318
|
this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ ||
|
|
7316
7319
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7317
7320
|
}
|
|
7318
|
-
toEditorPos(contextPos) {
|
|
7319
|
-
contextPos = Math.min(contextPos,
|
|
7321
|
+
toEditorPos(contextPos, clipLen = this.to - this.from) {
|
|
7322
|
+
contextPos = Math.min(contextPos, clipLen);
|
|
7320
7323
|
let c = this.composing;
|
|
7321
7324
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7322
7325
|
}
|
|
@@ -7789,6 +7792,7 @@ class EditorView {
|
|
|
7789
7792
|
spellcheck: "false",
|
|
7790
7793
|
autocorrect: "off",
|
|
7791
7794
|
autocapitalize: "off",
|
|
7795
|
+
writingsuggestions: "false",
|
|
7792
7796
|
translate: "no",
|
|
7793
7797
|
contenteditable: !this.state.facet(editable) ? "false" : "true",
|
|
7794
7798
|
class: "cm-content",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemirror/view",
|
|
3
|
-
"version": "6.35.
|
|
3
|
+
"version": "6.35.3",
|
|
4
4
|
"description": "DOM view component for the CodeMirror code editor",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "cm-runtests",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@codemirror/state": "^6.
|
|
29
|
+
"@codemirror/state": "^6.5.0",
|
|
30
30
|
"style-mod": "^4.1.0",
|
|
31
31
|
"w3c-keyname": "^2.2.4"
|
|
32
32
|
},
|