Open HTGAzureX1212 opened 3 years ago
This sounds like the editor is initialized without being part of the document yet, or while its parent element is hidden. That will cause it to fail to measure its text geometry correctly. You either have to arrange for refresh()
to be called when the editor becomes visible, or enable the autorefresh
addon.
"autorefresh"...?
How do I enable it
Hmm that doesn't seem to fix it
Let me try manually calling refresh()
Wait, I already refreshed it
So now the situation is refreshing doesn't work
Then I'm out of ideas, except to ensure that the editor really is visible, and has its final geometry (i.e. no further CSS or font loading changes it afterwards) when the refresh
call is made.
But umm... the editor is in a tab in which when the component is loaded, it is not visible yet. Only when the user switch to the tab with the editor, the editor then comes visible.
Well, there's your problem.
How should I correct it?
I have this:
In which the GuildConfigurationSubComponent
is the component holding the editor. It is only visible when the activeTab
is 2
, which, by default, when the tabs are loaded, is 1
.
I don't know Vue, so I can't help you there.
Ahhh
I am using CodeMirror version
5.58.3
, alongside with Vue3.0.4
. Before upgrading to Vue 3, nothing wrong happened when I set the document content of codemirror. But after upgrading to Vue 3, this happened:As you can see in the picture, the cursor is in the absolutely wrong position.
However, this issue does not exist when the content I am setting the document to is empty:
I am using Google Chrome.