Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not focus on a contenteditable div on the desk #7

Open
srsng opened this issue Sep 16, 2023 · 0 comments
Open

Can not focus on a contenteditable div on the desk #7

srsng opened this issue Sep 16, 2023 · 0 comments

Comments

@srsng
Copy link

srsng commented Sep 16, 2023

I want to make a desktop memo and I create a content editable div (Dragable as well).
If I try to edit it, that works. However, if I try to use hotkeys or Enter, it goes badly.
And Enter will return "Ret" and may launch apps on the desk.

Here is my code.
`

<style> #mytextbox { width: 200px; height: 100px; background-color: #f2f2f2; border: 1px solid #ccc; padding: 10px; position: absolute; left: 0; top: 0; cursor: move; } </style>
Drag me around and edit me!
<script type="text/javascript"> var mytextbox = document.getElementById("mytextbox"); var isDragging = false; var dragStartX, dragStartY; mytextbox.addEventListener("mousedown", function(event) { isDragging = true; dragStartX = event.clientX - mytextbox.offsetLeft; dragStartY = event.clientY - mytextbox.offsetTop; mytextbox.style.cursor = "move"; }); document.addEventListener("mousemove", function(event) { if (isDragging) { mytextbox.style.left = (event.clientX - dragStartX) + "px"; mytextbox.style.top = (event.clientY - dragStartY) + "px"; } }); document.addEventListener("mouseup", function(event) { isDragging = false; mytextbox.style.cursor = "default"; }); </script>

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant