mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 17:29:08 +00:00
Prevent dragdrop and context menu in SVG viewer
This commit is contained in:
@@ -153,6 +153,19 @@ class SvgViewer {
|
|||||||
* Bind mouse and wheel events for zoom and pan.
|
* Bind mouse and wheel events for zoom and pan.
|
||||||
*/
|
*/
|
||||||
bindEvents() {
|
bindEvents() {
|
||||||
|
// Prevent file drag-and-drop on the window to disable dropping files into the viewer
|
||||||
|
window.addEventListener('dragover', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
window.addEventListener('drop', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Prevent the context menu (right-click menu) from appearing anywhere in the viewer
|
||||||
|
window.addEventListener('contextmenu', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
// Zoom with mouse wheel
|
// Zoom with mouse wheel
|
||||||
this.wrapper.addEventListener("wheel", (e) => {
|
this.wrapper.addEventListener("wheel", (e) => {
|
||||||
this.enableTransition();
|
this.enableTransition();
|
||||||
|
Reference in New Issue
Block a user