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

RTL and LTR in the same editor

13 Answers 292 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Elad Rave
Top achievements
Rank 1
Elad Rave asked on 12 Sep 2010, 12:04 PM
Hello,

I am testing the editor for a project we have, and I need to be able to write a paragraph in RTL, and then another in LTR etc...
When I create an editor, I can either create it as RTL or LTR, but I could not figure out how can I change it per paragraph (just like in a word processor).

Thanks,
ER

13 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 15 Sep 2010, 03:06 PM
Hi Elad,

The Right-To-Left and Left-To-Right direction is provided by standard CSS rule (direction: rtl / ltr). You can achieve the required functionality by adding a custom classes to the ApplyClass tool with this rule and apply the class to the paragraph according the requirement.

You can find detailed explanation on how to add custom classes to the dropdown in the following help article:
CSS Styles

Best wishes,
Dobromir
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
Samuel
Top achievements
Rank 1
answered on 24 Nov 2010, 05:25 PM
HI,
I will need to implement this.
I have a few questions

1) Is it possible to have the RTL and LTR styles included as either Internal CSS styles or Inline Styles? I don't want this to be dependant on an external style sheet
2) can this functionality be accomplished with buttons? I would like to create left and right buttons instead of a dropdown.

See this demo from cute Editor where they implement this with RTL/LTR buttons. Clicking on them inserts an inline style.
http://cutesoft.net/example/general.aspx

Thanks.
0
Rumen
Telerik team
answered on 24 Nov 2010, 05:31 PM
Hello Samuel,

You can see the following forum thread which provides guidance how to implement RTL and LTR buttons:

RTL & LTR Buttons in the radEditor Tools.

All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Samuel
Top achievements
Rank 1
answered on 24 Nov 2010, 05:41 PM
Thank you for your super quick response!
I tried that, but I have a big issue.

This only works when selecting preexisting content. Click the RTL button and starting to type a new paragraph accomplishes nothing.
The Cute Editor demo I linked to above works correctly.

Please advise.
0
Dobromir
Telerik team
answered on 30 Nov 2010, 09:38 AM
Hi Samuel,

For your convenience I have prepared a simple page implementing these two custom commands. Please find it attached.

Greetings,
Dobromir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Samuel
Top achievements
Rank 1
answered on 30 Nov 2010, 02:53 PM
Thanks for the attempt. But it is still not working properly.
Clicking RTL while the cursor is within a existing paragraph does not convert the existing paragraph. It simply makes a new one.
0
Dobromir
Telerik team
answered on 30 Nov 2010, 04:05 PM
Hi Samuel,

I tested the provided sample page once again and the custom tools are working as expected. Could you please provide more detailed information on the specific scenario?
  • Which version of RadControls for ASP.NET AJAX and .NET Framework are used in the application?
  • Under which browser and its version the problem occurs?
 
For your convenience I have prepared a video demonstrating my test.

Regards,
Dobromir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Samuel
Top achievements
Rank 1
answered on 30 Nov 2010, 09:18 PM
Here are steps to reproduce the issue.
I was able to reproduce in Firefox only (3.6.12) :

  • Clear all content from editor (ctrl+A Del)
  • type a few words
  • Click RTL

On subsequent paragraphs the issue indeed doesn't happen. I suspect it has to do with the initial text not being within a P tag.

Another issue is that this only works when NewLineBr is false. The problem is that to the user this gives the appearance of double spacing when enter is clicked.

Please advise.
0
Dobromir
Telerik team
answered on 06 Dec 2010, 11:38 AM
Hi Samuel,

This is an expected behavior of the custom tools. The right-to-left and left-to-right directions need to be set to a block element (p, div, etc), that is why the new paragraph is created when there is only a text, and this is the reason for NewLineBr property to be set to false - to insert a paragraph when Enter is pressed. You can set NewLineBr property to true and the tools behavior should not change.

Also, if you want to produce HTML element different than paragraph you can modify the code and match your requirements. The JavaScript function createPara() is creating the new DOM element and adds it in the content.

In addition, I noticed a small bug in the custom tools causing duplication of content if you have selected test. I have attached a modified sample page with this issue fixed.

Greetings,
Dobromir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Samuel
Top achievements
Rank 1
answered on 20 Dec 2010, 06:45 PM
Thank you for the updated sample. I changed createPara() to create a div.
However, I still wish there was a way to have it work on the initial text. Is there any way to make the editor wrap blocks in a div?
In other words, when a line break is made, a new div is created?

0
Dobromir
Telerik team
answered on 22 Dec 2010, 05:42 PM
Hi Elad,

We have planned for our next major release (RadControls for ASP.NET AJAX Q1 2011) to implement a new property to RadEditor which will configure the content that will be inserted in the content area when Enter key is pressed. On of the values of this new property will configure the editor to insert <div>'s upon enter is pressed.

Kind regards,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Samuel
Top achievements
Rank 1
answered on 22 Dec 2010, 05:45 PM
Thank you.
Will that work for the first line as well (before an enter key is pressed)?
0
Rumen
Telerik team
answered on 27 Dec 2010, 08:18 AM
Hello Elad Rave,

Yes, it should work. The new property should be ready for the Q1 2011 beta and you will be able to test it and provide feedback.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Elad Rave
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Samuel
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or