@codemirror/view 0.19.15 → 0.19.16
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 +12 -0
- package/dist/index.cjs +10 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.19.16 (2021-11-11)
|
|
2
|
+
|
|
3
|
+
### Breaking changes
|
|
4
|
+
|
|
5
|
+
Block replacement decorations now default to inclusive, because non-inclusive block decorations are rarely what you need.
|
|
6
|
+
|
|
7
|
+
### Bug fixes
|
|
8
|
+
|
|
9
|
+
Fix an issue that caused block widgets to always have a large side value, making it impossible to show them between to replacement decorations.
|
|
10
|
+
|
|
11
|
+
Fix a crash that could happen after some types of viewport changes, due to a bug in the block widget view data structure.
|
|
12
|
+
|
|
1
13
|
## 0.19.15 (2021-11-09)
|
|
2
14
|
|
|
3
15
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1084,8 +1084,6 @@ class Decoration extends rangeset.RangeValue {
|
|
|
1084
1084
|
*/
|
|
1085
1085
|
static widget(spec) {
|
|
1086
1086
|
let side = spec.side || 0;
|
|
1087
|
-
if (spec.block)
|
|
1088
|
-
side += (200000000 /* BigBlock */ + 1) * (side > 0 ? 1 : -1);
|
|
1089
1087
|
return new PointDecoration(spec, side, side, !!spec.block, spec.widget || null, false);
|
|
1090
1088
|
}
|
|
1091
1089
|
/**
|
|
@@ -1094,9 +1092,9 @@ class Decoration extends rangeset.RangeValue {
|
|
|
1094
1092
|
*/
|
|
1095
1093
|
static replace(spec) {
|
|
1096
1094
|
let block = !!spec.block;
|
|
1097
|
-
let { start, end } = getInclusive(spec);
|
|
1098
|
-
let startSide =
|
|
1099
|
-
let endSide =
|
|
1095
|
+
let { start, end } = getInclusive(spec, block);
|
|
1096
|
+
let startSide = 100000000 /* Big */ * (start ? -1 : 1) * (block ? 2 : 1);
|
|
1097
|
+
let endSide = 100000000 /* Big */ * (end ? 1 : -1) * (block ? 2 : 1);
|
|
1100
1098
|
return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);
|
|
1101
1099
|
}
|
|
1102
1100
|
/**
|
|
@@ -1126,7 +1124,7 @@ Decoration.none = rangeset.RangeSet.empty;
|
|
|
1126
1124
|
class MarkDecoration extends Decoration {
|
|
1127
1125
|
constructor(spec) {
|
|
1128
1126
|
let { start, end } = getInclusive(spec);
|
|
1129
|
-
super(100000000 /*
|
|
1127
|
+
super(100000000 /* Big */ * (start ? -1 : 1), 100000000 /* Big */ * (end ? 1 : -1), null, spec);
|
|
1130
1128
|
this.tagName = spec.tagName || "span";
|
|
1131
1129
|
this.class = spec.class || "";
|
|
1132
1130
|
this.attrs = spec.attributes || null;
|
|
@@ -1147,7 +1145,7 @@ class MarkDecoration extends Decoration {
|
|
|
1147
1145
|
MarkDecoration.prototype.point = false;
|
|
1148
1146
|
class LineDecoration extends Decoration {
|
|
1149
1147
|
constructor(spec) {
|
|
1150
|
-
super(-100000000 /*
|
|
1148
|
+
super(-100000000 /* Big */, -100000000 /* Big */, null, spec);
|
|
1151
1149
|
}
|
|
1152
1150
|
eq(other) {
|
|
1153
1151
|
return other instanceof LineDecoration && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
@@ -1188,13 +1186,13 @@ class PointDecoration extends Decoration {
|
|
|
1188
1186
|
}
|
|
1189
1187
|
}
|
|
1190
1188
|
PointDecoration.prototype.point = true;
|
|
1191
|
-
function getInclusive(spec) {
|
|
1189
|
+
function getInclusive(spec, block = false) {
|
|
1192
1190
|
let { inclusiveStart: start, inclusiveEnd: end } = spec;
|
|
1193
1191
|
if (start == null)
|
|
1194
1192
|
start = spec.inclusive;
|
|
1195
1193
|
if (end == null)
|
|
1196
1194
|
end = spec.inclusive;
|
|
1197
|
-
return { start: start
|
|
1195
|
+
return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };
|
|
1198
1196
|
}
|
|
1199
1197
|
function widgetsEq(a, b) {
|
|
1200
1198
|
return a == b || !!(a && b && a.compare(b));
|
|
@@ -1362,7 +1360,9 @@ class BlockWidgetView extends ContentView {
|
|
|
1362
1360
|
split(at) {
|
|
1363
1361
|
let len = this.length - at;
|
|
1364
1362
|
this.length = at;
|
|
1365
|
-
|
|
1363
|
+
let end = new BlockWidgetView(this.widget, len, this.type);
|
|
1364
|
+
end.breakAfter = this.breakAfter;
|
|
1365
|
+
return end;
|
|
1366
1366
|
}
|
|
1367
1367
|
get children() { return none$1; }
|
|
1368
1368
|
sync() {
|
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,8 @@ interface ReplaceDecorationSpec {
|
|
|
91
91
|
/**
|
|
92
92
|
Whether this range covers the positions on its sides. This
|
|
93
93
|
influences whether new content becomes part of the range and
|
|
94
|
-
whether the cursor can be drawn on its sides. Defaults to false
|
|
94
|
+
whether the cursor can be drawn on its sides. Defaults to false
|
|
95
|
+
for inline replacements, and true for block replacements.
|
|
95
96
|
*/
|
|
96
97
|
inclusive?: boolean;
|
|
97
98
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1080,8 +1080,6 @@ class Decoration extends RangeValue {
|
|
|
1080
1080
|
*/
|
|
1081
1081
|
static widget(spec) {
|
|
1082
1082
|
let side = spec.side || 0;
|
|
1083
|
-
if (spec.block)
|
|
1084
|
-
side += (200000000 /* BigBlock */ + 1) * (side > 0 ? 1 : -1);
|
|
1085
1083
|
return new PointDecoration(spec, side, side, !!spec.block, spec.widget || null, false);
|
|
1086
1084
|
}
|
|
1087
1085
|
/**
|
|
@@ -1090,9 +1088,9 @@ class Decoration extends RangeValue {
|
|
|
1090
1088
|
*/
|
|
1091
1089
|
static replace(spec) {
|
|
1092
1090
|
let block = !!spec.block;
|
|
1093
|
-
let { start, end } = getInclusive(spec);
|
|
1094
|
-
let startSide =
|
|
1095
|
-
let endSide =
|
|
1091
|
+
let { start, end } = getInclusive(spec, block);
|
|
1092
|
+
let startSide = 100000000 /* Big */ * (start ? -1 : 1) * (block ? 2 : 1);
|
|
1093
|
+
let endSide = 100000000 /* Big */ * (end ? 1 : -1) * (block ? 2 : 1);
|
|
1096
1094
|
return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);
|
|
1097
1095
|
}
|
|
1098
1096
|
/**
|
|
@@ -1122,7 +1120,7 @@ Decoration.none = RangeSet.empty;
|
|
|
1122
1120
|
class MarkDecoration extends Decoration {
|
|
1123
1121
|
constructor(spec) {
|
|
1124
1122
|
let { start, end } = getInclusive(spec);
|
|
1125
|
-
super(100000000 /*
|
|
1123
|
+
super(100000000 /* Big */ * (start ? -1 : 1), 100000000 /* Big */ * (end ? 1 : -1), null, spec);
|
|
1126
1124
|
this.tagName = spec.tagName || "span";
|
|
1127
1125
|
this.class = spec.class || "";
|
|
1128
1126
|
this.attrs = spec.attributes || null;
|
|
@@ -1143,7 +1141,7 @@ class MarkDecoration extends Decoration {
|
|
|
1143
1141
|
MarkDecoration.prototype.point = false;
|
|
1144
1142
|
class LineDecoration extends Decoration {
|
|
1145
1143
|
constructor(spec) {
|
|
1146
|
-
super(-100000000 /*
|
|
1144
|
+
super(-100000000 /* Big */, -100000000 /* Big */, null, spec);
|
|
1147
1145
|
}
|
|
1148
1146
|
eq(other) {
|
|
1149
1147
|
return other instanceof LineDecoration && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
@@ -1184,13 +1182,13 @@ class PointDecoration extends Decoration {
|
|
|
1184
1182
|
}
|
|
1185
1183
|
}
|
|
1186
1184
|
PointDecoration.prototype.point = true;
|
|
1187
|
-
function getInclusive(spec) {
|
|
1185
|
+
function getInclusive(spec, block = false) {
|
|
1188
1186
|
let { inclusiveStart: start, inclusiveEnd: end } = spec;
|
|
1189
1187
|
if (start == null)
|
|
1190
1188
|
start = spec.inclusive;
|
|
1191
1189
|
if (end == null)
|
|
1192
1190
|
end = spec.inclusive;
|
|
1193
|
-
return { start: start
|
|
1191
|
+
return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };
|
|
1194
1192
|
}
|
|
1195
1193
|
function widgetsEq(a, b) {
|
|
1196
1194
|
return a == b || !!(a && b && a.compare(b));
|
|
@@ -1358,7 +1356,9 @@ class BlockWidgetView extends ContentView {
|
|
|
1358
1356
|
split(at) {
|
|
1359
1357
|
let len = this.length - at;
|
|
1360
1358
|
this.length = at;
|
|
1361
|
-
|
|
1359
|
+
let end = new BlockWidgetView(this.widget, len, this.type);
|
|
1360
|
+
end.breakAfter = this.breakAfter;
|
|
1361
|
+
return end;
|
|
1362
1362
|
}
|
|
1363
1363
|
get children() { return none$1; }
|
|
1364
1364
|
sync() {
|