Eswar
Eswar

Reputation: 293

Not support large file content using tinyMCE editor

I read the file (File Size is more than 2.5Mb) and display the content into textarea using tinyMCE.

Script Error occur during loading time into textarea. The error is

A script on this page may be busy, or it may have stopped responding. 
You can stop the script now, open the script in the debugger, or let the script continue.

Script: http://localhost:8080/tiny-rich-editor/faces/tinyEditor-orginal/tinymce/jscripts/tiny_mce/tiny_mce.js:1

This error after i use the following code in tinyMCE

ed.onBeforeSetContent.add(function(ed, o) {
                // Replaces all \n characters with <br> tag
                o.content = o.content.replace(/\n/g, '<br>');
            });

The above code for show the content as line by line. If not use the above code, then textarea show all the content as not original format. like line by line.

Help me. Thanks in advance.

Upvotes: 1

Views: 2716

Answers (4)

jackrobert
jackrobert

Reputation: 131

@EswaraMoorthyNEC Hi, Why you use tinyMCE...you can load the file content intonormal text area

Upvotes: 1

Daniel Baktiar
Daniel Baktiar

Reputation: 1712

It can't be called "script error", because there were no errors there. Instead the browser wasn't sure whether the long waiting time was intentional -- which IS this case. If you wait some more time probably the tinyMCE will still display the result.

ThiefMaster's right: don't try to load huge file into Javascript WYSIWYG editor. The Javascript is always run in interpreted mode, and once the whole text is loaded, the parsing and formatting begin. It's just too costly to process 2.5MB text using Javascript running on your browser.

Upvotes: 1

Thariama
Thariama

Reputation: 50832

The problem is that everything you add into your tinymce editor instance needs to be verified by the browser. Inserting i.e. more than 200-300 Paragraphs into your editor will result in highly increased computation time (consumed by the broweser). 2,5 MB filesize does not sound that much, but keep in mind that this is much text.

You might want to think about spliting your huge file into many smaller chunks in order to make them editable using a textarea or a tinymce editor.

Upvotes: 1

ThiefMaster
ThiefMaster

Reputation: 318588

Simple answer: Don't load huge files into a JavaScript-based WYSIWYG editor (or even into a plain textarea). It takes very long and thus the user is asked if he wants to interrupt the script.

Upvotes: 1

Related Questions