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

doctype and dtd

1 Answer 41 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Jim Duncan
Top achievements
Rank 1
Jim Duncan asked on 03 Jun 2010, 07:33 PM
Hello,

Is there any way to change the doctype tag used inside the editor control?

The doctype in our master page is this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 


While in the (document inside the IFRAME embedded in the) editor control seems to be this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Strict//EN"> 


As a result of the two being different (namely the dtd reference), edit mode renders differently from display mode. For instance, paragraphs inside a table cell are left aligned when in edit mode but are centered in the table cell when the page is saved.

Is there anything I can do to force the document in the embedded IFRAME to use the same doctype tag that we are using in the master page?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Stanimir
Telerik team
answered on 09 Jun 2010, 12:45 PM
Hello Jim,

I can suggest you the following workaround of the problem:

1. Set the OnClientLoad and OnClientSubmit properties of the editor correspondingly to OnClientLoad and OnClientSubmit. Review the following online help article http://www.telerik.com/help/aspnet-ajax/set-properties-via-config-file.html. You need to have both lines in the ConfigFile.xml or ListConfigFile.xml files:
<property name="OnClientLoad">OnClientLoad</property>
<property name="OnClientSubmit">OnClientSubmit</property>

2. Make sure that the following javascript methods are defined in the page where the editor is loaded:
function OnClientLoad(editor, args)
{
    if (!editor.get_fullPage())
    {
        var content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
            '<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>' + editor.get_html(true) + '</body></html>';
        editor.set_html(content);
    }
}
 
function OnClientSubmit(editor, args)
{
    var html = editor.get_html(true);
    html = html.replace(/(\s|.)*<body>((\s|.)*)<\/body>(\s|.)*/gi, "$2");
    editor.set_html(html);
}

One good place to define them is the MOSSEditorTools.js file, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.



All the best,
Stanimir
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.
Tags
WebParts for SharePoint
Asked by
Jim Duncan
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or