javascript - Handling Multiple Ckeditor instance on single page -
i have generated multiple ckeditor instances based on ajax data , destroy instance on demand below
(var in ckeditor.instances) try{ ckeditor.instances[i].destroy(); }catch(e){ ckeditor.instances[i] = null; } }
i have generated editor using loop given value.look @ plunker
basically need show editor once page loaded based on ajax data. when data huge, creating multiple instance consume browser memory.
initiating editor on demand not requirement.how show editor considering browser memory once page loaded? please advice
if you, use lightweight inline editor instances. create them on demand save time , improve performance (plunker):
// http://docs.ckeditor.com/#!/api/ckeditor-cfg-disableautoinline ckeditor.disableautoinline = true; function generateeditor( ) { return ckeditor.dom.element.createfromhtml( '<div contenteditable="true" id="editor' + + '"></div>' ); } $(function() { var holder = ckeditor.document.getbyid( 'holder' ), el; ( var editor = 100; editor--; ) { el = generateeditor( editor ); holder.append( el ); el.once( 'click', function() { ckeditor.inline( ); } ); } console.log( ckeditor.instances ); });
also:
- make sure use smallest subset of plugins possible improve performance. basic package starting point take on builder.
Comments
Post a Comment