MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / addLineWidget

Function addLineWidget

lib/web/CodeMirror/src/model/line_widget.js:59–78  ·  view source on GitHub ↗
(doc, handle, node, options)

Source from the content-addressed store, hash-verified

57}
58
59export function addLineWidget(doc, handle, node, options) {
60 let widget = new LineWidget(doc, node, options)
61 let cm = doc.cm
62 if (cm && widget.noHScroll) cm.display.alignWidgets = true
63 changeLine(doc, handle, "widget", line => {
64 let widgets = line.widgets || (line.widgets = [])
65 if (widget.insertAt == null) widgets.push(widget)
66 else widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget)
67 widget.line = line
68 if (cm && !lineIsHidden(doc, line)) {
69 let aboveVisible = heightAtLine(line) < doc.scrollTop
70 updateLineHeight(line, line.height + widgetHeight(widget))
71 if (aboveVisible) addToScrollTop(cm, widget.height)
72 cm.curOp.forceUpdate = true
73 }
74 return true
75 })
76 if (cm) signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
77 return widget
78}

Callers 1

Doc.jsFile · 0.90

Calls 11

changeLineFunction · 0.90
lineIsHiddenFunction · 0.90
heightAtLineFunction · 0.90
updateLineHeightFunction · 0.90
widgetHeightFunction · 0.90
addToScrollTopFunction · 0.90
signalLaterFunction · 0.90
lineNoFunction · 0.90
pushMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected