1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 20:24:01 +02:00

[onCutOrCopy] Creating the phony copy div at the same level as the real div (#1350)

* Creating the phony copy div at the same level as the real div

* Added COMPAT desc for the Firefox scroll jump fix

* Update after.js

* Update after.js
This commit is contained in:
Ashutosh Rishi Ranjan
2017-10-31 10:12:17 +11:00
committed by Ian Storm Taylor
parent f973cfc8a6
commit f045b597ea

View File

@@ -233,6 +233,15 @@ function AfterPlugin() {
div.setAttribute('contenteditable', true)
div.style.position = 'absolute'
div.style.left = '-9999px'
// COMPAT: In Firefox, the viewport jumps to find the phony div, so it
// should be created at the current scroll offset with `style.top`.
// The box model attributes which can interact with 'top' are also reset.
div.style.border = '0px'
div.style.padding = '0px'
div.style.margin = '0px'
div.style.top = `${window.pageYOffset || window.document.documentElement.scrollTop}px`
div.appendChild(contents)
body.appendChild(div)