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

[Solved] RadEditor Generate <br> tag

7 Answers 394 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Shubod Dev
Top achievements
Rank 1
Shubod Dev asked on 21 Aug 2009, 10:18 AM
Hi

This is Karthik from Bangaore.. I have problem in radeditor.. i put some html code in html mode after that i came to design mode then i came back to html mode at the time the editor automaticaly generate <br> tag.. i dont know why its coming... please help me soon..

This problem have I6 and firefox..

Exampl Code:

<

table
    <tr
        <td><div></div></td
        <td><div>hi</div></td
    </tr>
</table>
I am getting problem inside the blank div tag.. and incase td also getting same problme if there is no content between td tag...

Error code:

 

 

<table >

 

 

    <tr>

 

 

 

 

       <td><div></div><br></td>

 

 

 

 

       <td><div>hi</div></td>

 

 

 

 

   </tr>

 

 

 

 

</table>

or

<

table
    <tr
        <td><br></td
        <td><div>hi</div></td
    </tr>
</table>


Thank you for advance
PL.Karthik

 

 

 

7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 25 Aug 2009, 02:45 PM
Hi PL.Karthik,

I tried to reproduce the reported problem but unfortunately to no avail. Could you please see the attached video and let me know if I am missing something?

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Shubod Dev
Top achievements
Rank 1
answered on 28 Aug 2009, 01:55 PM
hi Rumen

Thank you for replay.. but i have  still problem in firefox  version 3.0.13
pls check it that same exampl code and let me know.. i could not attach the file please  check  all the version in firefox
0
Rumen
Telerik team
answered on 02 Sep 2009, 03:02 PM
Hi,

I was unable to reproduce the problem even in Firefox 3.0.13 using the demo example of RadEditor. Please, see the attached video for more information.

Is it possible to open a support ticket and send a sample working project along with steps on how to replicate the problem on our side?

Sincerely,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
kiran
Top achievements
Rank 1
answered on 31 Oct 2009, 10:59 AM
Hi telerik team,

this problem exits still when i have a html code in hidden variable..
and assign the value to editor using this hidden.

ex:--

function Page_load(sender, e)
            {
                document.getElementById("hidContent").value=parent.fraBody.document.getElementById("hidEditorContent").value
                sender.set_html(parent.fraBody.document.getElementById("hidEditorContent").value);
                //ajaxRequest("SetContent");
            }


<telerik:RadEditor ID="RadEditor1" OnClientPasteHtml="OnClientPasteHtml"  ImageManager-EnableImageEditor="false" runat="server" EnableEmbeddedSkins="true" Width="97%" ToolsFile="../UserControls/EditorTools.xml" OnClientLoad="Page_load" AllowScripts="true" ContentFilters="none">
                            <content></content>
                        </telerik:RadEditor>


thanks
K²


<telerik:RadEditor ID="RadEditor1" OnClientPasteHtml="OnClientPasteHtml"  ImageManager-EnableImageEditor="false" runat="server" EnableEmbeddedSkins="true" Width="97%" ToolsFile="../UserControls/EditorTools.xml" OnClientLoad="Page_load" AllowScripts="true" ContentFilters="none">
                            <content></content>
                        </telerik:RadEditor>

0
Rumen
Telerik team
answered on 04 Nov 2009, 02:14 PM
Hi Kiran,

I tried to reproduce the problem using the provided code in Firefox with the latest Q3 2009 but without success. For your convenience I've attached my project and video demonstrating my test. Am I missing something?

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
kiran
Top achievements
Rank 1
answered on 05 Nov 2009, 05:12 AM
Hi Rumen,
Thanks for the replay....

actually the problem is in blank <td></td>

example apply the code to the project u sent me.

hiddenField.value= "<table><tr><td><b>some content</b></td><td></td></table>";

and check the html view in editor u get the same problem in firefox.

<table><tbody><tr><td><b>some content</b></td><td><br></td></tr></tbody></table>

Thanks
K²

0
Rumen
Telerik team
answered on 10 Nov 2009, 10:44 AM
Hi,

The issue is a browser behavior and it is fixed in the ConvertToXhtml filter code and it does not exist when the filter is enabled. When it is disabled then Firefox adds the <br> tags to the empty cells. You can use the custom content filter below to set &nbsp; in the cells that contains only a single <br> tag:

<script type="text/javascript">
function Page_load(sender, e)
    {
        var hiddenField = document.getElementById("hidContent");
        hiddenField.value= "<table><tr><td><b>some content</b></td><td></td></table>";
        sender.set_html(hiddenField.value);
        sender.get_filtersManager().add(new MyFilter()); 
    }
     
 
 
    MyFilter = function() 
    
       MyFilter.initializeBase(this); 
       this.set_isDom(true); 
       this.set_enabled(true); 
       this.set_name("RadEditor filter"); 
       this.set_description("RadEditor filter description"); 
    
    MyFilter.prototype = 
    
       getHtmlContent : function(content) 
       
                
               var cells = content.getElementsByTagName("TD");
                 
               for (var i = 0; i < cells.length; i++)
               {
                   var cell = cells[i];
                     
                   if (cell.innerHTML == "<br>")  
                   {
                        cell.innerHTML = " ";
                   }
               }
             
           return content; 
       
    
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter); 
    </script>
 
    <telerik:RadEditor ID="RadEditor1" ImageManager-EnableImageEditor="false" runat="server" EnableEmbeddedSkins="true" Width="97%"
         OnClientLoad="Page_load" AllowScripts="true" ContentFilters="none">
                                <content></content>
                            </telerik:RadEditor>
    <input type="hidden" id="hidContent" />



Sincerely yours,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Shubod Dev
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Shubod Dev
Top achievements
Rank 1
kiran
Top achievements
Rank 1
Share this question
or