MCPcopy Index your code
hub / github.com/pandao/editor.md / posToDOM

Function posToDOM

lib/codemirror/lib/codemirror.js:1775–1789  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

1773 }, ContentEditableInput.prototype);
1774
1775 function posToDOM(cm, pos) {
1776 var view = findViewForLine(cm, pos.line);
1777 if (!view || view.hidden) return null;
1778 var line = getLine(cm.doc, pos.line);
1779 var info = mapFromLineView(view, line, pos.line);
1780
1781 var order = getOrder(line), side = "left";
1782 if (order) {
1783 var partPos = getBidiPartAt(order, pos.ch);
1784 side = partPos % 2 ? "right" : "left";
1785 }
1786 var result = nodeAndOffsetInLineMap(info.map, pos.ch, "left");
1787 result.offset = result.collapse == "right" ? result.end : result.start;
1788 return result;
1789 }
1790
1791 function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }
1792

Callers 1

codemirror.jsFile · 0.70

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…