In Ckeditor how to copy / get all formatting from selected text

I am using CKEditor ver.3.6 in my ASP.NET MVC 3 application.

My requirement is to create a "Format" parameter in a Google doc document. I need to implement the "Format" parameter in ckeditor.

In Ckeditor, how to copy / receive all formatting, such as font, font effects, center alignment with selected text (source text) to newly selected text (destination).

Please suggest the right solution.

+7
source share
1 answer

Use this function to replace the contents of the selected html with text in one field. By pressing the button, call this function:

function Replace() { var sel = editor.getSelection(); var ele=sel.getStartElement(); if(ele.hasAttributes()) { var insertele= editor.document.createElement('span'); ele.copyAttributes(insertele,{type:1,value:1}) insertele.setHtml($("#repTxt").val()); editor.insertElement(insertele); } } 
+1
source

All Articles