@codemirror/view 6.30.0 → 6.32.0
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 +26 -0
- package/dist/index.cjs +397 -364
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +396 -365
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1156,240 +1156,6 @@ function getAttrs(dom) {
|
|
|
1156
1156
|
return attrs;
|
|
1157
1157
|
}
|
|
1158
1158
|
|
|
1159
|
-
class LineView extends ContentView {
|
|
1160
|
-
constructor() {
|
|
1161
|
-
super(...arguments);
|
|
1162
|
-
this.children = [];
|
|
1163
|
-
this.length = 0;
|
|
1164
|
-
this.prevAttrs = undefined;
|
|
1165
|
-
this.attrs = null;
|
|
1166
|
-
this.breakAfter = 0;
|
|
1167
|
-
}
|
|
1168
|
-
// Consumes source
|
|
1169
|
-
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
1170
|
-
if (source) {
|
|
1171
|
-
if (!(source instanceof LineView))
|
|
1172
|
-
return false;
|
|
1173
|
-
if (!this.dom)
|
|
1174
|
-
source.transferDOM(this); // Reuse source.dom when appropriate
|
|
1175
|
-
}
|
|
1176
|
-
if (hasStart)
|
|
1177
|
-
this.setDeco(source ? source.attrs : null);
|
|
1178
|
-
mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart, openEnd);
|
|
1179
|
-
return true;
|
|
1180
|
-
}
|
|
1181
|
-
split(at) {
|
|
1182
|
-
let end = new LineView;
|
|
1183
|
-
end.breakAfter = this.breakAfter;
|
|
1184
|
-
if (this.length == 0)
|
|
1185
|
-
return end;
|
|
1186
|
-
let { i, off } = this.childPos(at);
|
|
1187
|
-
if (off) {
|
|
1188
|
-
end.append(this.children[i].split(off), 0);
|
|
1189
|
-
this.children[i].merge(off, this.children[i].length, null, false, 0, 0);
|
|
1190
|
-
i++;
|
|
1191
|
-
}
|
|
1192
|
-
for (let j = i; j < this.children.length; j++)
|
|
1193
|
-
end.append(this.children[j], 0);
|
|
1194
|
-
while (i > 0 && this.children[i - 1].length == 0)
|
|
1195
|
-
this.children[--i].destroy();
|
|
1196
|
-
this.children.length = i;
|
|
1197
|
-
this.markDirty();
|
|
1198
|
-
this.length = at;
|
|
1199
|
-
return end;
|
|
1200
|
-
}
|
|
1201
|
-
transferDOM(other) {
|
|
1202
|
-
if (!this.dom)
|
|
1203
|
-
return;
|
|
1204
|
-
this.markDirty();
|
|
1205
|
-
other.setDOM(this.dom);
|
|
1206
|
-
other.prevAttrs = this.prevAttrs === undefined ? this.attrs : this.prevAttrs;
|
|
1207
|
-
this.prevAttrs = undefined;
|
|
1208
|
-
this.dom = null;
|
|
1209
|
-
}
|
|
1210
|
-
setDeco(attrs) {
|
|
1211
|
-
if (!attrsEq(this.attrs, attrs)) {
|
|
1212
|
-
if (this.dom) {
|
|
1213
|
-
this.prevAttrs = this.attrs;
|
|
1214
|
-
this.markDirty();
|
|
1215
|
-
}
|
|
1216
|
-
this.attrs = attrs;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
append(child, openStart) {
|
|
1220
|
-
joinInlineInto(this, child, openStart);
|
|
1221
|
-
}
|
|
1222
|
-
// Only called when building a line view in ContentBuilder
|
|
1223
|
-
addLineDeco(deco) {
|
|
1224
|
-
let attrs = deco.spec.attributes, cls = deco.spec.class;
|
|
1225
|
-
if (attrs)
|
|
1226
|
-
this.attrs = combineAttrs(attrs, this.attrs || {});
|
|
1227
|
-
if (cls)
|
|
1228
|
-
this.attrs = combineAttrs({ class: cls }, this.attrs || {});
|
|
1229
|
-
}
|
|
1230
|
-
domAtPos(pos) {
|
|
1231
|
-
return inlineDOMAtPos(this, pos);
|
|
1232
|
-
}
|
|
1233
|
-
reuseDOM(node) {
|
|
1234
|
-
if (node.nodeName == "DIV") {
|
|
1235
|
-
this.setDOM(node);
|
|
1236
|
-
this.flags |= 4 /* ViewFlag.AttrsDirty */ | 2 /* ViewFlag.NodeDirty */;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
sync(view, track) {
|
|
1240
|
-
var _a;
|
|
1241
|
-
if (!this.dom) {
|
|
1242
|
-
this.setDOM(document.createElement("div"));
|
|
1243
|
-
this.dom.className = "cm-line";
|
|
1244
|
-
this.prevAttrs = this.attrs ? null : undefined;
|
|
1245
|
-
}
|
|
1246
|
-
else if (this.flags & 4 /* ViewFlag.AttrsDirty */) {
|
|
1247
|
-
clearAttributes(this.dom);
|
|
1248
|
-
this.dom.className = "cm-line";
|
|
1249
|
-
this.prevAttrs = this.attrs ? null : undefined;
|
|
1250
|
-
}
|
|
1251
|
-
if (this.prevAttrs !== undefined) {
|
|
1252
|
-
updateAttrs(this.dom, this.prevAttrs, this.attrs);
|
|
1253
|
-
this.dom.classList.add("cm-line");
|
|
1254
|
-
this.prevAttrs = undefined;
|
|
1255
|
-
}
|
|
1256
|
-
super.sync(view, track);
|
|
1257
|
-
let last = this.dom.lastChild;
|
|
1258
|
-
while (last && ContentView.get(last) instanceof MarkView)
|
|
1259
|
-
last = last.lastChild;
|
|
1260
|
-
if (!last || !this.length ||
|
|
1261
|
-
last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false &&
|
|
1262
|
-
(!browser.ios || !this.children.some(ch => ch instanceof TextView))) {
|
|
1263
|
-
let hack = document.createElement("BR");
|
|
1264
|
-
hack.cmIgnore = true;
|
|
1265
|
-
this.dom.appendChild(hack);
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
measureTextSize() {
|
|
1269
|
-
if (this.children.length == 0 || this.length > 20)
|
|
1270
|
-
return null;
|
|
1271
|
-
let totalWidth = 0, textHeight;
|
|
1272
|
-
for (let child of this.children) {
|
|
1273
|
-
if (!(child instanceof TextView) || /[^ -~]/.test(child.text))
|
|
1274
|
-
return null;
|
|
1275
|
-
let rects = clientRectsFor(child.dom);
|
|
1276
|
-
if (rects.length != 1)
|
|
1277
|
-
return null;
|
|
1278
|
-
totalWidth += rects[0].width;
|
|
1279
|
-
textHeight = rects[0].height;
|
|
1280
|
-
}
|
|
1281
|
-
return !totalWidth ? null : {
|
|
1282
|
-
lineHeight: this.dom.getBoundingClientRect().height,
|
|
1283
|
-
charWidth: totalWidth / this.length,
|
|
1284
|
-
textHeight
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
coordsAt(pos, side) {
|
|
1288
|
-
let rect = coordsInChildren(this, pos, side);
|
|
1289
|
-
// Correct rectangle height for empty lines when the returned
|
|
1290
|
-
// height is larger than the text height.
|
|
1291
|
-
if (!this.children.length && rect && this.parent) {
|
|
1292
|
-
let { heightOracle } = this.parent.view.viewState, height = rect.bottom - rect.top;
|
|
1293
|
-
if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) {
|
|
1294
|
-
let dist = (height - heightOracle.textHeight) / 2;
|
|
1295
|
-
return { top: rect.top + dist, bottom: rect.bottom - dist, left: rect.left, right: rect.left };
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
return rect;
|
|
1299
|
-
}
|
|
1300
|
-
become(other) {
|
|
1301
|
-
return other instanceof LineView && this.children.length == 0 && other.children.length == 0 &&
|
|
1302
|
-
attrsEq(this.attrs, other.attrs) && this.breakAfter == other.breakAfter;
|
|
1303
|
-
}
|
|
1304
|
-
covers() { return true; }
|
|
1305
|
-
static find(docView, pos) {
|
|
1306
|
-
for (let i = 0, off = 0; i < docView.children.length; i++) {
|
|
1307
|
-
let block = docView.children[i], end = off + block.length;
|
|
1308
|
-
if (end >= pos) {
|
|
1309
|
-
if (block instanceof LineView)
|
|
1310
|
-
return block;
|
|
1311
|
-
if (end > pos)
|
|
1312
|
-
break;
|
|
1313
|
-
}
|
|
1314
|
-
off = end + block.breakAfter;
|
|
1315
|
-
}
|
|
1316
|
-
return null;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
class BlockWidgetView extends ContentView {
|
|
1320
|
-
constructor(widget, length, deco) {
|
|
1321
|
-
super();
|
|
1322
|
-
this.widget = widget;
|
|
1323
|
-
this.length = length;
|
|
1324
|
-
this.deco = deco;
|
|
1325
|
-
this.breakAfter = 0;
|
|
1326
|
-
this.prevWidget = null;
|
|
1327
|
-
}
|
|
1328
|
-
merge(from, to, source, _takeDeco, openStart, openEnd) {
|
|
1329
|
-
if (source && (!(source instanceof BlockWidgetView) || !this.widget.compare(source.widget) ||
|
|
1330
|
-
from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
1331
|
-
return false;
|
|
1332
|
-
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
1333
|
-
return true;
|
|
1334
|
-
}
|
|
1335
|
-
domAtPos(pos) {
|
|
1336
|
-
return pos == 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom, pos == this.length);
|
|
1337
|
-
}
|
|
1338
|
-
split(at) {
|
|
1339
|
-
let len = this.length - at;
|
|
1340
|
-
this.length = at;
|
|
1341
|
-
let end = new BlockWidgetView(this.widget, len, this.deco);
|
|
1342
|
-
end.breakAfter = this.breakAfter;
|
|
1343
|
-
return end;
|
|
1344
|
-
}
|
|
1345
|
-
get children() { return noChildren; }
|
|
1346
|
-
sync(view) {
|
|
1347
|
-
if (!this.dom || !this.widget.updateDOM(this.dom, view)) {
|
|
1348
|
-
if (this.dom && this.prevWidget)
|
|
1349
|
-
this.prevWidget.destroy(this.dom);
|
|
1350
|
-
this.prevWidget = null;
|
|
1351
|
-
this.setDOM(this.widget.toDOM(view));
|
|
1352
|
-
if (!this.widget.editable)
|
|
1353
|
-
this.dom.contentEditable = "false";
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
get overrideDOMText() {
|
|
1357
|
-
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text.empty;
|
|
1358
|
-
}
|
|
1359
|
-
domBoundsAround() { return null; }
|
|
1360
|
-
become(other) {
|
|
1361
|
-
if (other instanceof BlockWidgetView &&
|
|
1362
|
-
other.widget.constructor == this.widget.constructor) {
|
|
1363
|
-
if (!other.widget.compare(this.widget))
|
|
1364
|
-
this.markDirty(true);
|
|
1365
|
-
if (this.dom && !this.prevWidget)
|
|
1366
|
-
this.prevWidget = this.widget;
|
|
1367
|
-
this.widget = other.widget;
|
|
1368
|
-
this.length = other.length;
|
|
1369
|
-
this.deco = other.deco;
|
|
1370
|
-
this.breakAfter = other.breakAfter;
|
|
1371
|
-
return true;
|
|
1372
|
-
}
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
ignoreMutation() { return true; }
|
|
1376
|
-
ignoreEvent(event) { return this.widget.ignoreEvent(event); }
|
|
1377
|
-
get isEditable() { return false; }
|
|
1378
|
-
get isWidget() { return true; }
|
|
1379
|
-
coordsAt(pos, side) {
|
|
1380
|
-
return this.widget.coordsAt(this.dom, pos, side);
|
|
1381
|
-
}
|
|
1382
|
-
destroy() {
|
|
1383
|
-
super.destroy();
|
|
1384
|
-
if (this.dom)
|
|
1385
|
-
this.widget.destroy(this.dom);
|
|
1386
|
-
}
|
|
1387
|
-
covers(side) {
|
|
1388
|
-
let { startSide, endSide } = this.deco;
|
|
1389
|
-
return startSide == endSide ? false : side < 0 ? startSide < 0 : endSide > 0;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
1159
|
/**
|
|
1394
1160
|
Widgets added to the content are described by subclasses of this
|
|
1395
1161
|
class. Using a description object like that makes it possible to
|
|
@@ -1554,124 +1320,383 @@ class Decoration extends RangeValue {
|
|
|
1554
1320
|
startSide = -500000000 /* Side.GapStart */;
|
|
1555
1321
|
endSide = 400000000 /* Side.GapEnd */;
|
|
1556
1322
|
}
|
|
1557
|
-
else {
|
|
1558
|
-
let { start, end } = getInclusive(spec, block);
|
|
1559
|
-
startSide = (start ? (block ? -300000000 /* Side.BlockIncStart */ : -1 /* Side.InlineIncStart */) : 500000000 /* Side.NonIncStart */) - 1;
|
|
1560
|
-
endSide = (end ? (block ? 200000000 /* Side.BlockIncEnd */ : 1 /* Side.InlineIncEnd */) : -600000000 /* Side.NonIncEnd */) + 1;
|
|
1323
|
+
else {
|
|
1324
|
+
let { start, end } = getInclusive(spec, block);
|
|
1325
|
+
startSide = (start ? (block ? -300000000 /* Side.BlockIncStart */ : -1 /* Side.InlineIncStart */) : 500000000 /* Side.NonIncStart */) - 1;
|
|
1326
|
+
endSide = (end ? (block ? 200000000 /* Side.BlockIncEnd */ : 1 /* Side.InlineIncEnd */) : -600000000 /* Side.NonIncEnd */) + 1;
|
|
1327
|
+
}
|
|
1328
|
+
return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
Create a line decoration, which can add DOM attributes to the
|
|
1332
|
+
line starting at the given position.
|
|
1333
|
+
*/
|
|
1334
|
+
static line(spec) {
|
|
1335
|
+
return new LineDecoration(spec);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
|
|
1339
|
+
decorated range or ranges. If the ranges aren't already sorted,
|
|
1340
|
+
pass `true` for `sort` to make the library sort them for you.
|
|
1341
|
+
*/
|
|
1342
|
+
static set(of, sort = false) {
|
|
1343
|
+
return RangeSet.of(of, sort);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
@internal
|
|
1347
|
+
*/
|
|
1348
|
+
hasHeight() { return this.widget ? this.widget.estimatedHeight > -1 : false; }
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
The empty set of decorations.
|
|
1352
|
+
*/
|
|
1353
|
+
Decoration.none = RangeSet.empty;
|
|
1354
|
+
class MarkDecoration extends Decoration {
|
|
1355
|
+
constructor(spec) {
|
|
1356
|
+
let { start, end } = getInclusive(spec);
|
|
1357
|
+
super(start ? -1 /* Side.InlineIncStart */ : 500000000 /* Side.NonIncStart */, end ? 1 /* Side.InlineIncEnd */ : -600000000 /* Side.NonIncEnd */, null, spec);
|
|
1358
|
+
this.tagName = spec.tagName || "span";
|
|
1359
|
+
this.class = spec.class || "";
|
|
1360
|
+
this.attrs = spec.attributes || null;
|
|
1361
|
+
}
|
|
1362
|
+
eq(other) {
|
|
1363
|
+
var _a, _b;
|
|
1364
|
+
return this == other ||
|
|
1365
|
+
other instanceof MarkDecoration &&
|
|
1366
|
+
this.tagName == other.tagName &&
|
|
1367
|
+
(this.class || ((_a = this.attrs) === null || _a === void 0 ? void 0 : _a.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) &&
|
|
1368
|
+
attrsEq(this.attrs, other.attrs, "class");
|
|
1369
|
+
}
|
|
1370
|
+
range(from, to = from) {
|
|
1371
|
+
if (from >= to)
|
|
1372
|
+
throw new RangeError("Mark decorations may not be empty");
|
|
1373
|
+
return super.range(from, to);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
MarkDecoration.prototype.point = false;
|
|
1377
|
+
class LineDecoration extends Decoration {
|
|
1378
|
+
constructor(spec) {
|
|
1379
|
+
super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
|
|
1380
|
+
}
|
|
1381
|
+
eq(other) {
|
|
1382
|
+
return other instanceof LineDecoration &&
|
|
1383
|
+
this.spec.class == other.spec.class &&
|
|
1384
|
+
attrsEq(this.spec.attributes, other.spec.attributes);
|
|
1385
|
+
}
|
|
1386
|
+
range(from, to = from) {
|
|
1387
|
+
if (to != from)
|
|
1388
|
+
throw new RangeError("Line decoration ranges must be zero-length");
|
|
1389
|
+
return super.range(from, to);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
LineDecoration.prototype.mapMode = MapMode.TrackBefore;
|
|
1393
|
+
LineDecoration.prototype.point = true;
|
|
1394
|
+
class PointDecoration extends Decoration {
|
|
1395
|
+
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
1396
|
+
super(startSide, endSide, widget, spec);
|
|
1397
|
+
this.block = block;
|
|
1398
|
+
this.isReplace = isReplace;
|
|
1399
|
+
this.mapMode = !block ? MapMode.TrackDel : startSide <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter;
|
|
1400
|
+
}
|
|
1401
|
+
// Only relevant when this.block == true
|
|
1402
|
+
get type() {
|
|
1403
|
+
return this.startSide != this.endSide ? BlockType.WidgetRange
|
|
1404
|
+
: this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter;
|
|
1405
|
+
}
|
|
1406
|
+
get heightRelevant() {
|
|
1407
|
+
return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);
|
|
1408
|
+
}
|
|
1409
|
+
eq(other) {
|
|
1410
|
+
return other instanceof PointDecoration &&
|
|
1411
|
+
widgetsEq(this.widget, other.widget) &&
|
|
1412
|
+
this.block == other.block &&
|
|
1413
|
+
this.startSide == other.startSide && this.endSide == other.endSide;
|
|
1414
|
+
}
|
|
1415
|
+
range(from, to = from) {
|
|
1416
|
+
if (this.isReplace && (from > to || (from == to && this.startSide > 0 && this.endSide <= 0)))
|
|
1417
|
+
throw new RangeError("Invalid range for replacement decoration");
|
|
1418
|
+
if (!this.isReplace && to != from)
|
|
1419
|
+
throw new RangeError("Widget decorations can only have zero-length ranges");
|
|
1420
|
+
return super.range(from, to);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
PointDecoration.prototype.point = true;
|
|
1424
|
+
function getInclusive(spec, block = false) {
|
|
1425
|
+
let { inclusiveStart: start, inclusiveEnd: end } = spec;
|
|
1426
|
+
if (start == null)
|
|
1427
|
+
start = spec.inclusive;
|
|
1428
|
+
if (end == null)
|
|
1429
|
+
end = spec.inclusive;
|
|
1430
|
+
return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };
|
|
1431
|
+
}
|
|
1432
|
+
function widgetsEq(a, b) {
|
|
1433
|
+
return a == b || !!(a && b && a.compare(b));
|
|
1434
|
+
}
|
|
1435
|
+
function addRange(from, to, ranges, margin = 0) {
|
|
1436
|
+
let last = ranges.length - 1;
|
|
1437
|
+
if (last >= 0 && ranges[last] + margin >= from)
|
|
1438
|
+
ranges[last] = Math.max(ranges[last], to);
|
|
1439
|
+
else
|
|
1440
|
+
ranges.push(from, to);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
class LineView extends ContentView {
|
|
1444
|
+
constructor() {
|
|
1445
|
+
super(...arguments);
|
|
1446
|
+
this.children = [];
|
|
1447
|
+
this.length = 0;
|
|
1448
|
+
this.prevAttrs = undefined;
|
|
1449
|
+
this.attrs = null;
|
|
1450
|
+
this.breakAfter = 0;
|
|
1451
|
+
}
|
|
1452
|
+
// Consumes source
|
|
1453
|
+
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
1454
|
+
if (source) {
|
|
1455
|
+
if (!(source instanceof LineView))
|
|
1456
|
+
return false;
|
|
1457
|
+
if (!this.dom)
|
|
1458
|
+
source.transferDOM(this); // Reuse source.dom when appropriate
|
|
1459
|
+
}
|
|
1460
|
+
if (hasStart)
|
|
1461
|
+
this.setDeco(source ? source.attrs : null);
|
|
1462
|
+
mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart, openEnd);
|
|
1463
|
+
return true;
|
|
1464
|
+
}
|
|
1465
|
+
split(at) {
|
|
1466
|
+
let end = new LineView;
|
|
1467
|
+
end.breakAfter = this.breakAfter;
|
|
1468
|
+
if (this.length == 0)
|
|
1469
|
+
return end;
|
|
1470
|
+
let { i, off } = this.childPos(at);
|
|
1471
|
+
if (off) {
|
|
1472
|
+
end.append(this.children[i].split(off), 0);
|
|
1473
|
+
this.children[i].merge(off, this.children[i].length, null, false, 0, 0);
|
|
1474
|
+
i++;
|
|
1475
|
+
}
|
|
1476
|
+
for (let j = i; j < this.children.length; j++)
|
|
1477
|
+
end.append(this.children[j], 0);
|
|
1478
|
+
while (i > 0 && this.children[i - 1].length == 0)
|
|
1479
|
+
this.children[--i].destroy();
|
|
1480
|
+
this.children.length = i;
|
|
1481
|
+
this.markDirty();
|
|
1482
|
+
this.length = at;
|
|
1483
|
+
return end;
|
|
1484
|
+
}
|
|
1485
|
+
transferDOM(other) {
|
|
1486
|
+
if (!this.dom)
|
|
1487
|
+
return;
|
|
1488
|
+
this.markDirty();
|
|
1489
|
+
other.setDOM(this.dom);
|
|
1490
|
+
other.prevAttrs = this.prevAttrs === undefined ? this.attrs : this.prevAttrs;
|
|
1491
|
+
this.prevAttrs = undefined;
|
|
1492
|
+
this.dom = null;
|
|
1493
|
+
}
|
|
1494
|
+
setDeco(attrs) {
|
|
1495
|
+
if (!attrsEq(this.attrs, attrs)) {
|
|
1496
|
+
if (this.dom) {
|
|
1497
|
+
this.prevAttrs = this.attrs;
|
|
1498
|
+
this.markDirty();
|
|
1499
|
+
}
|
|
1500
|
+
this.attrs = attrs;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
append(child, openStart) {
|
|
1504
|
+
joinInlineInto(this, child, openStart);
|
|
1505
|
+
}
|
|
1506
|
+
// Only called when building a line view in ContentBuilder
|
|
1507
|
+
addLineDeco(deco) {
|
|
1508
|
+
let attrs = deco.spec.attributes, cls = deco.spec.class;
|
|
1509
|
+
if (attrs)
|
|
1510
|
+
this.attrs = combineAttrs(attrs, this.attrs || {});
|
|
1511
|
+
if (cls)
|
|
1512
|
+
this.attrs = combineAttrs({ class: cls }, this.attrs || {});
|
|
1513
|
+
}
|
|
1514
|
+
domAtPos(pos) {
|
|
1515
|
+
return inlineDOMAtPos(this, pos);
|
|
1516
|
+
}
|
|
1517
|
+
reuseDOM(node) {
|
|
1518
|
+
if (node.nodeName == "DIV") {
|
|
1519
|
+
this.setDOM(node);
|
|
1520
|
+
this.flags |= 4 /* ViewFlag.AttrsDirty */ | 2 /* ViewFlag.NodeDirty */;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
sync(view, track) {
|
|
1524
|
+
var _a;
|
|
1525
|
+
if (!this.dom) {
|
|
1526
|
+
this.setDOM(document.createElement("div"));
|
|
1527
|
+
this.dom.className = "cm-line";
|
|
1528
|
+
this.prevAttrs = this.attrs ? null : undefined;
|
|
1529
|
+
}
|
|
1530
|
+
else if (this.flags & 4 /* ViewFlag.AttrsDirty */) {
|
|
1531
|
+
clearAttributes(this.dom);
|
|
1532
|
+
this.dom.className = "cm-line";
|
|
1533
|
+
this.prevAttrs = this.attrs ? null : undefined;
|
|
1534
|
+
}
|
|
1535
|
+
if (this.prevAttrs !== undefined) {
|
|
1536
|
+
updateAttrs(this.dom, this.prevAttrs, this.attrs);
|
|
1537
|
+
this.dom.classList.add("cm-line");
|
|
1538
|
+
this.prevAttrs = undefined;
|
|
1539
|
+
}
|
|
1540
|
+
super.sync(view, track);
|
|
1541
|
+
let last = this.dom.lastChild;
|
|
1542
|
+
while (last && ContentView.get(last) instanceof MarkView)
|
|
1543
|
+
last = last.lastChild;
|
|
1544
|
+
if (!last || !this.length ||
|
|
1545
|
+
last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false &&
|
|
1546
|
+
(!browser.ios || !this.children.some(ch => ch instanceof TextView))) {
|
|
1547
|
+
let hack = document.createElement("BR");
|
|
1548
|
+
hack.cmIgnore = true;
|
|
1549
|
+
this.dom.appendChild(hack);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
measureTextSize() {
|
|
1553
|
+
if (this.children.length == 0 || this.length > 20)
|
|
1554
|
+
return null;
|
|
1555
|
+
let totalWidth = 0, textHeight;
|
|
1556
|
+
for (let child of this.children) {
|
|
1557
|
+
if (!(child instanceof TextView) || /[^ -~]/.test(child.text))
|
|
1558
|
+
return null;
|
|
1559
|
+
let rects = clientRectsFor(child.dom);
|
|
1560
|
+
if (rects.length != 1)
|
|
1561
|
+
return null;
|
|
1562
|
+
totalWidth += rects[0].width;
|
|
1563
|
+
textHeight = rects[0].height;
|
|
1564
|
+
}
|
|
1565
|
+
return !totalWidth ? null : {
|
|
1566
|
+
lineHeight: this.dom.getBoundingClientRect().height,
|
|
1567
|
+
charWidth: totalWidth / this.length,
|
|
1568
|
+
textHeight
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
coordsAt(pos, side) {
|
|
1572
|
+
let rect = coordsInChildren(this, pos, side);
|
|
1573
|
+
// Correct rectangle height for empty lines when the returned
|
|
1574
|
+
// height is larger than the text height.
|
|
1575
|
+
if (!this.children.length && rect && this.parent) {
|
|
1576
|
+
let { heightOracle } = this.parent.view.viewState, height = rect.bottom - rect.top;
|
|
1577
|
+
if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) {
|
|
1578
|
+
let dist = (height - heightOracle.textHeight) / 2;
|
|
1579
|
+
return { top: rect.top + dist, bottom: rect.bottom - dist, left: rect.left, right: rect.left };
|
|
1580
|
+
}
|
|
1561
1581
|
}
|
|
1562
|
-
return
|
|
1582
|
+
return rect;
|
|
1563
1583
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
*/
|
|
1568
|
-
static line(spec) {
|
|
1569
|
-
return new LineDecoration(spec);
|
|
1584
|
+
become(other) {
|
|
1585
|
+
return other instanceof LineView && this.children.length == 0 && other.children.length == 0 &&
|
|
1586
|
+
attrsEq(this.attrs, other.attrs) && this.breakAfter == other.breakAfter;
|
|
1570
1587
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1588
|
+
covers() { return true; }
|
|
1589
|
+
static find(docView, pos) {
|
|
1590
|
+
for (let i = 0, off = 0; i < docView.children.length; i++) {
|
|
1591
|
+
let block = docView.children[i], end = off + block.length;
|
|
1592
|
+
if (end >= pos) {
|
|
1593
|
+
if (block instanceof LineView)
|
|
1594
|
+
return block;
|
|
1595
|
+
if (end > pos)
|
|
1596
|
+
break;
|
|
1597
|
+
}
|
|
1598
|
+
off = end + block.breakAfter;
|
|
1599
|
+
}
|
|
1600
|
+
return null;
|
|
1578
1601
|
}
|
|
1579
|
-
/**
|
|
1580
|
-
@internal
|
|
1581
|
-
*/
|
|
1582
|
-
hasHeight() { return this.widget ? this.widget.estimatedHeight > -1 : false; }
|
|
1583
1602
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
this.tagName = spec.tagName || "span";
|
|
1593
|
-
this.class = spec.class || "";
|
|
1594
|
-
this.attrs = spec.attributes || null;
|
|
1595
|
-
}
|
|
1596
|
-
eq(other) {
|
|
1597
|
-
var _a, _b;
|
|
1598
|
-
return this == other ||
|
|
1599
|
-
other instanceof MarkDecoration &&
|
|
1600
|
-
this.tagName == other.tagName &&
|
|
1601
|
-
(this.class || ((_a = this.attrs) === null || _a === void 0 ? void 0 : _a.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) &&
|
|
1602
|
-
attrsEq(this.attrs, other.attrs, "class");
|
|
1603
|
+
class BlockWidgetView extends ContentView {
|
|
1604
|
+
constructor(widget, length, deco) {
|
|
1605
|
+
super();
|
|
1606
|
+
this.widget = widget;
|
|
1607
|
+
this.length = length;
|
|
1608
|
+
this.deco = deco;
|
|
1609
|
+
this.breakAfter = 0;
|
|
1610
|
+
this.prevWidget = null;
|
|
1603
1611
|
}
|
|
1604
|
-
|
|
1605
|
-
if (
|
|
1606
|
-
|
|
1607
|
-
|
|
1612
|
+
merge(from, to, source, _takeDeco, openStart, openEnd) {
|
|
1613
|
+
if (source && (!(source instanceof BlockWidgetView) || !this.widget.compare(source.widget) ||
|
|
1614
|
+
from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))
|
|
1615
|
+
return false;
|
|
1616
|
+
this.length = from + (source ? source.length : 0) + (this.length - to);
|
|
1617
|
+
return true;
|
|
1608
1618
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
class LineDecoration extends Decoration {
|
|
1612
|
-
constructor(spec) {
|
|
1613
|
-
super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
|
|
1619
|
+
domAtPos(pos) {
|
|
1620
|
+
return pos == 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom, pos == this.length);
|
|
1614
1621
|
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1622
|
+
split(at) {
|
|
1623
|
+
let len = this.length - at;
|
|
1624
|
+
this.length = at;
|
|
1625
|
+
let end = new BlockWidgetView(this.widget, len, this.deco);
|
|
1626
|
+
end.breakAfter = this.breakAfter;
|
|
1627
|
+
return end;
|
|
1619
1628
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1629
|
+
get children() { return noChildren; }
|
|
1630
|
+
sync(view) {
|
|
1631
|
+
if (!this.dom || !this.widget.updateDOM(this.dom, view)) {
|
|
1632
|
+
if (this.dom && this.prevWidget)
|
|
1633
|
+
this.prevWidget.destroy(this.dom);
|
|
1634
|
+
this.prevWidget = null;
|
|
1635
|
+
this.setDOM(this.widget.toDOM(view));
|
|
1636
|
+
if (!this.widget.editable)
|
|
1637
|
+
this.dom.contentEditable = "false";
|
|
1638
|
+
}
|
|
1624
1639
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
LineDecoration.prototype.point = true;
|
|
1628
|
-
class PointDecoration extends Decoration {
|
|
1629
|
-
constructor(spec, startSide, endSide, block, widget, isReplace) {
|
|
1630
|
-
super(startSide, endSide, widget, spec);
|
|
1631
|
-
this.block = block;
|
|
1632
|
-
this.isReplace = isReplace;
|
|
1633
|
-
this.mapMode = !block ? MapMode.TrackDel : startSide <= 0 ? MapMode.TrackBefore : MapMode.TrackAfter;
|
|
1640
|
+
get overrideDOMText() {
|
|
1641
|
+
return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : Text.empty;
|
|
1634
1642
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1643
|
+
domBoundsAround() { return null; }
|
|
1644
|
+
become(other) {
|
|
1645
|
+
if (other instanceof BlockWidgetView &&
|
|
1646
|
+
other.widget.constructor == this.widget.constructor) {
|
|
1647
|
+
if (!other.widget.compare(this.widget))
|
|
1648
|
+
this.markDirty(true);
|
|
1649
|
+
if (this.dom && !this.prevWidget)
|
|
1650
|
+
this.prevWidget = this.widget;
|
|
1651
|
+
this.widget = other.widget;
|
|
1652
|
+
this.length = other.length;
|
|
1653
|
+
this.deco = other.deco;
|
|
1654
|
+
this.breakAfter = other.breakAfter;
|
|
1655
|
+
return true;
|
|
1656
|
+
}
|
|
1657
|
+
return false;
|
|
1639
1658
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1659
|
+
ignoreMutation() { return true; }
|
|
1660
|
+
ignoreEvent(event) { return this.widget.ignoreEvent(event); }
|
|
1661
|
+
get isEditable() { return false; }
|
|
1662
|
+
get isWidget() { return true; }
|
|
1663
|
+
coordsAt(pos, side) {
|
|
1664
|
+
let custom = this.widget.coordsAt(this.dom, pos, side);
|
|
1665
|
+
if (custom)
|
|
1666
|
+
return custom;
|
|
1667
|
+
if (this.widget instanceof BlockGapWidget)
|
|
1668
|
+
return null;
|
|
1669
|
+
return flattenRect(this.dom.getBoundingClientRect(), this.length ? pos == 0 : side <= 0);
|
|
1642
1670
|
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
this.
|
|
1647
|
-
this.startSide == other.startSide && this.endSide == other.endSide;
|
|
1671
|
+
destroy() {
|
|
1672
|
+
super.destroy();
|
|
1673
|
+
if (this.dom)
|
|
1674
|
+
this.widget.destroy(this.dom);
|
|
1648
1675
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
if (!this.isReplace && to != from)
|
|
1653
|
-
throw new RangeError("Widget decorations can only have zero-length ranges");
|
|
1654
|
-
return super.range(from, to);
|
|
1676
|
+
covers(side) {
|
|
1677
|
+
let { startSide, endSide } = this.deco;
|
|
1678
|
+
return startSide == endSide ? false : side < 0 ? startSide < 0 : endSide > 0;
|
|
1655
1679
|
}
|
|
1656
1680
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1681
|
+
class BlockGapWidget extends WidgetType {
|
|
1682
|
+
constructor(height) {
|
|
1683
|
+
super();
|
|
1684
|
+
this.height = height;
|
|
1685
|
+
}
|
|
1686
|
+
toDOM() {
|
|
1687
|
+
let elt = document.createElement("div");
|
|
1688
|
+
elt.className = "cm-gap";
|
|
1689
|
+
this.updateDOM(elt);
|
|
1690
|
+
return elt;
|
|
1691
|
+
}
|
|
1692
|
+
eq(other) { return other.height == this.height; }
|
|
1693
|
+
updateDOM(elt) {
|
|
1694
|
+
elt.style.height = this.height + "px";
|
|
1695
|
+
return true;
|
|
1696
|
+
}
|
|
1697
|
+
get editable() { return true; }
|
|
1698
|
+
get estimatedHeight() { return this.height; }
|
|
1699
|
+
ignoreEvent() { return false; }
|
|
1675
1700
|
}
|
|
1676
1701
|
|
|
1677
1702
|
class ContentBuilder {
|
|
@@ -3260,26 +3285,6 @@ function betweenUneditable(pos) {
|
|
|
3260
3285
|
(pos.offset == 0 || pos.node.childNodes[pos.offset - 1].contentEditable == "false") &&
|
|
3261
3286
|
(pos.offset == pos.node.childNodes.length || pos.node.childNodes[pos.offset].contentEditable == "false");
|
|
3262
3287
|
}
|
|
3263
|
-
class BlockGapWidget extends WidgetType {
|
|
3264
|
-
constructor(height) {
|
|
3265
|
-
super();
|
|
3266
|
-
this.height = height;
|
|
3267
|
-
}
|
|
3268
|
-
toDOM() {
|
|
3269
|
-
let elt = document.createElement("div");
|
|
3270
|
-
elt.className = "cm-gap";
|
|
3271
|
-
this.updateDOM(elt);
|
|
3272
|
-
return elt;
|
|
3273
|
-
}
|
|
3274
|
-
eq(other) { return other.height == this.height; }
|
|
3275
|
-
updateDOM(elt) {
|
|
3276
|
-
elt.style.height = this.height + "px";
|
|
3277
|
-
return true;
|
|
3278
|
-
}
|
|
3279
|
-
get editable() { return true; }
|
|
3280
|
-
get estimatedHeight() { return this.height; }
|
|
3281
|
-
ignoreEvent() { return false; }
|
|
3282
|
-
}
|
|
3283
3288
|
function findCompositionNode(view, headPos) {
|
|
3284
3289
|
let sel = view.observer.selectionRange;
|
|
3285
3290
|
if (!sel.focusNode)
|
|
@@ -5730,7 +5735,7 @@ function visiblePixelRange(dom, paddingTop) {
|
|
|
5730
5735
|
left = Math.max(left, parentRect.left);
|
|
5731
5736
|
right = Math.min(right, parentRect.right);
|
|
5732
5737
|
top = Math.max(top, parentRect.top);
|
|
5733
|
-
bottom = parent == dom.parentNode ?
|
|
5738
|
+
bottom = Math.min(parent == dom.parentNode ? win.innerHeight : bottom, parentRect.bottom);
|
|
5734
5739
|
}
|
|
5735
5740
|
parent = style.position == "absolute" || style.position == "fixed" ? elt.offsetParent : elt.parentNode;
|
|
5736
5741
|
}
|
|
@@ -6384,7 +6389,8 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
6384
6389
|
height: "100%",
|
|
6385
6390
|
overflowX: "auto",
|
|
6386
6391
|
position: "relative",
|
|
6387
|
-
zIndex: 0
|
|
6392
|
+
zIndex: 0,
|
|
6393
|
+
overflowAnchor: "none",
|
|
6388
6394
|
},
|
|
6389
6395
|
".cm-content": {
|
|
6390
6396
|
margin: 0,
|
|
@@ -6521,7 +6527,8 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
6521
6527
|
boxSizing: "border-box",
|
|
6522
6528
|
position: "sticky",
|
|
6523
6529
|
left: 0,
|
|
6524
|
-
right: 0
|
|
6530
|
+
right: 0,
|
|
6531
|
+
zIndex: 300
|
|
6525
6532
|
},
|
|
6526
6533
|
"&light .cm-panels": {
|
|
6527
6534
|
backgroundColor: "#f5f5f5",
|
|
@@ -7351,6 +7358,7 @@ class EditorView {
|
|
|
7351
7358
|
view, so that the user can see the editor.
|
|
7352
7359
|
*/
|
|
7353
7360
|
constructor(config = {}) {
|
|
7361
|
+
var _a;
|
|
7354
7362
|
this.plugins = [];
|
|
7355
7363
|
this.pluginMap = new Map;
|
|
7356
7364
|
this.editorAttrs = {};
|
|
@@ -7402,6 +7410,8 @@ class EditorView {
|
|
|
7402
7410
|
this.updateAttrs();
|
|
7403
7411
|
this.updateState = 0 /* UpdateState.Idle */;
|
|
7404
7412
|
this.requestMeasure();
|
|
7413
|
+
if ((_a = document.fonts) === null || _a === void 0 ? void 0 : _a.ready)
|
|
7414
|
+
document.fonts.ready.then(() => this.requestMeasure());
|
|
7405
7415
|
}
|
|
7406
7416
|
dispatch(...input) {
|
|
7407
7417
|
let trs = input.length == 1 && input[0] instanceof Transaction ? input
|
|
@@ -7867,7 +7877,7 @@ class EditorView {
|
|
|
7867
7877
|
/**
|
|
7868
7878
|
Find the line block around the given document position. A line
|
|
7869
7879
|
block is a range delimited on both sides by either a
|
|
7870
|
-
non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line
|
|
7880
|
+
non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line break, or the
|
|
7871
7881
|
start/end of the document. It will usually just hold a line of
|
|
7872
7882
|
text, but may be broken into multiple textblocks by block
|
|
7873
7883
|
widgets.
|
|
@@ -10537,6 +10547,11 @@ Markers given to this facet should _only_ define an
|
|
|
10537
10547
|
in all gutters for the line).
|
|
10538
10548
|
*/
|
|
10539
10549
|
const gutterLineClass = /*@__PURE__*/Facet.define();
|
|
10550
|
+
/**
|
|
10551
|
+
Facet used to add a class to all gutter elements next to a widget.
|
|
10552
|
+
Should not provide widgets with a `toDOM` method.
|
|
10553
|
+
*/
|
|
10554
|
+
const gutterWidgetClass = /*@__PURE__*/Facet.define();
|
|
10540
10555
|
const defaults = {
|
|
10541
10556
|
class: "",
|
|
10542
10557
|
renderEmptyElements: false,
|
|
@@ -10747,9 +10762,14 @@ class UpdateContext {
|
|
|
10747
10762
|
this.addElement(view, line, localMarkers);
|
|
10748
10763
|
}
|
|
10749
10764
|
widget(view, block) {
|
|
10750
|
-
let marker = this.gutter.config.widgetMarker(view, block.widget, block);
|
|
10751
|
-
|
|
10752
|
-
|
|
10765
|
+
let marker = this.gutter.config.widgetMarker(view, block.widget, block), markers = marker ? [marker] : null;
|
|
10766
|
+
for (let cls of view.state.facet(gutterWidgetClass)) {
|
|
10767
|
+
let marker = cls(view, block.widget, block);
|
|
10768
|
+
if (marker)
|
|
10769
|
+
(markers || (markers = [])).push(marker);
|
|
10770
|
+
}
|
|
10771
|
+
if (markers)
|
|
10772
|
+
this.addElement(view, block, markers);
|
|
10753
10773
|
}
|
|
10754
10774
|
finish() {
|
|
10755
10775
|
let gutter = this.gutter;
|
|
@@ -10885,6 +10905,10 @@ function sameMarkers(a, b) {
|
|
|
10885
10905
|
Facet used to provide markers to the line number gutter.
|
|
10886
10906
|
*/
|
|
10887
10907
|
const lineNumberMarkers = /*@__PURE__*/Facet.define();
|
|
10908
|
+
/**
|
|
10909
|
+
Facet used to create markers in the line number gutter next to widgets.
|
|
10910
|
+
*/
|
|
10911
|
+
const lineNumberWidgetMarker = /*@__PURE__*/Facet.define();
|
|
10888
10912
|
const lineNumberConfig = /*@__PURE__*/Facet.define({
|
|
10889
10913
|
combine(values) {
|
|
10890
10914
|
return combineConfig(values, { formatNumber: String, domEventHandlers: {} }, {
|
|
@@ -10919,7 +10943,14 @@ const lineNumberGutter = /*@__PURE__*/activeGutters.compute([lineNumberConfig],
|
|
|
10919
10943
|
return null;
|
|
10920
10944
|
return new NumberMarker(formatNumber(view, view.state.doc.lineAt(line.from).number));
|
|
10921
10945
|
},
|
|
10922
|
-
widgetMarker: () =>
|
|
10946
|
+
widgetMarker: (view, widget, block) => {
|
|
10947
|
+
for (let m of view.state.facet(lineNumberWidgetMarker)) {
|
|
10948
|
+
let result = m(view, widget, block);
|
|
10949
|
+
if (result)
|
|
10950
|
+
return result;
|
|
10951
|
+
}
|
|
10952
|
+
return null;
|
|
10953
|
+
},
|
|
10923
10954
|
lineMarkerChange: update => update.startState.facet(lineNumberConfig) != update.state.facet(lineNumberConfig),
|
|
10924
10955
|
initialSpacer(view) {
|
|
10925
10956
|
return new NumberMarker(formatNumber(view, maxLineNumber(view.state.doc.lines)));
|
|
@@ -11029,4 +11060,4 @@ function highlightTrailingWhitespace() {
|
|
|
11029
11060
|
const __test = { HeightMap, HeightOracle, MeasuredHeights, QueryType, ChangedRange, computeOrder,
|
|
11030
11061
|
moveVisually, clearHeightChangeFlag, getHeightChangeFlag: () => heightChangeFlag };
|
|
11031
11062
|
|
|
11032
|
-
export { BidiSpan, BlockInfo, BlockType, Decoration, Direction, EditorView, GutterMarker, MatchDecorator, RectangleMarker, ViewPlugin, ViewUpdate, WidgetType, __test, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
|
|
11063
|
+
export { BidiSpan, BlockInfo, BlockType, Decoration, Direction, EditorView, GutterMarker, MatchDecorator, RectangleMarker, ViewPlugin, ViewUpdate, WidgetType, __test, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutterWidgetClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
|