Comments (5)
After some experimentation, I've found that the freeze can be eliminated by explicitly handling dragEnterEvent
in EditorWebView, like this:
def dragEnterEvent(self, evt):
evt.accept()
But this prevents the fields from receiving the dragover event, as a result, the onDragOver
function in editor.ts is never called.
The issue does not seem to be caused by anything in editor.ts. merely handling dragEnterEvent
fixes it, but introduces another problem.
from anki.
Thanks for digging into it, I'll have another play with it when I have a chance
from anki.
It seems that the dragover JavaScript event is triggered in the default dragEnterEvent handler of QWebEngineView.
The following causes the dragover event to be fired as usual but reintroduces the freeze:
def dragEnterEvent(self, evt):
super().dragEnterEvent(evt)
Doing something similar in dropEvent eliminates the freeze:
def dropEvent(self, evt):
super().dropEvent(evt)
But this brings with it the default handling of drop events in addtion to Anki's handling (e.g. dropped images will be opened and copied to fields). Also, calling evt.setDropAction(Qt.IgnoreAction)
doesn't seem to help.
The whole thing can be reproduced outside Anki (as in this example).
I think this is ultimately a QT bug. I guess it would be more reasonable that JavaScript events fire regardless of custom QT event handlers.
from anki.
I've found a workaround:
abdnh@c46aaa0
Please let me know if it's any good.
from anki.
Thanks ANH - I didn't notice any problems, and it seems to work well here. I'm sure this will make a bunch of users happy!
Merged in #738
from anki.
Related Issues (20)
- Anki gives ModuleNotFoundError without pip_system_certs installed
- DeprecationWarning: 'locale.getdefaultlocale' is deprecated
- Integrations of Load balance & Easy days HOT 4
- [bug]cards mixed up. back didn't match front. or the front isn't the correct one. HOT 2
- Clarify what optimal retention means
- Adapt content size to viewport HOT 1
- Keyboard shortcuts for: tools -> empty cards…, image occlusion -> toggle mask editor
- Display the number of reviews when pressing “Evaluate” HOT 6
- Display the number of reviews when pressing “Evaluate” HOT 1
- Future Due stats Issue`
- Anki 24.04 does not close properly HOT 3
- SVG icon styling is broken HOT 1
- Media auto sync: "connection closed before message completed"
- Pressing the spacebar will stutter when editing cards HOT 1
- err 500 "invalid number" on deck import, improve error message, worked on previous versions and with "legacy import" HOT 2
- Cards being repeated in filtered deck after pressing end HOT 1
- Restore ability for add-ons to extend the deck options screen
- Integration of the Helper add-on stats
- PyPI packages for 24.04.1 HOT 1
- Add maximize buttons to Note Types editor HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anki.