Reputation: 33
My problem is that CKEditor 4 seems to be stripping certain data when inserted into the editor, I have validated that the data is correct before it is passed to CK.
I have included the
config.allowedContent = true;
which should stop CK from formatting my text at all, however when i use the editor.insertHtml method and pass in a large block of html containing
<html lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<link href="http://fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css"/>
<link href="http://fonts.googleapis.com/css?family=Bree+Serif" rel="stylesheet" type="text/css"/>
<link href="http://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet" type="text/css"/>
<link href="http://192.168.0.50/css/new/all.css?v=1" media="all" rel="stylesheet" type="text/css"/>
<link href="http://192.168.0.50/css/new/templates.css?v=1" media="all" rel="stylesheet" type="text/css"/>
<link href="http://192.168.0.50/css/pre_review/colors.css?v=1" rel="stylesheet" type="text/css"/>
<link href="http://192.168.0.50/css/pre_review/paged_test.css?v=2" media="paged" rel="stylesheet"
type="text/css"/>
<link href="http://192.168.0.50/css/pre_review/bootstrap.min.css?v=1" media="all" rel="stylesheet"
type="text/css"/>
<link href="http://192.168.0.50/css/pre_review/main.css?v=1" rel="stylesheet" type="text/css"/>
<style type="text/css">html { -ro-editable: true; }</style>
</head>
<body>
After this has been inserted into the editor i view the source and whats left is
<html>
<head>
<title></title>
</head>
<body>
<p><!--?xml version="1.0" encoding="UTF-8"?--><!-- Comment by kp --><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<style type="text/css">html { -ro-editable: true; }
</style>
Has anybody encountered this problem before?
Upvotes: 0
Views: 859
Reputation: 22023
The editor.insertHtml()
cannot be used to insert the whole page's HTML including tags like <html>
. It can be used only for purposes like pasting - so inserting fragments of the <body>
.
I guess that you just want to use the editor.setData()
method. And remember to initialise editor in the full page mode.
Upvotes: 1