I am creating a CMS whereby users can edit html pages stored on the server using tinyMCE. The source text is loaded into the editor my C# codebehind file by placing it into a text area. When I place a breakpoint here I can see that the source html has not been altered by the C# code. When the text appears in the editor though it automatically adds <p>
tags with non-breaking spaces between them to the top of the document creating larger and larger spacing each time it's saved, even though I have set force_p_newlines
and force_br_newlines
to false. This spacing often can't be seen in the editor (only by viewing the source from the Tools->Source Code drop down) before the document has been saved. Any ideas what could be causing this problem? Code for tinyMCE is as follows:
tinymce.init({
selector: 'textarea',
height: 600,
width: 1000,
force_br_newlines: false,
force_p_newlines: false,
skin: 'lightgray',
plugins: [
"paste advlist link image lists preview hr anchor pagebreak",
"searchreplace visualchars code fullscreen insertdatetime",
"save table contextmenu directionality emoticons paste textcolor"
],
toolbar: "save | insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | print preview fullpage | forecolor backcolor",
save_enablewhendirty: true,
save_onsavecallback: function(){
var contents = tinyMCE.activeEditor.getContent();
//puts contents into HiddenField
$("[id$='editorContent']").val(contents);
//Clicks hidden button to trigger event server-side
$("[id$='testBtn']").click();
}
});
My tinyMCE is version 4.0.17. If necessary I can also attach a link to one of the html pages I'm using but as they were saved to html from MS Word they're full of irrelevant document properties and largely incomprehensible.
EDIT: I resolved the issue in Chrome where the title of the html page was added to the editor content in between <p>
tags by using one stylesheet and one head stored in a text file for all the pages and removing the titles and lots of other MSO artefacts from them. As such I have removed all my C# source related to this issue but can paste in back in if it might be relevant to the <p>
and  
issue.