How can I do, I can get a Rich Text?

Nov 5, 2008 at 9:13 AM
In N2.Everything-2008 solution, I can find a rich text, it following [root]->home->Features->Images->Lav .

How can I do, I can get a rich text?

[EditableFreeTextArea ("Text", 300,ContainerName=N2.Templates.Tabs.Content)]
        public virtual string Text
        {
            get { return (string)(GetDetail("Text") ?? string.Empty); }
            set { SetDetail("Text", value, string.Empty); }
        }

This setting merely show a textarea.
Coordinator
Nov 5, 2008 at 8:13 PM
You're doing it right. TinyMCE (the wysywyg editor in N2) creates the rich text area from the contents of a textarea.

I'm thinking some javascript error or missing files are preventing the rich editor from loading. Do you notice any javascript errors? If you run fiddler/firebug do you see any javascript files not beeing found?
Nov 7, 2008 at 2:48 AM
Thanks Libardo,

You are right, but I found the reason for not show the rich text.

If I use the [WithEditableName] attribute in class, in Edit there have javascript error. If I did not use that attribute, it show fine.

BTW, my computer use the Chinese OS. Could you tell my why.

Here are error code:
function getName(titleid, whitespace, tolower, ascii){
    var titleBox=document.getElementById(titleid);
 var name = titleBox.value.replace(/[.]+/g, '-').replace(/[%?&/+:<>]/g, '').replace(/\s+/g, whitespace).replace(/[-]+/g, '-').replace(/[-]+$/g, '');
 if(tolower) name = name.toLowerCase();
 if(ascii) name = name
  .replace(/[邃]/g, 'a').replace(/[拍]/g, 'A')
  .replace(/?g, 'ae').replace(/?g, 'ae')
  .replace(/[鲽]/g, 'o').replace(/[重]/g, 'O')
  .replace(/[^a-zA-Z0-9_-]/g, '');
 return name;
}

Thanks,
Safing
Nov 7, 2008 at 3:02 AM
Here is that function's namespace. N2.Web.UI.WebControls.NameEditor

private const string updateNameScript =
            @"
function getName(titleid, whitespace, tolower, ascii){
    var titleBox=document.getElementById(titleid);
 var name = titleBox.value.replace(/[.]+/g, '-').replace(/[%?&/+:<>]/g, '').replace(/\s+/g, whitespace).replace(/[-]+/g, '-').replace(/[-]+$/g, '');
 if(tolower) name = name.toLowerCase();
 if(ascii) name = name
  .replace(/[邃]/g, 'a').replace(/[拍]/g, 'A')
  .replace(/?g, 'ae').replace(/?g, 'ae')
  .replace(/[鲽]/g, 'o').replace(/[重]/g, 'O')
  .replace(/[^a-zA-Z0-9_-]/g, '');
 return name;
}
function updateName(titleid, nameid, whitespace, tolower, ascii, checkboxid){
 var name = getName(titleid, whitespace, tolower, ascii);
    if(checkboxid && document.getElementById(checkboxid).checked)
  document.getElementById(nameid).value = name;
}
";

I use a Chinese OS(XP).
Nov 7, 2008 at 7:36 AM
Just so we know, if you do not use the script, the editor is shown like it should?
If that is true, you should debug the script (Firebug could help) to find out where the error is?
Coordinator
Nov 7, 2008 at 8:39 PM
Interesting, looks like some latin characters (åäö) are interpreted as chinese and break the regex. Could you try and see if tweaking encoding makes any difference?

in web.config:
<system.web>
<globalization responseEncoding"=utf-8” requestEncoding="utf-8”


Nov 12, 2008 at 8:42 AM
I delete their lines and rebuild N2 solution, running my website, that problem was solved. 
Thanks for your help.