Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🐛 Fixed Code Injection inputs not being clickable
Browse files Browse the repository at this point in the history
no issue
- attempt to fix the "Cannot set property 'modeOption' of undefined" error by telling CM to replace the textarea element rather than appending to the wrapper and having Ember replace the textarea
  • Loading branch information
kevinansfield committed Feb 22, 2019
1 parent f8b03f5 commit 5727dc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions app/components/gh-cm-editor.js
Expand Up @@ -12,7 +12,6 @@ const CmEditorComponent = Component.extend({
classNameBindings: ['isFocused:focus'],

isFocused: false,
isInitializingCodemirror: true,

// options for the editor
autofocus: false,
Expand Down Expand Up @@ -76,8 +75,7 @@ const CmEditorComponent = Component.extend({
options.autofocus = true;
}

this.set('isInitializingCodemirror', false);
this._editor = new CodeMirror(this.element, options);
this._editor = new CodeMirror.fromTextArea(textarea, options);

// by default CodeMirror will place the cursor at the beginning of the
// content, it makes more sense for the cursor to be at the end
Expand Down
10 changes: 4 additions & 6 deletions app/templates/components/gh-cm-editor.hbs
@@ -1,7 +1,5 @@
{{!-- display a standard textarea whilst waiting for CodeMirror to load/initialize --}}
{{#if isInitializingCodemirror}}
{{gh-textarea
class="gh-cm-editor-textarea"
value=(readonly _value)
input=(action "updateFromTextarea" value="target.value")}}
{{/if}}
{{gh-textarea
class="gh-cm-editor-textarea"
value=(readonly _value)
input=(action "updateFromTextarea" value="target.value")}}

0 comments on commit 5727dc8

Please sign in to comment.