UNPKG

locize

Version:

This package adds the incontext editor to your i18next setup.

11 lines (9 loc) 823 B
function HighlightBox(ele, borderColor, shadowColor) { var rect = ele.getBoundingClientRect(); var box = document.createElement('div'); box.classList.add('i18next-editor-highlight'); box.style = "position: absolute; z-index: 99999; pointer-events: none; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: ").concat(borderColor === 'none' ? 'none' : "1px solid ".concat(borderColor), "; border-radius: 15px; ").concat(shadowColor ? "box-shadow: inset 1px 1px 5px rgba(255, 255, 255, 0.1), inset -1px -1px 5px rgba(61, 67, 69, 0.3), 0 0 20px 0 ".concat(shadowColor, ";") : ''); box.setAttribute('data-i18next-editor-element', 'true'); return box; } export { HighlightBox };