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

Function tempTooltip

static/editor.md/lib/codemirror/addon/tern/tern.js:593–621  ·  view source on GitHub ↗
(cm, content)

Source from the content-addressed store, hash-verified

591 // Tooltips
592
593 function tempTooltip(cm, content) {
594 if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
595 var where = cm.cursorCoords();
596 var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
597 function maybeClear() {
598 old = true;
599 if (!mouseOnTip) clear();
600 }
601 function clear() {
602 cm.state.ternTooltip = null;
603 if (!tip.parentNode) return;
604 cm.off("cursorActivity", clear);
605 cm.off('blur', clear);
606 cm.off('scroll', clear);
607 fadeOut(tip);
608 }
609 var mouseOnTip = false, old = false;
610 CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
611 CodeMirror.on(tip, "mouseout", function(e) {
612 if (!CodeMirror.contains(tip, e.relatedTarget || e.toElement)) {
613 if (old) clear();
614 else mouseOnTip = false;
615 }
616 });
617 setTimeout(maybeClear, 1700);
618 cm.on("cursorActivity", clear);
619 cm.on('blur', clear);
620 cm.on('scroll', clear);
621 }
622
623 function makeTooltip(x, y, content) {
624 var node = elt("div", cls + "tooltip", content);

Callers 2

showContextInfoFunction · 0.85
showErrorFunction · 0.85

Calls 3

makeTooltipFunction · 0.85
removeFunction · 0.70
clearFunction · 0.70

Tested by

no test coverage detected