New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...RTL Option using RADEditorRTL Option using RADEditor
Previous
 
Next
New Post
3/6/2012 9:43 AM
 

My first question is does DNN support right to left support for Telerik RADEditor?

Secondly if I wanted to implement is for just a certain page on my site or have the option such as here with English and Arabic, is this possible?

Many thanks.

 
New Post
3/6/2012 3:21 PM
 

After many hours of searching I found the answer. My example was a little differnt in that my skin was not RTL I just wanted the option of having RTL in RADEditor. So here it is;

1. Providers\HtmlEditorProviders\Telerik\Config\ToolsDefault.xml add the following lines
<tool name="LTR" text="LTR" showtext="true" showicon="false"/>
<tool name="RTL" text="RTL" showtext="true" showicon="false"/>

2. Providers\HtmlEditorProviders\Telerik\js\CustomFunctions.js add the following after the existing text
function SetDirectionOfSelection(editor, strDirection)
            {
                var rngSelection = editor.getSelection();
                var strTagNames;
                strTagNames = "|H1|H2|H3|H4|H5|H6|P|PRE|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|TR|UL|OL|";
                if (rngSelection.getParentElement())
                {
                    var elemSelectionParent = rngSelection.getParentElement();
                    while ((elemSelectionParent != null) && (strTagNames.indexOf("|" + elemSelectionParent.tagName + "|") == -1))
                    {
                        elemSelectionParent = elemSelectionParent.parentNode;
                    }
                    if (elemSelectionParent)
                    {
                        SetDirectionOnElement(elemSelectionParent, strDirection);
                    }
                    else
                    {
                        var oDoc = editor.get_document();
                        var para = createPara(oDoc, strDirection, editor.getSelectionHtml());

                        var range = editor.getSelection().getRange();

                        //handle possitioning of the cursor inside the new paragraph

                        if ($telerik.isIE)
                        {
                            range.moveToElementText(para);
                            range.select();
                        }
                        else
                        {
                            range = document.createRange();
                            range.selectNodeContents(para);
                            editor.getSelection().selectRange(range);
                        }
                        editor.getSelection().collapse();

                        SetDirectionOfSelection(editor, strDirection);
                    }
                }
            }

            function SetDirectionOnElement(element, strDirection)
            {
                if ("ltr" == strDirection)
                {
                    element.dir = "ltr";
                    element.align = "left";
                }
                else if ("rtl" == strDirection)
                {
                    element.dir = "rtl";
                    element.align = "right";
                }
            }

            function createPara(doc, dir, content)
            {
                var par = doc.createElement("P");
                SetDirectionOnElement(par, dir)
                par.innerHTML = content;
                doc.body.appendChild(par);
                return par;
            }

            Telerik.Web.UI.Editor.CommandList["LTR"] = function (commandName, editor, args)
            {
                SetDirectionOfSelection(editor, "ltr");
            }
            Telerik.Web.UI.Editor.CommandList["RTL"] = function (commandName, editor, args)
            {
                SetDirectionOfSelection(editor, "rtl");
            }

That's it your ready to go
 
New Post
6/3/2012 8:31 AM
 

I installed DNN6.2.

I don't see Providers\HtmlEditorProviders\Telerik\Config\ToolsDefault.xml files.
I don't see Providers\HtmlEditorProviders directory.

Can someone tell me why?

 
New Post
8/29/2013 1:19 AM
 
Thanks for the post!
These are the summary changes for applying to DNN 7.0,

1. add the two buttons (two possibilities)
1.1. via DNN UI: Host -> HTMLEditorManager choosed "everyone", select tab "Toolbar Configuration", add the two lines at your desired position



1.2 edit file: \DesktopModules\Admin\RadEditorProvider\ToolsFile\toolsfile.xml, add the two lines at your desired position



2. include the JS to file \DesktopModules\Admin\RadEditorProvider\Js\RegisterDialogs.js, note that there is a small change to the original JS to register on Document Ready
function SetDirectionOfSelection(editor, strDirection)
{
var rngSelection = editor.getSelection();
var strTagNames;
strTagNames = "|H1|H2|H3|H4|H5|H6|P|PRE|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|TR|UL|OL|";
if (rngSelection.getParentElement())
{
var elemSelectionParent = rngSelection.getParentElement();
while ((elemSelectionParent != null) && (strTagNames.indexOf("|" + elemSelectionParent.tagName + "|") == -1))
{
elemSelectionParent = elemSelectionParent.parentNode;
}
if (elemSelectionParent)
{
SetDirectionOnElement(elemSelectionParent, strDirection);
}
else
{
var oDoc = editor.get_document();
var para = createPara(oDoc, strDirection, editor.getSelectionHtml());

var range = editor.getSelection().getRange();

//handle possitioning of the cursor inside the new paragraph

if ($telerik.isIE)
{
range.moveToElementText(para);
range.select();
}
else
{
range = document.createRange();
range.selectNodeContents(para);
editor.getSelection().selectRange(range);
}
editor.getSelection().collapse();

SetDirectionOfSelection(editor, strDirection);
}
}
}

function SetDirectionOnElement(element, strDirection)
{
if ("ltr" == strDirection)
{
element.dir = "ltr";
element.align = "left";
}
else if ("rtl" == strDirection)
{
element.dir = "rtl";
element.align = "right";
}
}

function createPara(doc, dir, content)
{
var par = doc.createElement("P");
SetDirectionOnElement(par, dir)
par.innerHTML = content;
doc.body.appendChild(par);
return par;
}


$(document).ready(function() {
Telerik.Web.UI.Editor.CommandList["LTR"] = function (commandName, editor, args)
{
SetDirectionOfSelection(editor, "ltr");
}
Telerik.Web.UI.Editor.CommandList["RTL"] = function (commandName, editor, args)
{
SetDirectionOfSelection(editor, "rtl");
}

});



 
New Post
8/29/2013 7:59 AM
 

ok -^--O-O--^- , I managed for DNN 7.0!

  1. the XML is now at \DesktopModules\Admin\RadEditorProvider\ToolsFile\toolsfile.xml.
    1. I like them handy, so I added them at the beginning:
       <tools name="MainToolbar">
              <tool name="LTR" text="LTR" showtext="true" showicon="false"/>
              <tool name="RTL" text="RTL" showtext="true" showicon="false"/>
  2. The Js goes to file:  \DesktopModules\Admin\RadEditorProvider\RegisterDialogs.js with a slight change at the end of it.

    function SetDirectionOfSelection(editor, strDirection)
                {
                    var rngSelection = editor.getSelection();
                    var strTagNames;
                    strTagNames = "|H1|H2|H3|H4|H5|H6|P|PRE|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|TR|UL|OL|";
                    if (rngSelection.getParentElement())
                    {
                        var elemSelectionParent = rngSelection.getParentElement();
                        while ((elemSelectionParent != null) && (strTagNames.indexOf("|" + elemSelectionParent.tagName + "|") == -1))
                        {
                            elemSelectionParent = elemSelectionParent.parentNode;
                        }
                        if (elemSelectionParent)
                        {
                            SetDirectionOnElement(elemSelectionParent, strDirection);
                        } 
                        else
                        {
                            var oDoc = editor.get_document();
                            var para = createPara(oDoc, strDirection, editor.getSelectionHtml());

                            var range = editor.getSelection().getRange();

                            //handle possitioning of the cursor inside the new paragraph

                            if ($telerik.isIE)
                            {
                                range.moveToElementText(para);
                                range.select();
                            } 
                            else
                            {
                                range = document.createRange();
                                range.selectNodeContents(para);
                                editor.getSelection().selectRange(range);
                            }
                            editor.getSelection().collapse();

                            SetDirectionOfSelection(editor, strDirection);
                        }
                    }
                }

                function SetDirectionOnElement(element, strDirection)
                {
                    if ("ltr" == strDirection)
                    {
                        element.dir = "ltr";
                        element.align = "left";
                    }
                    else if ("rtl" == strDirection)
                    {
                        element.dir = "rtl";
                        element.align = "right";
                    }
                }

                function createPara(doc, dir, content)
                {
                    var par = doc.createElement("P");
                    SetDirectionOnElement(par, dir)
                    par.innerHTML = content;
                    doc.body.appendChild(par);
                    return par;
                }


    $(document).ready(function() {
      // Handler for .ready() called.
                Telerik.Web.UI.Editor.CommandList["LTR"] = function (commandName, editor, args)
                {
                    SetDirectionOfSelection(editor, "ltr");
                }
                Telerik.Web.UI.Editor.CommandList["RTL"] = function (commandName, editor, args)
                {
                    SetDirectionOfSelection(editor, "rtl");
                }

    });

 

I don't know if I overkilled, but I had to restart the site to make it work.

 

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...RTL Option using RADEditorRTL Option using RADEditor


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.