Ionic most recent version incompatible with code mirror



After updating to the most recent version of the ionic, my code mirror editor broke and it is no longer focusable.

Uncaught TypeError: Cannot read property 'setData' of undefined codemirror.js:2863
onDragStart codemirror.js:2863
(anonymous function) codemirror.js:2438
triggerEvent ionic.bundle.js:777
dragGesture ionic.bundle.js:1808
detect ionic.bundle.js:1355
bindDomOnTouch ionic.bundle.js:904

is there any way to fix this issue? It works fine on browser but it breaks on the emulator.


Hmm, not sure what to do about codemirror…never used it myself and have only heard about it in passing.

Can you provide a codepen example what causes this error?


I’m not sure if it can be embedded in a codepen.

<ui-codemirror class="pageContentInput" ui-codemirror-opts="editorOptions"></ui-codemirror>

I’m using this library:


I think the problem is caused by <ion-content>. It doesn’t work inside that directive.


Hmm, I got a small demo together, seems to work for me.

What order are you loading the files?


It works fine in the browser but doesn’t work on the emulator.


hah, woops, I’ll try in right now.


Hmm so I go the error too.

TypeError: 'undefined' is not an object (evaluating 'e.dataTransfer.setData')

Not sure what could be causing the issue…

Can you open an issue for this?


That one is related to the editor’s drag and drop feature. dragDrop should be set to false on editor options. It fails without any errors.


Either way, the big issue is that if you wrap a div with data-tap-disable="true" around the codemirror section, it should let you set focus to the editor, which it isn’t.

Based of my codepen, can you provide a more accurate demo to what you have?