MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / addLineWidget

Function addLineWidget

static/libs/codemirror.js:5716–5735  ·  view source on GitHub ↗
(doc, handle, node, options)

Source from the content-addressed store, hash-verified

5714}
5715
5716function addLineWidget(doc, handle, node, options) {
5717 var widget = new LineWidget(doc, node, options);
5718 var cm = doc.cm;
5719 if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
5720 changeLine(doc, handle, "widget", function (line) {
5721 var widgets = line.widgets || (line.widgets = []);
5722 if (widget.insertAt == null) { widgets.push(widget); }
5723 else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
5724 widget.line = line;
5725 if (cm && !lineIsHidden(doc, line)) {
5726 var aboveVisible = heightAtLine(line) < doc.scrollTop;
5727 updateLineHeight(line, line.height + widgetHeight(widget));
5728 if (aboveVisible) { addToScrollTop(cm, widget.height); }
5729 cm.curOp.forceUpdate = true;
5730 }
5731 return true
5732 });
5733 if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
5734 return widget
5735}
5736
5737// TEXTMARKERS
5738

Callers 1

codemirror.jsFile · 0.85

Calls 8

changeLineFunction · 0.85
lineIsHiddenFunction · 0.85
heightAtLineFunction · 0.85
updateLineHeightFunction · 0.85
widgetHeightFunction · 0.85
addToScrollTopFunction · 0.85
signalLaterFunction · 0.85
lineNoFunction · 0.85

Tested by

no test coverage detected