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

Function addAndShowTip

static/wangEditor/js/wangEditor.js:2971–3011  ·  view source on GitHub ↗
($target)

Source from the content-addressed store, hash-verified

2969 var isTipInTxt = false;
2970
2971 function addAndShowTip($target) {
2972 if (!isTipInTxt) {
2973 $editorContainer.append($tip);
2974 isTipInTxt = true;
2975 }
2976
2977 var txtTop = $txt.position().top;
2978 var txtHeight = $txt.outerHeight();
2979
2980 var height = $target.height();
2981 var top = $target.position().top;
2982 var marginTop = parseInt($target.css('margin-top'), 10);
2983 var paddingTop = parseInt($target.css('padding-top'), 10);
2984 var marginBottom = parseInt($target.css('margin-bottom'), 10);
2985 var paddingBottom = parseInt($target.css('padding-bottom'), 10);
2986
2987 // 计算初步的结果
2988 var resultHeight = height + paddingTop + marginTop + paddingBottom + marginBottom;
2989 var resultTop = top + menuContainer.height();
2990
2991 // var spaceValue;
2992
2993 // // 判断是否超出下边界
2994 // spaceValue = (resultTop + resultHeight) - (txtTop + txtHeight);
2995 // if (spaceValue > 0) {
2996 // resultHeight = resultHeight - spaceValue;
2997 // }
2998
2999 // // 判断是否超出了下边界
3000 // spaceValue = txtTop > resultTop;
3001 // if (spaceValue) {
3002 // resultHeight = resultHeight - spaceValue;
3003 // top = top + spaceValue;
3004 // }
3005
3006 // 按照最终结果渲染
3007 $tip.css({
3008 height: height + paddingTop + marginTop + paddingBottom + marginBottom,
3009 top: top + menuContainer.height()
3010 });
3011 }
3012 function removeTip() {
3013 if (!isTipInTxt) {
3014 return;

Callers 1

wangEditor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected