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

Function runModalAtCursor

lib/web/modal.js:149–165  ·  view source on GitHub ↗
(placeholder, completeme, initialText)

Source from the content-addressed store, hash-verified

147//runModal("running modal...", completme, "Field-modal")
148
149function runModalAtCursor(placeholder, completeme, initialText) {
150 var m = runModal(placeholder, completeme, "Field-modal-positioned", initialText);
151 var cc = cm.cursorCoords();
152 var h = $(m).height();
153 if (cc.bottom > $(".CodeMirror").height() / 2)
154 $(m).css("top", Math.max(100, cc.bottom - h));
155 else {
156 $(m).css("top", cc.bottom)
157 }
158
159 var p = $(m).position();
160 if (p.top + h > $(".CodeMirror").height() - 40) {
161 h = $(".CodeMirror").height() - p.top - 100;
162 $($(m).children()[1]).height(h)
163 }
164 $(m).css("left", Math.min($(".CodeMirror").width() - 500, cc.right));
165}
166
167//runModalAtCursor("banana", completme)

Callers 2

AutocompleteFunction · 0.85
ImportFunction · 0.85

Calls 7

runModalFunction · 0.85
childrenMethod · 0.80
widthMethod · 0.80
$Function · 0.70
positionMethod · 0.65
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected