How to Disable the Add Text Function in Excalidraw on Double Tap?

I’ve already posted this question on the GitHub discussion page for Excalidraw, but I haven’t received any responses yet, so I’m hoping someone here on StackOverflow can help.

By default, Excalidraw allows users to add text by double-clicking or double-tapping. I want to disable this behavior.

I added the following JavaScript code to disable double-click and double-tap, and here’s what the script looks like:


$(document).ready(function() {
    var checkExist = setInterval(function() {
        var lastTap = 0;
        
        if ($(".excalidraw__canvas").length) {
            // Disable double-click on desktop
            $(".excalidraw__canvas").dblclick(function(e) {
                console.log("Double-click detected on excalidraw__canvas");
                e.stopPropagation();
                
            });

            // Disable double-tap on mobile
            $(".excalidraw__canvas").on("touchstart", function(e) {
                var currentTime = new Date().getTime();
                var tapLength = currentTime - lastTap;

                if (tapLength < 300 && tapLength > 0) {
                    console.log("Double-tap detected on excalidraw__canvas");
                    e.stopPropagation();
                    return false;
                }

                lastTap = currentTime;
            });

            
            clearInterval(checkExist);
        }
    }, 100); 
});

Although the double-click functionality is successfully disabled, the double-tap still triggers the add text function when in mobile view.

My backend is in PHP, and I’m using the index.php file as a guide, which you can find in this GitHub discussion link.

how can I override or disbale the add text by using double tap?