simple-code-editor icon indicating copy to clipboard operation
simple-code-editor copied to clipboard

Issue when using tab key on readOnly code editor

Open cyrilf opened this issue 1 year ago • 0 comments

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.

cyrilf avatar Mar 05 '24 17:03 cyrilf