@codemirror/view 6.35.0 → 6.35.1
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 +10 -0
- package/dist/index.cjs +14 -6
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 6.35.1 (2024-12-06)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Work around another crash caused by incorrect composition positions reported by `EditContext`.
|
|
6
|
+
|
|
7
|
+
Stop disabling custom cursors on Safari version 11.4 and up, which support `caret-color`.
|
|
8
|
+
|
|
9
|
+
Fix an issue where a tooltip with wrapped content could, in some circumstances, fail to find a stable position due to a cyclic dependency between its width and its position.
|
|
10
|
+
|
|
1
11
|
## 6.35.0 (2024-11-21)
|
|
2
12
|
|
|
3
13
|
### New features
|
package/dist/index.cjs
CHANGED
|
@@ -7204,9 +7204,11 @@ class EditContextManager {
|
|
|
7204
7204
|
for (let format of e.getTextFormats()) {
|
|
7205
7205
|
let lineStyle = format.underlineStyle, thickness = format.underlineThickness;
|
|
7206
7206
|
if (lineStyle != "None" && thickness != "None") {
|
|
7207
|
-
let
|
|
7208
|
-
|
|
7209
|
-
|
|
7207
|
+
let from = this.toEditorPos(format.rangeStart), to = this.toEditorPos(format.rangeEnd);
|
|
7208
|
+
if (from < to) {
|
|
7209
|
+
let style = `text-decoration: underline ${lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""}${thickness == "Thin" ? 1 : 2}px`;
|
|
7210
|
+
deco.push(Decoration.mark({ attributes: { style } }).range(from, to));
|
|
7211
|
+
}
|
|
7210
7212
|
}
|
|
7211
7213
|
}
|
|
7212
7214
|
view.dispatch({ effects: setEditContextFormatting.of(Decoration.set(deco)) });
|
|
@@ -7319,6 +7321,7 @@ class EditContextManager {
|
|
|
7319
7321
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7320
7322
|
}
|
|
7321
7323
|
toEditorPos(contextPos) {
|
|
7324
|
+
contextPos = Math.min(contextPos, this.to - this.from);
|
|
7322
7325
|
let c = this.composing;
|
|
7323
7326
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7324
7327
|
}
|
|
@@ -8983,7 +8986,7 @@ function layer(config) {
|
|
|
8983
8986
|
];
|
|
8984
8987
|
}
|
|
8985
8988
|
|
|
8986
|
-
const CanHidePrimary = !browser.ios
|
|
8989
|
+
const CanHidePrimary = !(browser.ios && browser.webkit && browser.webkit_version < 534);
|
|
8987
8990
|
const selectionConfig = state.Facet.define({
|
|
8988
8991
|
combine(configs) {
|
|
8989
8992
|
return state.combineConfig(configs, {
|
|
@@ -9990,11 +9993,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
|
|
|
9990
9993
|
top = above ? r.top - height - 2 - arrowHeight : r.bottom + arrowHeight + 2;
|
|
9991
9994
|
if (this.position == "absolute") {
|
|
9992
9995
|
dom.style.top = (top - measured.parent.top) / scaleY + "px";
|
|
9993
|
-
dom
|
|
9996
|
+
setLeftStyle(dom, (left - measured.parent.left) / scaleX);
|
|
9994
9997
|
}
|
|
9995
9998
|
else {
|
|
9996
9999
|
dom.style.top = top / scaleY + "px";
|
|
9997
|
-
dom
|
|
10000
|
+
setLeftStyle(dom, left / scaleX);
|
|
9998
10001
|
}
|
|
9999
10002
|
if (arrow) {
|
|
10000
10003
|
let arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 /* Arrow.Offset */ - 7 /* Arrow.Size */);
|
|
@@ -10025,6 +10028,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
|
|
|
10025
10028
|
scroll() { this.maybeMeasure(); }
|
|
10026
10029
|
}
|
|
10027
10030
|
});
|
|
10031
|
+
function setLeftStyle(elt, value) {
|
|
10032
|
+
let current = parseInt(elt.style.left, 10);
|
|
10033
|
+
if (isNaN(current) || Math.abs(value - current) > 1)
|
|
10034
|
+
elt.style.left = value + "px";
|
|
10035
|
+
}
|
|
10028
10036
|
const baseTheme = EditorView.baseTheme({
|
|
10029
10037
|
".cm-tooltip": {
|
|
10030
10038
|
zIndex: 500,
|
package/dist/index.js
CHANGED
|
@@ -7199,9 +7199,11 @@ class EditContextManager {
|
|
|
7199
7199
|
for (let format of e.getTextFormats()) {
|
|
7200
7200
|
let lineStyle = format.underlineStyle, thickness = format.underlineThickness;
|
|
7201
7201
|
if (lineStyle != "None" && thickness != "None") {
|
|
7202
|
-
let
|
|
7203
|
-
|
|
7204
|
-
|
|
7202
|
+
let from = this.toEditorPos(format.rangeStart), to = this.toEditorPos(format.rangeEnd);
|
|
7203
|
+
if (from < to) {
|
|
7204
|
+
let style = `text-decoration: underline ${lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""}${thickness == "Thin" ? 1 : 2}px`;
|
|
7205
|
+
deco.push(Decoration.mark({ attributes: { style } }).range(from, to));
|
|
7206
|
+
}
|
|
7205
7207
|
}
|
|
7206
7208
|
}
|
|
7207
7209
|
view.dispatch({ effects: setEditContextFormatting.of(Decoration.set(deco)) });
|
|
@@ -7314,6 +7316,7 @@ class EditContextManager {
|
|
|
7314
7316
|
this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
7315
7317
|
}
|
|
7316
7318
|
toEditorPos(contextPos) {
|
|
7319
|
+
contextPos = Math.min(contextPos, this.to - this.from);
|
|
7317
7320
|
let c = this.composing;
|
|
7318
7321
|
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
7319
7322
|
}
|
|
@@ -8978,7 +8981,7 @@ function layer(config) {
|
|
|
8978
8981
|
];
|
|
8979
8982
|
}
|
|
8980
8983
|
|
|
8981
|
-
const CanHidePrimary = !browser.ios
|
|
8984
|
+
const CanHidePrimary = !(browser.ios && browser.webkit && browser.webkit_version < 534);
|
|
8982
8985
|
const selectionConfig = /*@__PURE__*/Facet.define({
|
|
8983
8986
|
combine(configs) {
|
|
8984
8987
|
return combineConfig(configs, {
|
|
@@ -9985,11 +9988,11 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
9985
9988
|
top = above ? r.top - height - 2 - arrowHeight : r.bottom + arrowHeight + 2;
|
|
9986
9989
|
if (this.position == "absolute") {
|
|
9987
9990
|
dom.style.top = (top - measured.parent.top) / scaleY + "px";
|
|
9988
|
-
dom
|
|
9991
|
+
setLeftStyle(dom, (left - measured.parent.left) / scaleX);
|
|
9989
9992
|
}
|
|
9990
9993
|
else {
|
|
9991
9994
|
dom.style.top = top / scaleY + "px";
|
|
9992
|
-
dom
|
|
9995
|
+
setLeftStyle(dom, left / scaleX);
|
|
9993
9996
|
}
|
|
9994
9997
|
if (arrow) {
|
|
9995
9998
|
let arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 /* Arrow.Offset */ - 7 /* Arrow.Size */);
|
|
@@ -10020,6 +10023,11 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
10020
10023
|
scroll() { this.maybeMeasure(); }
|
|
10021
10024
|
}
|
|
10022
10025
|
});
|
|
10026
|
+
function setLeftStyle(elt, value) {
|
|
10027
|
+
let current = parseInt(elt.style.left, 10);
|
|
10028
|
+
if (isNaN(current) || Math.abs(value - current) > 1)
|
|
10029
|
+
elt.style.left = value + "px";
|
|
10030
|
+
}
|
|
10023
10031
|
const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
10024
10032
|
".cm-tooltip": {
|
|
10025
10033
|
zIndex: 500,
|