-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Inaccurate cursor positioning on Safari #502
Comments
Thanks for reporting. I opened http://jsoneditoronline.org Safari 10.1 and 11, which seems to work fine. Does this website work fine for you too? Can it be that you haven't defined charset on your webpage or something? Like: <head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" src="app.min.js" charset="utf-8"></script>
</head> |
@josdejong I haven't install two fonts (droid sans mono and consolas), so Safari will render a kind of monospace font. On Chrome, Courier is my default monospaced font. But Safari will relate to the language of html. Mine is Chinese. <html lang="zh-CN"> When I remove the lang attribute or set it to 'en' or 'jp', all will be ok. ...so it may because that Safari cannot give me a right monospaced font. |
Looks indeed like Ace editor only works with monospaced fonts: ajaxorg/ace#460. I suppose though that normally there are monospaced fonts installed on Mac and Safari (normally Consolas I think?). At least looks like that's the most logic solution: make sure there is a mono font available. |
Thanks. The ace issue has been existed for a long time, since 2011. font-family: droid sans mono, consolas, monospace, courier new, courier, sans-serif;\ New font-family: droid sans mono, consolas, courier, courier new, monospace, sans-serif;\ |
That makes sense, putting the generic "monospace" last. In that case I will add a few more fonts, something like: font-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif; |
@shootingfly I've just released v5.13.2, which should have reordered font-family, can you check whether this solves your issue? |
@josdejong Yeah! It solves my issue. Thanks. |
👍 |
Hi there! Happens to me as well, on Chrome - version 78.0.3904.108 (Official Build) (64-bit)
And for some reason the json editor is not overriding this font. |
… (`code` mode) not having a mono-space font anymore
Ah, that's interesting! Thanks for sharing Daniel. Ace editor has a lot of nested components and simply defines the font-family in the root element, making use of the cascading feature of CSS. Your We can quite easily fix this by doing: * {
font-family: 'Source Sans Pro', sans-serif;
}
.ace_editor * {
font-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif;
} I've addressed this in #7c3695d (fix not yet published) |
@danielkrich this has been fixed now in |
Will check. Thanks a lot @josdejong, highly appreciated! 👏 |
I can get accurate cursor position on Chrome, Firefox, IE, except safari.

To solve the problem, I have to open
jsoneditor.js
and deletefont-family
.jsoneditor.js#36892
Another way is to add style to page.
Is it a bug?
The text was updated successfully, but these errors were encountered: