Skip to content

Issue when using tab key on readOnly code editor #49

@cyrilf

Description

@cyrilf

When using the tab key on a readOnly editor, this error occurs:

Uncaught TypeError: this.content is undefined
    tab CodeEditor.vue:283

To solve it, we need to change these lines:
https://github.com/justcaliturner/simple-code-editor/blob/master/npm-package/CodeEditor.vue#L282-L283

+ if (this.content) {
    this.content =
       this.content.substring(0, cursorPosition) + this.tabWidth + this.content.substring(cursorPosition); 
+ }

or another option, do a:
if (this.readOnly) return
as the first line of the tab method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions