शेखर
शेखर

Reputation: 17604

Paste data into CK editor from other website inline CSS loosing in Google Chrome but not in IE an Firefox

I am using ckeditor in my application. The application is built on asp.net MVC.
It is working fine.
The issue is when I copy the data from other website and pasting into ck editor the format is getting lost. Like color, underline, bold, etc.

It is working fine from if I copy the content from Microsoft Word.
I did not find any reference whether it is supported or not. Some Links which I visited

https://ckeditor.com/docs/ckeditor4/latest/guide/dev_allowed_content_rules.html

Edit 1

Below is the code which I am using

$(document).ready(function () {        
CKEDITOR.replace("myckeditor",
{
    height: 450,
    bodyClass: 'document-editor',
    contentsCss: [CKEDITOR.basePath + 'contents.css', CKEDITOR.basePath + 'pastefromword.css'],
    extraPlugins: 'pastefromword,tabletools,tableresize,tableselection,colordialog',
    removePlugins: 'elementspath,wsc,scayt',
});
CKEDITOR.config.scayt_sLang = "en_US";
CKEDITOR.config.pasteFromWordRemoveFontStyles = false;
CKEDITOR.config.allowedContent = true;
});

edit 1

CKEDITOR.config.pasteFromWordRemoveFontStyles = false;
CKEDITOR.config.allowedContent = true;
CKEDITOR.config.extraAllowedContent = '*(*);*{*}';

above are the additional configuration which I have done in CK editor.

I have created a source file from where I want to copy and past data.

<html>
<head>
    <title>
        this is a test page
    </title>
</head>
<body>
    <div>
    this is a normal text
    <div>
    <div style="color:red;">
        this is red text
    </div>
<body>
</html>

when I am copying the data from browsers like IE and Firefox the color to is copied in the CK editor.
But in Chrome Browser it not proper if it is removing the style attribute from the div.
There are some other function in the code if it is required I can show you that as well.

Similar question which did't helped.
CKEditor strips inline attributes
CKEditor automatically strips classes from div

Upvotes: 4

Views: 1002

Answers (1)

शेखर
शेखर

Reputation: 17604

I don't know weather it is correct solution or not but below code worked for me

config.pasteFilter = null;

References:
http://origin-docs.ckeditor.com/ckeditor4/docs/?print=/api/CKEDITOR.config

Upvotes: 6

Related Questions