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

Template Manager - unwanted br tag

1 Answer 58 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 01 Dec 2008, 02:23 PM
Hello!

The editor is behaving in an unwanted way with Firefox 2 & 3. A br tag gets inserted right after the template content, selected through the Template Manager button. You can check it out on one of your demo pages: enter HTML mode, erase the html code that's in there, switch to design mode, click the Template Manager button, open the marketing folder and insert 2007-07.html. Back in HTML mode you'll see that there's a br tag right at the end of it.
As some of our clients aren't that html savvy, we would like them to be able to use the editor with as little interaction with the actual html as possible. In other words, no switching from design mode to html mode just to remove something that shouldn't be there to begin with.

Another thing that bothers me with the wysiwyg interface is the indentation button. This button generates a blockquote tag, which has nothing to do with indentation. in fact, it should be used to mark up quotations. HTML tags should not be used for how they look, but for what they actually represent. CSS is the way to go here (margin-left).

And finally. I made a post on the forum back in April about some IE 7  issues, which you can find here: http://www.telerik.com/community/forums/aspnet/editor/annoying-ie-problems-latest-version-of-radeditor.aspx
After upgrading to the latest version of the editor, these problems still remain...
Have any attempts been made to sort these problems out?

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 04 Dec 2008, 03:29 PM
Hi Anders,

The reported <br> issue is a Firefox browser behavior. You can fix it by programmatically stripping the br tag when the user inserts the template content through the Template manager. Here is a code example:

<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
    var commandName = args.get_commandName();
    var value = args.get_value();

    if (commandName == "TemplateManager")
    {
        if(sender.get_html() == "<br>")
        {
            sender.set_html('');
        }
    args.set_value(value);
    }
}
</script>

<telerik:RadEditor runat="server" OnClientPasteHtml="OnClientPasteHtml" TemplateManager-ViewPaths="~/"
    ID="RadEditor1">
</telerik:RadEditor>

The insertion of blockquote tags when hitting the indent button is a browser behavior. However, I logged your useful request in our ToDo list and we will try to implement this functionality with inline style and margin css property.

As to the problems reported in the forum thread:

You can override the editor's built-in FormatBlock dropdown with the following code:

<telerik:radeditor runat="server" ID="RadEditor1"></telerik:radeditor>   
<script type="text/javascript">
Telerik.Web.UI.Editor.CommandList["FormatBlock"] = function(commandName, editor, args)
{     
    var oValue = args.get_value();
    // Call the FormatBlock command of the browser directly!     
    // alert ("Format block command was replaced with a custom version");     
    editor.get_document().execCommand("FormatBlock", null, oValue);  //this code uses the underlying IE FormatBlock tool
};
</script>


As to scenario 3, it will be fixed in Q3 SP2 of RadControls for ASP.NET AJAX.

Best regards,
Rumen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Anders
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or