Opened 8 years ago
#16906 new Bug
isArray function in core tools does not recognize ES6 iterator protocol [object Array Iterator] as an array
Reported by: | Michael | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.6.2 |
Keywords: | Cc: |
Description
Steps to reproduce
- Include lodash and/or ReactJS (ES6) on the page with CKEditor
- Refresh the page
- CKEditor does not initialize
Expected result
CKEditor to initialize
Actual result
CKEditor does not initialize. Console window shows resource not found error, as the dynamically generated plugins <script> tag is malformed. Ie: <script type="text/javascript" src="https://mydomain/_js/Performance2/ckeditor-full.4.6.2/plugins/dialogui,dialog,about,a11yhelp,dialogadvtab,basicstyles,bidi,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,copyformatting,div,toolbar,enterkey,entities,popup,filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo,font,forms,format,horizontalrule,htmlwriter,iframe,wysiwygarea,image,indent,indentblock,indentlist,smiley,justify,menubutton,language,link,list,magicline,maximize,newpage,pagebreak,pastetext,pastefromword,preview,print,removeformat,save,selectall,showblocks,showborders,sourcearea,specialchar,stylescombo,tab,table,undo,wsc/plugin.js?t=v0.01"></script>
Other details (browser, OS, CKEditor version, installed plugins)
The reason this occurs is because when using ES6 features (ReactJS/lodash/etc) on your page, the CKEditor core tools isArray function does not know how to check the ES Iteration Protocol, as described here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
This is a simple fix by also comparing to [object Array Iterator] in the isArray function in tools.js