I have a single page application created using EmberJS.
I have 3 text fields per page.
I pass ckeditor after textarea has been inserted into dom, and I mark the property on the controller entry that ckeditor has been processed, so I do not do it more than once.
I even look in dom to make sure there is no editor.
When I refresh the page, I get this error at random:
Uncaught TypeError: Cannot call method 'unselectable' of null
I do not know what causes it or now to prevent it. When this does not cause this error, all 3 ckeditors look just fine.
Here is my intiation code for the editor:
Lrt.PrioritizationEditableTextArea = Ember.TextArea.extend({ areaVisible: false, isRendered: false, isInserted: false, didInsertElement:function(){ this.set('isInserted', true); }, renderEditor:function(){ var self = this; var selfID = self.get('elementId'); if( !this.get('isRendered') && this.get('isInserted') && $('#'+selfID).parent().find('cke').length === 0 ){ var editor = $('#'+selfID).ckeditor({ toolbar:[ { name: 'document', items:['Source'] }, { name: 'clipboard', items:['Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']}, { name: 'editing', items:['scayt']}, { name: 'basicstyles', items:['Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', '-', 'RemoveFormat']}, { name: 'styles', items:['FontSize']}, { name: 'paragraph', items:['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-']} ] }).editor; editor.on('change', function(e){ if(e.editor.checkDirty()){ self.set('value', editor.getData()); } }); this.set('isRendered', true); } }.observes('areaVisible') });
I also use the onChange plugin for ckeditor to disable the onChange event when something changes in the editor and I respond to it.
What I tried:
- uninstall onChange plugin
- change ckeditor to beta version 4.3
- delete toolbar settings
- delete onChange event listener
- make sure all text areas have content in them when rendering
What do I need to do to fix this?
EDIT
Here's the stack trace: (I snap to the ver line in my application)
a (ckeditor.js?ver=2.0.0:291) (anonymous function) (ckeditor.js?ver=2.0.0:287) i (ckeditor.js?ver=2.0.0:10) CKEDITOR.event.CKEDITOR.event.fire (ckeditor.js?ver=2.0.0:12) CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js?ver=2.0.0:13) CKEDITOR.event.CKEDITOR.event.fireOnce (ckeditor.js?ver=2.0.0:12) CKEDITOR.editor.CKEDITOR.editor.fireOnce (ckeditor.js?ver=2.0.0:13) (anonymous function) (ckeditor.js?ver=2.0.0:223) m (ckeditor.js?ver=2.0.0:203) CKEDITOR.scriptLoader.load (ckeditor.js?ver=2.0.0:203) (anonymous function) (ckeditor.js?ver=2.0.0:222) (anonymous function) (ckeditor.js?ver=2.0.0:210) (anonymous function) (ckeditor.js?ver=2.0.0:208) m (ckeditor.js?ver=2.0.0:203) CKEDITOR.scriptLoader.load (ckeditor.js?ver=2.0.0:203) CKEDITOR.resourceManager.load (ckeditor.js?ver=2.0.0:207) h (ckeditor.js?ver=2.0.0:209) (anonymous function) (ckeditor.js?ver=2.0.0:210) m (ckeditor.js?ver=2.0.0:220) (anonymous function) (ckeditor.js?ver=2.0.0:220) (anonymous function) (ckeditor.js?ver=2.0.0:397) (anonymous function) (ckeditor.js?ver=2.0.0:208) m (ckeditor.js?ver=2.0.0:203) q (ckeditor.js?ver=2.0.0:203) r (ckeditor.js?ver=2.0.0:203) (anonymous function) (ckeditor.js?ver=2.0.0:204)
EDIT # 2:
Here is the script for the specific application area in which the problem occurs: http://jsfiddle.net/sSaCd/3/