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

When a new table is created cells default with a &nbsp

3 Answers 113 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Scozzard
Top achievements
Rank 2
Scozzard asked on 06 Jul 2010, 03:26 AM
I'm not sure exactly why but whenever a new table is created in the editor, every cell comes with a "nbsp" inside it by default. Is there a way to easily stop this?

Regards,
Scott

hrm just saw my &nbsp didnt render in the title, imagine that! Can't update though sorry =)

3 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 06 Jul 2010, 08:31 AM
Hi Scott,

When a table is inserted in RadEditor and the content is saved, IE will not display the empty rows/columns that do not contain any data (even  ).

For this reason and to workaround this browser problem, we programmatically put an empty space (  entity) inside each table cell.

Here is an example demonstrating to strip the blanks from the inserted table elements via the TableWizard and Insert Table dropdown:

<script type="text/javascript"> 
    function OnClientPasteHtml(sender, args) 
    { 
        var commandName = args.get_commandName(); 
        var value = args.get_value(); 
        //alert(commandName); 
        if(commandName == "InsertTable" || commandName == "TableWizard") 
        { 
            alert("Original content" + value); 
            var newContent = value.replace(/&nbsp;/gi, ""); 
            alert("Modified content: " + newContent); 
        } 
        args.set_value(newContent);                                     
    } 
    </script> 
    <telerik:RadEditor runat="server" 
        OnClientPasteHtml="OnClientPasteHtml" 
        ID="RadEditor1" runat="server">  
    </telerik:RadEditor>   


You can find more information about the OnClientPasteHtml event here.


Kind regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Scozzard
Top achievements
Rank 2
answered on 09 Jul 2010, 01:52 AM
Hi,

Thanks for the timely reply - I tried out this hack and it seems to work pretty good. Do you know of any potental unforseen negative consequences of doing this however?

Regards,
Scott
0
Rumen
Telerik team
answered on 09 Jul 2010, 08:04 AM
Hi Scott,

The only negative consequence of &nbsp; stripping will be that IE will not rendering borders on empty table cells. See this page for more information: IE not rendering borders on empty table cells.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
Scozzard
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Scozzard
Top achievements
Rank 2
Share this question
or