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

Function setPosition

static/wangEditor/js/wangEditor.js:8178–8203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8176
8177 // 定位
8178 function setPosition() {
8179 if (!$currentLink) {
8180 return;
8181 }
8182
8183 var position = $currentLink.position();
8184 var left = position.left;
8185 var top = position.top;
8186 var height = $currentLink.height();
8187
8188 // 初步计算top值
8189 var topResult = top + height + 5;
8190
8191 // 判断 toolbar 是否超过了编辑器区域的下边界
8192 var menuHeight = editor.menuContainer.height();
8193 var txtHeight = editor.txt.$txt.outerHeight();
8194 if (topResult > menuHeight + txtHeight) {
8195 topResult = menuHeight + txtHeight + 5;
8196 }
8197
8198 // 最终设置
8199 $toolbar.css({
8200 top: topResult,
8201 left: left
8202 });
8203 }
8204
8205 // 显示 toolbar
8206 function show() {

Callers 1

showFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected