-
Notifications
You must be signed in to change notification settings - Fork 20
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
Cursor position not updated #17
Comments
To get the cursor just call the |
I did try that too, yet the cursor position is not updated. const getCursor = (e) => {
console.debug(mirror.value.cursor)
} vue-codemirror.webm |
The cause was that the change of |
Hi @logue, if there are any updates for that issue? I see that you added fix, but for me behavior is still the same as @mimnot described. We are using v1.1.19 |
I don't have much time for development resources, but I made it work only to get the cursor position. |
Hi,
I'm trying to get the cursor position (using either the
getCursor
method or thecursor
property)but it always returns the same value.
I slightly modified one of the provided example to demonstrate this behavior.
Clicking on the
getCursor
button for the first time will output the correct cursor position.But after that, it will always output the same position, whatever the cursor position is.
<!-- eslint-disable import/no-duplicates --> <script setup> import CodeMirror from 'vue-codemirror6'; import { vue } from '@codemirror/lang-vue'; import {ref} from 'vue' const content = ref('hello world') const mirror = ref(null); const getCursor = (e) => { console.debug(mirror.value.getCursor()) } const updateContent = (e) => { console.debug(e.doc.length) } </script> <template> <div class="container"> <section class="mb-5"> <p> <button type="button" @click="getCursor">getCursor</button> </p> <code-mirror ref="mirror" v-model="content" @change="updateContent" :lang="vue()" basic wrap /> </section> </div> </template> <style> .vue-codemirror * { font-family: var(--bs-font-monospace); } </style>
Here the expected result
The text was updated successfully, but these errors were encountered: