This is a migrated thread and some comments may be shown as answers.

[Solved] Indentation for the code is lost in MVC Telerik Editor.

1 Answer 34 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ramakrishna
Top achievements
Rank 1
Ramakrishna asked on 02 Jan 2012, 11:51 AM
I am using prettifier for the code. So, the code would be enclosed within pre tags, class prettyprint. Any code within this block for editing after Ajax post would loose indentation. Please read the following for detailed description.

The Telerik Editor is loaded as a partial view on Ajax Post request. The text containing code within pre tags, prettyprint class, in a div element on some part of the form is extracted and passed as a string to the action method for rendering Telerik Editor partial view. The Telerik Editor loads that string from javascript on client side using telerik.editor.min.js file. This file removes the indentation. The root cause for this issue is found to be β€œ.replace(/[\r\n\v\f\t ]+/ig," ")” at the code block β€œvar a5=a3.val().replace(/(<\/?img[^>]*>)[\r\n\v\f\t ]+/ig,"$1").replace(/[\r\n\v\f\t ]+/ig," ");”.

Hence, the following code change resolved the problem.

1)      telerik.editor.min.js: Resolved indentation issue

From:- var a5=a3.val().replace(/(<\/?img[^>]*>)[\r\n\v\f\t ]+/ig,"$1").replace(/[\r\n\v\f\t ]+/ig," ");

To:- var a5=a3.val().replace(/(<\/?img[^>]*>)[\r\n\v\f\t ]+/ig,"$1"); 

Please let me know for any other best alternatives.

Thank You.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 02 Jan 2012, 12:58 PM
Hello,

 We are not sure how to reproduce this behavior at our side. Could you provide a sample project which shows how the identation is removed?

Regards,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Editor
Asked by
Ramakrishna
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or