How to get cursor position from q-editor?



  • I am able to get the cursor position with this, but it only detects the first line. It bugs out when a user goes to a new line. This is my current code:

        setCursorPosition() {
          const range = window.getSelection();
          if (range !== null || range !== undefined) { 
            this.editorCursorPosition = range.focusOffset;
          } else {
            this.editorCursorPosition = 0
          }
        },
    

Log in to reply