I am using CKEditor ver.3.6 in my Asp.net MVC 3 Application.
My requirement is to create Paint format option in the Google doc.I need to implement Paint format option in a ckeditor.
In Ckeditor how to copy/get all formatting such as font, font effects, centered paragraph alignment from a selected text(source) to a newly selected text (destination).
Please suggest a proper solution.
CKEditor 4 offers a flexible output formatting system that gives developers full control over what the HTML code produced by the editor will look like. It is possible to define: When to indent tags (each tag may have a different configuration) and which indentation method to use (tabs, spaces).
CKEditor 4 comes with a rich set of configuration options that make it possible to customize its appearance, features, and behavior. The main configuration file is named config. js . This file can be found in the root of the CKEditor 4 installation folder.
Enable the RemoveFormatLinks plugin in the configuration and run the editor: ClassicEditor . create( ..., { plugins: [ RemoveFormat, RemoveFormatLinks, // ... ], toolbar: [ 'removeFormat', // ... ] } ) From now on, the the “Remove Format” button should also remove links in the content.
Use this function to replace the content of a selected html with the text in one field. On a button click, 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);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With