Loading src/mention/mention-list.component.ts +4 −10 Original line number Diff line number Diff line Loading @@ -43,16 +43,10 @@ export class MentionListComponent { position(nativeParentElement: HTMLInputElement, iframe: HTMLIFrameElement = null) { let coords = { top: 0, left: 0 }; if (isInputOrTextAreaElement(nativeParentElement)) { let doc = document.documentElement; let scrollLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); let scrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); // bounding rectangles are relative to view, offsets are relative to container? let carret = getCaretCoordinates(nativeParentElement, nativeParentElement.selectionStart); let parentRelativeToContainer: ClientRect = nativeParentElement.getBoundingClientRect(); coords.top = carret.top + parentRelativeToContainer.top + scrollTop + 16; coords.left = carret.left + parentRelativeToContainer.left + scrollLeft; // parent elements need to have postition:relative for this to work correctly? coords = getCaretCoordinates(nativeParentElement, nativeParentElement.selectionStart); coords.top = nativeParentElement.offsetTop + coords.top + 16; coords.left = nativeParentElement.offsetLeft + coords.left; } else if (iframe) { let context: { iframe: HTMLIFrameElement, parent: Element } = { iframe: iframe, parent: iframe.offsetParent }; Loading Loading
src/mention/mention-list.component.ts +4 −10 Original line number Diff line number Diff line Loading @@ -43,16 +43,10 @@ export class MentionListComponent { position(nativeParentElement: HTMLInputElement, iframe: HTMLIFrameElement = null) { let coords = { top: 0, left: 0 }; if (isInputOrTextAreaElement(nativeParentElement)) { let doc = document.documentElement; let scrollLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); let scrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); // bounding rectangles are relative to view, offsets are relative to container? let carret = getCaretCoordinates(nativeParentElement, nativeParentElement.selectionStart); let parentRelativeToContainer: ClientRect = nativeParentElement.getBoundingClientRect(); coords.top = carret.top + parentRelativeToContainer.top + scrollTop + 16; coords.left = carret.left + parentRelativeToContainer.left + scrollLeft; // parent elements need to have postition:relative for this to work correctly? coords = getCaretCoordinates(nativeParentElement, nativeParentElement.selectionStart); coords.top = nativeParentElement.offsetTop + coords.top + 16; coords.left = nativeParentElement.offsetLeft + coords.left; } else if (iframe) { let context: { iframe: HTMLIFrameElement, parent: Element } = { iframe: iframe, parent: iframe.offsetParent }; Loading