Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12406 closed Bug (invalid)

Paste from word ckeditor does not work

Reported by: nikhil Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version: 4.4.4
Keywords: Cc: nikhiljbhandari@…

Description

We migrated to CKEDITOR 4.4 form fckeditor 2.7 but now we are facing many problems with Paste from word feature. when we paste from word we are facing following issues:

  1. paste from word does not retains the margin attributes. so if the word document has content with margins and after using paste from word feature the margin attribute is removed.
  2. paste from word does not retain bullets and numbering which are left indented in word document.
  3. paste from word adds annoying spaces in IE between any sentence and table below it.
  4. paste from word adds annoying spaces in all browsers between any sentence and bullets and numbering below it.

when we use fckeditor paste from word would copy one to one styles for each line but ckeditor is not doing that. i have added CKEDITOR.config.allowedContent = true;

CKEDITOR.config.pasteFromWordRemoveStyles=false;

CKEDITOR.config.pasteFromWordRemoveFontStyles = false;

CKEDITOR.config.pasteFromWordRemoveStyles = false;

CKEDITOR.config.fillEmptyBlocks = false;

follwing attributes to Config.js but still all the issues persists. i have searched across forums but didnt find any solution working. I am attaching the word doc and also the ck editor build.js. Please help us to resolve the issues.

Attachments (5)

Document1 (3).docx (26.9 KB) - added by nikhil 4 years ago.
TEST DOCUMENT
build-config.js (2.0 KB) - added by nikhil 4 years ago.
build-config.js
Extra spces and margin issues in table.jpg (129.6 KB) - added by nikhil 4 years ago.
issue screnshots
extra space and margin issues.jpg (51.2 KB) - added by nikhil 4 years ago.
issue screnshots 3
Doc1.docx (37.2 KB) - added by nikhil 4 years ago.
test document

Download all attachments as: .zip

Change History (13)

Changed 4 years ago by nikhil

Attachment: Document1 (3).docx added

TEST DOCUMENT

Changed 4 years ago by nikhil

Attachment: build-config.js added

build-config.js

comment:1 Changed 4 years ago by nikhil

one more issue

  1. paste from word does not handles nested bullets inside a table as well.

Changed 4 years ago by nikhil

issue screnshots

Changed 4 years ago by nikhil

issue screnshots 3

comment:2 Changed 4 years ago by nikhil

Cc: nikhiljbhandari@… added

Changed 4 years ago by nikhil

Attachment: Doc1.docx added

test document

comment:3 Changed 4 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.4.4

paste from word adds annoying spaces in IE between any sentence and table below it.
paste from word adds annoying spaces in all browsers between any sentence and bullets and numbering below it.

Please check styles of these HTML elements with e.g. Firebug or Chrome dev-tools. You will notice that lists or paragraphs have default margins added by browser. You can modify it in contents.css file.

paste from word does not retains the margin attributes. so if the word document has content with margins and after using paste from word feature the margin attribute is removed.

I have set allowedContent:true and text was correctly centered so i can't confirm this issue.

CKEDITOR.config.fillEmptyBlocks = false;

This will not help in your case. You should remove this setting.

paste from word does not retain bullets and numbering which are left indented in word document.

Please provide docx with list that is causing the problem for you and tell me in which browser does it happen because I can't confirm it.

I don't see problem here so I'm closing this issue.

comment:4 Changed 4 years ago by nikhil

Version: 4.4.4

i have added the documnet file. if you paste the contents of file you will observe that the alignmnet of bullets and numbering is not retained. Also the Paste is left aligned even when some columns are to be centered in table. Pleadse look into it and resolve it, the paste from word doent work at all. It used to work in FCKedior with no issues.

Also is there a way by which we can add space before the table

comment:5 Changed 4 years ago by nikhil

please reopn thisiisue

comment:6 Changed 4 years ago by Jakub Ś

First of all you must know that in all cases, the editor privileges semantics over formatting, so the end results will never look like the original.
CKEditor makes it best to translate the information send from Word through the clipboard and many times it needs to come to an agreement. In those cases we prioritize semantics instead of formatting.


Like I have explained before, these issues you have, can be fixed with ACF configuration and rules provided for contents.css file.

  1. Lists - I can see that in Word they are close to border. You must know that browser gives default styles to lists. You can change it with contents.css bu adding rule to lists e.g. ul{ margin-left: -20px; }
  2. Some entries are not centred because ACF does not allow paragraphs with align="center" attribute by default. You can either disable or configure ACF to allow such attribute on paragraph.

You can read more about ACf here:
http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
http://docs.ckeditor.com/#!/guide/dev_disallowed_content
http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent
http://nightly.ckeditor.com/14-03-20-07-05/full/samples/datafiltering.html


This issue will not be reopened or continued as there are no errors here.

comment:7 Changed 4 years ago by nikhil

Hi

i have followed the advise as mentioned in point 1 but now the issue is the bullets are always moved -20px even if the document does not have it. Can you please look into it once again?

also can you please provide any working example for allowedContent. the Config.js have allowedContent=true setting but still it fails to keep the format. Also is there a way by which we can add space before the table?

please respond to the questions

comment:8 Changed 4 years ago by Jakub Ś

You need to understand that HTML is different to MS Word content.

Styles you see are assigned by default to lists. If you set global CSS rules that will be assigned to all lists. If you want to create list specific styles, please edit styles.js file and apply different rules for lists. They won't work on paste and you will have to apply them manually but you will have diversification you are looking for.

Documentation is full of ACF examples: http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
http://nightly.ckeditor.com/14-09-23-06-07/full/samples/datafiltering.html

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy