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

[Solved] P tag Problem

3 Answers 109 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sean
Top achievements
Rank 1
sean asked on 24 Dec 2008, 06:29 PM
When I enter text and apply H1 formatting, the P tag is often wrapped around the text.  Anyway to avoid this?
<H1>
<P>Text</P>
</h1>

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Dec 2008, 02:33 PM
Hi Sean,

We are aware of this behavior and it is logged in our bug tracking system for fixing.

Currently, you can override the editor's built-in FormatBlock dropdown command with this one of the browser using the following javascript 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>

This should fix the problem.


Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vaughan Reed
Top achievements
Rank 1
answered on 17 Sep 2009, 11:03 PM
Hi Rumen,

Are you aware that this issue is now happening in IE 8?

We have confirmed that this is occuring on your AJAX Editor Demo site.

Can you provide an ETA on when this will be resolved?

Thanks

0
Rumen
Telerik team
answered on 23 Sep 2009, 11:10 AM
Hi Vaughan,

I reported the problem to our lead editor developer and the problem will be fixed for one of the next hotfixes of RadEditor.

The built-in FormatBlock command of the browser works on whole paragraphs but not on selection. We have enhanced this tool to work on selection and new lines. What you can do until we fix the problem is to leave the browser to handle the FormatBlock command by just clicking inside the desired content without selecting it and apply the desired paragraph style option.

Another approach is to override the FormatBlock command with the code provided in my earlier message.

Best wishes,
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
sean
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Vaughan Reed
Top achievements
Rank 1
Share this question
or