MCPcopy Create free account
hub / github.com/breck7/scroll / posToDOM

Function posToDOM

external/.scrollLibs.js:12459–12476  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

12457 ContentEditableInput.prototype.needsContentAttribute = true
12458
12459 function posToDOM(cm, pos) {
12460 var view = findViewForLine(cm, pos.line)
12461 if (!view || view.hidden) {
12462 return null
12463 }
12464 var line = getLine(cm.doc, pos.line)
12465 var info = mapFromLineView(view, line, pos.line)
12466
12467 var order = getOrder(line, cm.doc.direction),
12468 side = "left"
12469 if (order) {
12470 var partPos = getBidiPartAt(order, pos.ch)
12471 side = partPos % 2 ? "right" : "left"
12472 }
12473 var result = nodeAndOffsetInLineMap(info.map, pos.ch, side)
12474 result.offset = result.collapse == "right" ? result.end : result.start
12475 return result
12476 }
12477
12478 function isInGutter(node) {
12479 for (var scan = node; scan; scan = scan.parentNode) {

Callers 1

.scrollLibs.jsFile · 0.85

Calls 6

findViewForLineFunction · 0.85
getLineFunction · 0.85
mapFromLineViewFunction · 0.85
getBidiPartAtFunction · 0.85
nodeAndOffsetInLineMapFunction · 0.85
getOrderFunction · 0.70

Tested by

no test coverage detected