Skip to content

Commit

Permalink
Improve positioning of context menu hack
Browse files Browse the repository at this point in the history
It sometimes went wrong due to the textarea wrapper being moved
when the cursor was placed under the mouse.
  • Loading branch information
marijnh committed Dec 21, 2018
1 parent adb4ad3 commit a21ea6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/input/TextareaInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ export default class TextareaInput {
operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll)

let oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText
input.wrapper.style.cssText = "position: absolute"
let wrapperBox = input.wrapper.getBoundingClientRect()
let wrapperBox = input.wrapper.offsetParent.getBoundingClientRect()
input.wrapper.style.cssText = "position: static"
te.style.cssText = `position: absolute; width: 30px; height: 30px;
top: ${e.clientY - wrapperBox.top - 5}px; left: ${e.clientX - wrapperBox.left - 5}px;
z-index: 1000; background: ${ie ? "rgba(255, 255, 255, .05)" : "transparent"};
Expand Down

0 comments on commit a21ea6f

Please sign in to comment.