MCPcopy Create free account
hub / github.com/TruthHun/BookStack / addLineWidget

Function addLineWidget

static/mergely/lib/codemirror.js:6688–6706  ·  view source on GitHub ↗
(doc, handle, node, options)

Source from the content-addressed store, hash-verified

6686 }
6687
6688 function addLineWidget(doc, handle, node, options) {
6689 var widget = new LineWidget(doc, node, options);
6690 var cm = doc.cm;
6691 if (cm && widget.noHScroll) cm.display.alignWidgets = true;
6692 changeLine(doc, handle, "widget", function(line) {
6693 var widgets = line.widgets || (line.widgets = []);
6694 if (widget.insertAt == null) widgets.push(widget);
6695 else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);
6696 widget.line = line;
6697 if (cm && !lineIsHidden(doc, line)) {
6698 var aboveVisible = heightAtLine(line) < doc.scrollTop;
6699 updateLineHeight(line, line.height + widgetHeight(widget));
6700 if (aboveVisible) addToScrollPos(cm, null, widget.height);
6701 cm.curOp.forceUpdate = true;
6702 }
6703 return true;
6704 });
6705 return widget;
6706 }
6707
6708 // LINE DATA STRUCTURE
6709

Callers 1

codemirror.jsFile · 0.70

Calls 6

changeLineFunction · 0.70
lineIsHiddenFunction · 0.70
heightAtLineFunction · 0.70
updateLineHeightFunction · 0.70
widgetHeightFunction · 0.70
addToScrollPosFunction · 0.70

Tested by

no test coverage detected