Comments (5)
@skybrian, is this something you could create a PR for?
from codemirror.dart.
Maybe, but I'm not sure about the consequences. I think a one line change at [1] to remove "sync: true" would fix this issue. However, I don't know if that would affect performance or timing in a bad way for other users of the CodeMirror package. Also, it looks like you added that line as part of a large change to upgrade to CodeMirror 5.0. Do you remember why you added it?
(It's not a big priority for me as I've already worked around it, but I thought I'd report it.)
[1] https://github.com/google/codemirror.dart/blob/master/lib/src/js_utils.dart#L70
from codemirror.dart.
Unfortunately I don't remember what motivated that change. I have in the past needed to make async user events sync in order to make sure I'm the one who handles the event (and can then cancel it), or because the browser only allows some actions when responding to a user event. Not sure if either was the case here.
from codemirror.dart.
A more conservative solution might be to set a flag when entering codemirror, and create a microtask in the callback if the flag is set. If the flag isn't set then the event was triggered from outside Dart and microtask is needed.
But since I've already worked around it, I think the easiest thing for now is just to leave the bug open.
from codemirror.dart.
More subtlety to think about: If some CodeMirror events are delivered via a microtask and others are not, they would get delivered out of order.
Also, in a regular HTML event handler, events are delivered synchronously, allowing you to call event.preventDefault(). I don't know if it's possible to handle an HTML event that is also delivered to CodeMirror, but if so, a microtask would change the order.
An interesting article about this:
https://plus.google.com/u/0/+MalteUbl/posts/NLyinvqwZHo
from codemirror.dart.
Related Issues (20)
- TextMarker.find always returns a null position
- how to use it in flutter HOT 1
- Using the wrapper with Flutter HOT 10
- dart:async not required now. HOT 1
- Run the example dart file HOT 1
- Migrate to Github Actions for CI
- examples of flutter HOT 4
- Version 0.7.4+5.65.3 appears bad. Re-spin.
- flutter mobile HOT 1
- Pub.dev lists `codemirror.dart` as Flutter SDK HOT 2
- re-enable ddc analysis
- publish 5.8.0 HOT 1
- `Span` overloads `operator==` but not `hashCode` HOT 2
- publish new version
- 'JSObjectImpl' is not a subtype of type 'JsObject' HOT 8
- codemirror is not Dart 2 clean HOT 2
- Eliminate uses of deprecated CONSTANTS HOT 1
- the onGutterClick event stream is incorrect
- publish new version to capture codemirror upgrade 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 codemirror.dart.