Prevent scrolling for textarea preview (#8472)

prevent scrolling for preview

Prevent that when clicking on preview for a textarea, the page scrolls
to the top and the url changed.
This commit is contained in:
Markus Winter authored and GitHub committed 2023-09-10 13:01:04 +02:00
1 parent 3059161906
commit 6b00394d85
1 file changed
+4 -2
@@ -45,7 +45,8 @@ Behaviour.specify(
hidePreview.style.display = "none";
previewDiv.style.display = "none";
showPreview.onclick = function () {
showPreview.onclick = function (event) {
event.preventDefault();
// Several TEXTAREAs may exist if CodeMirror is enabled. The first one has reference to the CodeMirror object.
var textarea = e.parentNode.getElementsByTagName("TEXTAREA")[0];
var text = "";
@@ -85,7 +86,8 @@ Behaviour.specify(
});
};
hidePreview.onclick = function () {
hidePreview.onclick = function (event) {
event.preventDefault();
hidePreview.style.display = "none";
previewDiv.style.display = "none";
};