Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  174] [ 5]  / answers: 1 / hits: 19243  / 8 Years ago, wed, march 16, 2016, 12:00:00

I using CKEditor, and if I click the Source button and paste HTML code like below :



<html>
<head>
<meta http-equiv=Content-Type content=text/html />
</head>
<body>
<p>test</p>
</body>
</html>


and click to Source again and then submit the form, the html , head and , body tags are removed and just stays <p>test</p>!



CKEditor configuration:



CKEDITOR.replace('content', {
extraPlugins: 'font,panelbutton,colorbutton,colordialog,justify,indentblock,aparat,buyLink',
autoGrow_onStartup: true,
enterMode: CKEDITOR.ENTER_BR,
FullPage : false,
allowedContent : true,
ProtectedTags : 'html|head|body'
});


Can you help me?


More From » html

 Answers
56

If you want to edit an entire HTML page, with <html>, <head> and <body> elements, you need to set the config.fullPage option to true:



CKEDITOR.replace( 'content', {
fullPage: true,
extraPlugins: 'font,panelbutton,colorbutton,colordialog,justify,indentblock,aparat,buyLink',
// You may want to disable content filtering because if you use full page mode, you probably
// want to freely enter any HTML content in source mode without any limitations.
allowedContent: true,
autoGrow_onStartup: true,
enterMode: CKEDITOR.ENTER_BR
} );


Pay attention to using proper case (fullPage is not FullPage) in your configuration. See also the following resources for more information:





If you want to use the config.autoGrow_onStartup option, you need to include the Auto Grow plugin in your setup.



Last but not least, changing the Enter Mode setting to BR or DIV is not recommended. The default CKEDITOR.ENTER_P mode is fully supported by all editor features and plugins and is also the most correct one in terms of best practices for creating web content.



If you do it to control paragraph spacing, you should use stylesheets instead. Edit the contents.css file and set up a suitable margin value for <p> elements, for example:



p { margin: 0; }

[#62926] Sunday, March 13, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tomas

Total Points: 165
Total Questions: 111
Total Answers: 103

Location: Maldives
Member since Tue, Dec 21, 2021
2 Years ago
tomas questions
Thu, Jan 27, 22, 00:00, 2 Years ago
Mon, May 10, 21, 00:00, 3 Years ago
Tue, Jan 5, 21, 00:00, 3 Years ago
;