-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
When clicking inside the editor, the selected text is offset from the actual cursor position. #581
Comments
@deineryao could you please try to update to the latest version? |
I have tried, but the project is quite old and contains various dependencies. Upgrading it would introduce various issues that render the project unusable. Is there any other alternative solution available? |
try to use loader-config to load a different version of import { loader } from '@monaco-editor/react';
loader.config({ paths: { vs: 'https://cdn.jsdelivr.net/npm/[email protected]/min/vs' } }); // try different versions The issue seems to be related to microsoft/monaco-editor. |
I had the same question in my programme. And I solved this by updating the version of import { loader } from '@monaco-editor/react';
loader.config({
'vs/nls': {
availableLanguages: {
'*': 'zh-cn',
},
},
paths: {
vs: 'https://cdn.jsdelivr.net/npm/[email protected]/min/vs',
},
}); Maybe this would help. |
Thank you , I also encountered this problem. Please tell me , What does this configuration mean? |
It has been a long time since I solved this, so I'm not sure whether my memory was right. It seemed that a certain version (maybe 0.43.0) of This configuration tells monaco to load a certain version (0.45.0) from cdn in runtime. |
This is a page with nested iframes, and the Monaco Editor is embedded within one of the iframes. When clicking at position A inside the editor, the cursor actually moves to position B, and the corresponding text at position B is also highlighted. Based on my deduction, the offset distance is exactly equal to the size of the page occupied by the external elements outside the iframe. When I remove elements outside the iframe, such as elements on the left and top, and then click inside the editor, the focus is normal.
The version of @monaco-editor/react is ^3.8.3.
The text was updated successfully, but these errors were encountered: