@codemirror/view 6.36.6 → 6.36.8
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 +10 -12
- package/dist/index.js +10 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 6.36.8 (2025-05-12)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Make `logException` log errors to the console when `onerror` returns a falsy value.
|
|
6
|
+
|
|
7
|
+
Fix an issue in `MatchDecorator` causing `updateDeco` to sometimes not do the right thing for deletions.
|
|
8
|
+
|
|
9
|
+
## 6.36.7 (2025-05-02)
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
|
|
13
|
+
Use the `aria-placeholder` attribute to communicate the placeholder text to screen readers.
|
|
14
|
+
|
|
15
|
+
Fix a crash when `EditorView.composing` or `.compositionStarted` are accessed during view initialization.
|
|
16
|
+
|
|
1
17
|
## 6.36.6 (2025-04-24)
|
|
2
18
|
|
|
3
19
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -2422,8 +2422,7 @@ function logException(state, exception, context) {
|
|
|
2422
2422
|
let handler = state.facet(exceptionSink);
|
|
2423
2423
|
if (handler.length)
|
|
2424
2424
|
handler[0](exception);
|
|
2425
|
-
else if (window.onerror)
|
|
2426
|
-
window.onerror(String(exception), context, undefined, undefined, exception);
|
|
2425
|
+
else if (window.onerror && window.onerror(String(exception), context, undefined, undefined, exception)) ;
|
|
2427
2426
|
else if (context)
|
|
2428
2427
|
console.error(context + ":", exception);
|
|
2429
2428
|
else
|
|
@@ -7446,14 +7445,14 @@ class EditorView {
|
|
|
7446
7445
|
[IME](https://en.wikipedia.org/wiki/Input_method), and at least
|
|
7447
7446
|
one change has been made in the current composition.
|
|
7448
7447
|
*/
|
|
7449
|
-
get composing() { return this.inputState.composing > 0; }
|
|
7448
|
+
get composing() { return !!this.inputState && this.inputState.composing > 0; }
|
|
7450
7449
|
/**
|
|
7451
7450
|
Indicates whether the user is currently in composing state. Note
|
|
7452
7451
|
that on some platforms, like Android, this will be the case a
|
|
7453
7452
|
lot, since just putting the cursor on a word starts a
|
|
7454
7453
|
composition there.
|
|
7455
7454
|
*/
|
|
7456
|
-
get compositionStarted() { return this.inputState.composing >= 0; }
|
|
7455
|
+
get compositionStarted() { return !!this.inputState && this.inputState.composing >= 0; }
|
|
7457
7456
|
/**
|
|
7458
7457
|
The document or shadow root that the view lives in.
|
|
7459
7458
|
*/
|
|
@@ -9341,7 +9340,7 @@ class MatchDecorator {
|
|
|
9341
9340
|
updateRange(view, deco, updateFrom, updateTo) {
|
|
9342
9341
|
for (let r of view.visibleRanges) {
|
|
9343
9342
|
let from = Math.max(r.from, updateFrom), to = Math.min(r.to, updateTo);
|
|
9344
|
-
if (to
|
|
9343
|
+
if (to >= from) {
|
|
9345
9344
|
let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;
|
|
9346
9345
|
let start = Math.max(r.from, fromLine.from), end = Math.min(r.to, toLine.to);
|
|
9347
9346
|
if (this.boundary) {
|
|
@@ -9594,10 +9593,7 @@ class Placeholder extends WidgetType {
|
|
|
9594
9593
|
wrap.appendChild(typeof this.content == "string" ? document.createTextNode(this.content) :
|
|
9595
9594
|
typeof this.content == "function" ? this.content(view) :
|
|
9596
9595
|
this.content.cloneNode(true));
|
|
9597
|
-
|
|
9598
|
-
wrap.setAttribute("aria-label", "placeholder " + this.content);
|
|
9599
|
-
else
|
|
9600
|
-
wrap.setAttribute("aria-hidden", "true");
|
|
9596
|
+
wrap.setAttribute("aria-hidden", "true");
|
|
9601
9597
|
return wrap;
|
|
9602
9598
|
}
|
|
9603
9599
|
coordsAt(dom) {
|
|
@@ -9618,7 +9614,7 @@ Extension that enables a placeholder—a piece of example content
|
|
|
9618
9614
|
to show when the editor is empty.
|
|
9619
9615
|
*/
|
|
9620
9616
|
function placeholder(content) {
|
|
9621
|
-
|
|
9617
|
+
let plugin = ViewPlugin.fromClass(class {
|
|
9622
9618
|
constructor(view) {
|
|
9623
9619
|
this.view = view;
|
|
9624
9620
|
this.placeholder = content
|
|
@@ -9627,6 +9623,9 @@ function placeholder(content) {
|
|
|
9627
9623
|
}
|
|
9628
9624
|
get decorations() { return this.view.state.doc.length ? Decoration.none : this.placeholder; }
|
|
9629
9625
|
}, { decorations: v => v.decorations });
|
|
9626
|
+
return typeof content == "string" ? [
|
|
9627
|
+
plugin, EditorView.contentAttributes.of({ "aria-placeholder": content })
|
|
9628
|
+
] : plugin;
|
|
9630
9629
|
}
|
|
9631
9630
|
|
|
9632
9631
|
// Don't compute precise column positions for line offsets above this
|
|
@@ -11164,8 +11163,7 @@ function highlightWhitespace() {
|
|
|
11164
11163
|
}
|
|
11165
11164
|
const trailingHighlighter = matcher(new MatchDecorator({
|
|
11166
11165
|
regexp: /\s+$/g,
|
|
11167
|
-
decoration: Decoration.mark({ class: "cm-trailingSpace" })
|
|
11168
|
-
boundary: /\S/,
|
|
11166
|
+
decoration: Decoration.mark({ class: "cm-trailingSpace" })
|
|
11169
11167
|
}));
|
|
11170
11168
|
/**
|
|
11171
11169
|
Returns an extension that adds a `cm-trailingSpace` class to all
|
package/dist/index.js
CHANGED
|
@@ -2418,8 +2418,7 @@ function logException(state, exception, context) {
|
|
|
2418
2418
|
let handler = state.facet(exceptionSink);
|
|
2419
2419
|
if (handler.length)
|
|
2420
2420
|
handler[0](exception);
|
|
2421
|
-
else if (window.onerror)
|
|
2422
|
-
window.onerror(String(exception), context, undefined, undefined, exception);
|
|
2421
|
+
else if (window.onerror && window.onerror(String(exception), context, undefined, undefined, exception)) ;
|
|
2423
2422
|
else if (context)
|
|
2424
2423
|
console.error(context + ":", exception);
|
|
2425
2424
|
else
|
|
@@ -7441,14 +7440,14 @@ class EditorView {
|
|
|
7441
7440
|
[IME](https://en.wikipedia.org/wiki/Input_method), and at least
|
|
7442
7441
|
one change has been made in the current composition.
|
|
7443
7442
|
*/
|
|
7444
|
-
get composing() { return this.inputState.composing > 0; }
|
|
7443
|
+
get composing() { return !!this.inputState && this.inputState.composing > 0; }
|
|
7445
7444
|
/**
|
|
7446
7445
|
Indicates whether the user is currently in composing state. Note
|
|
7447
7446
|
that on some platforms, like Android, this will be the case a
|
|
7448
7447
|
lot, since just putting the cursor on a word starts a
|
|
7449
7448
|
composition there.
|
|
7450
7449
|
*/
|
|
7451
|
-
get compositionStarted() { return this.inputState.composing >= 0; }
|
|
7450
|
+
get compositionStarted() { return !!this.inputState && this.inputState.composing >= 0; }
|
|
7452
7451
|
/**
|
|
7453
7452
|
The document or shadow root that the view lives in.
|
|
7454
7453
|
*/
|
|
@@ -9336,7 +9335,7 @@ class MatchDecorator {
|
|
|
9336
9335
|
updateRange(view, deco, updateFrom, updateTo) {
|
|
9337
9336
|
for (let r of view.visibleRanges) {
|
|
9338
9337
|
let from = Math.max(r.from, updateFrom), to = Math.min(r.to, updateTo);
|
|
9339
|
-
if (to
|
|
9338
|
+
if (to >= from) {
|
|
9340
9339
|
let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;
|
|
9341
9340
|
let start = Math.max(r.from, fromLine.from), end = Math.min(r.to, toLine.to);
|
|
9342
9341
|
if (this.boundary) {
|
|
@@ -9589,10 +9588,7 @@ class Placeholder extends WidgetType {
|
|
|
9589
9588
|
wrap.appendChild(typeof this.content == "string" ? document.createTextNode(this.content) :
|
|
9590
9589
|
typeof this.content == "function" ? this.content(view) :
|
|
9591
9590
|
this.content.cloneNode(true));
|
|
9592
|
-
|
|
9593
|
-
wrap.setAttribute("aria-label", "placeholder " + this.content);
|
|
9594
|
-
else
|
|
9595
|
-
wrap.setAttribute("aria-hidden", "true");
|
|
9591
|
+
wrap.setAttribute("aria-hidden", "true");
|
|
9596
9592
|
return wrap;
|
|
9597
9593
|
}
|
|
9598
9594
|
coordsAt(dom) {
|
|
@@ -9613,7 +9609,7 @@ Extension that enables a placeholder—a piece of example content
|
|
|
9613
9609
|
to show when the editor is empty.
|
|
9614
9610
|
*/
|
|
9615
9611
|
function placeholder(content) {
|
|
9616
|
-
|
|
9612
|
+
let plugin = ViewPlugin.fromClass(class {
|
|
9617
9613
|
constructor(view) {
|
|
9618
9614
|
this.view = view;
|
|
9619
9615
|
this.placeholder = content
|
|
@@ -9622,6 +9618,9 @@ function placeholder(content) {
|
|
|
9622
9618
|
}
|
|
9623
9619
|
get decorations() { return this.view.state.doc.length ? Decoration.none : this.placeholder; }
|
|
9624
9620
|
}, { decorations: v => v.decorations });
|
|
9621
|
+
return typeof content == "string" ? [
|
|
9622
|
+
plugin, EditorView.contentAttributes.of({ "aria-placeholder": content })
|
|
9623
|
+
] : plugin;
|
|
9625
9624
|
}
|
|
9626
9625
|
|
|
9627
9626
|
// Don't compute precise column positions for line offsets above this
|
|
@@ -11159,8 +11158,7 @@ function highlightWhitespace() {
|
|
|
11159
11158
|
}
|
|
11160
11159
|
const trailingHighlighter = /*@__PURE__*/matcher(/*@__PURE__*/new MatchDecorator({
|
|
11161
11160
|
regexp: /\s+$/g,
|
|
11162
|
-
decoration: /*@__PURE__*/Decoration.mark({ class: "cm-trailingSpace" })
|
|
11163
|
-
boundary: /\S/,
|
|
11161
|
+
decoration: /*@__PURE__*/Decoration.mark({ class: "cm-trailingSpace" })
|
|
11164
11162
|
}));
|
|
11165
11163
|
/**
|
|
11166
11164
|
Returns an extension that adds a `cm-trailingSpace` class to all
|