Hi I have implemented the ckeditor in my asp.net and vb.net web application. After a lot of struggle its working fine.
But its adding a lots of line breaks and paragraphs (specially copying and pasting from word file ) after every save. The editor is placing extra <br/> in side the html after submission of the page.
To clarify when copying and pasting for the first time we do NOT see this behaviour, the problem is only seen on subsequent edits/saves
Here are the steps which I have followed to implement ckeditor.
1. Downloaded the ckeditor from the link http://ckeditor.com/download. I am using the full package
2. Copied the whole folder under project folder.
3. In the master page added the following lines to add reference of ckeditor
<script src="/ckeditor/ckeditor.js" type="text/javascript"></script> <script src="/ckeditor/adapters/jquery.js" type="text/javascript"></script> <script src="/ckeditor/ckeditor_custom.js" type="text/javascript"></script>
4. Changed the class for the specific textarea
<textarea runat="server" id="txtDescription" name="txtDescription" class="ckeditor" style="width: 98%; height: 250px;"></textarea>
5. Added following javascript function at the bottom of the content page
$('#' + '<%= btnSave.ClientID%>').mousedown(function () { for (var i in CKEDITOR.instances) { CKEDITOR.instances[i].updateElement(); } });
Thats it. nothing has changed in the code file
here the btn.save is the button which submits the data
I have tried to remove the extra paragraph by the integrating the following code in config.js file
CKEDITOR.editorConfig = function( config ) {
config.autoParagraph = false;
};
I also tried
config.enterMode = CKEDITOR.ENTER_BR;
and
CKEDITOR.on('txtDescription', function (ev) { ev.editor.dataProcessor.writer.setRules('br', { indent: false, breakBeforeOpen: false, breakAfterOpen: false, breakBeforeClose: false, breakAfterClose: false }); }); config.enterMode = CKEDITOR.ENTER_BR; config.shiftEnterMode = CKEDITOR.ENTER_BR;
inside CKEDITOR.editorConfig = function( config ) { ..... } in config.js file. But got the same result.
After saving when I open the editor again extra line break and paragraph adds after each line
.
Please help