MCPcopy Index your code
hub / github.com/DHTMLX/gantt / selectionSnapshot

Function selectionSnapshot

samples/common/codehighlight/codemirror.js:4040–4055  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

4038 }
4039
4040 function selectionSnapshot(cm) {
4041 if (cm.hasFocus()) { return null }
4042 var active = activeElt();
4043 if (!active || !contains(cm.display.lineDiv, active)) { return null }
4044 var result = {activeElt: active};
4045 if (window.getSelection) {
4046 var sel = window.getSelection();
4047 if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
4048 result.anchorNode = sel.anchorNode;
4049 result.anchorOffset = sel.anchorOffset;
4050 result.focusNode = sel.focusNode;
4051 result.focusOffset = sel.focusOffset;
4052 }
4053 }
4054 return result
4055 }
4056
4057 function restoreSelection(snapshot) {
4058 if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }

Callers 1

updateDisplayIfNeededFunction · 0.85

Calls 2

activeEltFunction · 0.85
containsFunction · 0.85

Tested by

no test coverage detected