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