maybe I'm doing something wrong, but when i copy and paste a document from microsoft word into the FCKeditor I get everything formatted right, but there is a ton of strange code that also appears... is copy and pasting not really supported, is this a bug or is there a way to do it without reproducing so much code.

Just copy and paste anything from word into the rich-text area, and you can do either filtered or full html and it works but displays a lot of extra code that doesn't really seem right.

you can look at the page at: http://johnfmckeon.com/content/node/34

Comments

yched’s picture

Project: Drupal core » FCKeditor - WYSIWYG HTML editor
Version: 6.2 » 6.x-1.x-dev
Component: other » Code

What about posting this in the right issue queue ? :-)

wwalc’s picture

Use PasteWord button to paste content from Word: http://docs.fckeditor.net/FCKeditor_2.x/Users_Guide/Quick_Reference

AlexisWilke’s picture

How about mentioning that on the front page here in Drupal?

That way people like alextorpey and I can read that and not bother you any further... 8-)

Thank you for the note about the Paste from MS-Word!
Alexis Wilke

wwalc’s picture

Status: Active » Fixed

I have no idea where to put this info, README is already so long... if you know some good place for it, just jet me know.

AlexisWilke’s picture

wwalc,

Would there be any way to detect that this is a word document being pasted?

If so, then emitting a warning at that time would be super useful!

Now, notice that most people do NOT read the README file. That's a hidden programmer thing. However, the Drupal front page for FCKeditor is visible by all. I meant this one:

http://drupal.org/project/fckeditor

And yes... that page is already pretty long. But I have read it to see whether there was something in that regard.

Anyway, thank you for all your hard work!
Alexis

wwalc’s picture

AlexisWilke’s picture

That's cool! 8-)

Although, I use IMCE that crashes IE7 under XP. So in other words I have to use a browser that does not crash. Weird, hey?

But that's good to know.

Thank you.
Alexis Wilke

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Valeratal’s picture

I got Div vs. paragraf
How change?

somebodysysop’s picture

Status: Closed (fixed) » Active
StatusFileSize
new50.94 KB
new10.64 KB
new9.4 KB
new48.74 KB

Not sure if I needed to re-open this issue or post a new one. I had the same problem as the original poster of this issue. I followed these instructions:

Use PasteWord button to paste content from Word: http://docs.fckeditor.net/FCKeditor_2.x/Users_Guide/Quick_Reference

This gets rid of the extra code, but the paragraph formatting is lost. See the attached images which are the results of using the sample word doc (zipped) file also attached. Note that when the sample agenda is pasted from word (Sample_Agenda_PasteFromWord.jpg) it loses formatting that you see in Sample_Agenda.pdf.

Any suggestions?

p.s. Note that importing this same word file into fckeditor 5.x works as expected.

Jorrit’s picture

Is there perhaps a conflict with filters?

somebodysysop’s picture

Is there perhaps a conflict with filters?

What do you mean?

AlexisWilke’s picture

SomebodySysop,

Filters can have an effect on your formatting at the time you hit Save.

If you have the problem before hitting Save, then you've got a problem in the Paste itself. So we'd need to know when it happens.

The Pasted data will most certainly include style attributes that are removed by the default filters.

Thank you.
Alexis Wilke

somebodysysop’s picture

It appears to display properly in the body section when pasted. Then when Save is hit it displays badly.

AlexisWilke’s picture

Then Jorrit is probably right. Your filter is certainly what destroys the content. Try using the Full HTML instead of the Default Input filter.

somebodysysop’s picture

Then Jorrit is probably right. Your filter is certainly what destroys the content. Try using the Full HTML instead of the Default Input filter.

Thanks for the response. I'm not exactly sure where I set this "filter". If you mean "Input formats", that is already set to Full HTML.

AlexisWilke’s picture

Yes, Input Formats.

Just in case, you want to verify your FCKeditor setup too. There is a way to select a filter in there that will remove styles and such entries...

Edit the FCKeditor setup that you are using (depends on your role) and see what you have inside the "Security -- Security filters"

Thank you.
Alexis Wilke

somebodysysop’s picture

Found the security section. Altering these filters (only two: html corrector, html filter) doesn't seem to have any effect.

I find it curious that the pasted code looks correct in the fckeditor body in edit mode, but the code tags show up once the node is saved.

As I noted before, in fckeditor 5.x I am able to import the same word file without this problem. I copied the fckedtitor code from my 5.x site into my 6.x site (that is, the fckeditor subdirectory within the fckeditor module). Same result. So, it appears there is something in my Drupal setup is causing this problem.

Jorrit’s picture

Is it because the filter settings of the node itself are set to not allow any HTML?

somebodysysop’s picture

PasteFromWord correctly formats the imported word document. The problem is that there is a bunch of word code that appears above the correctly formatted text: http://drupal.org/files/issues/Sample_Agenda_PasteIntoBody.jpg

The default input type is full html, so I'm not sure where I would have set the filter for the node to be something else.

somebodysysop’s picture

Also, there seems to be a difference depending upon the browser used.

In fckeditor 6.x, the problem is with FireFox. It appears that IE works fine.

Yet, in fckeditor 5.x both FF and IE work fine

Is there something about the FF browser that we need to check?

Jorrit’s picture

Does the problem also occur on http://www.fckeditor.net/demo?

somebodysysop’s picture

StatusFileSize
new40.46 KB
new140.4 KB

Does the problem also occur on http://www.fckeditor.net/demo?

Paste from word is not available on this site. However, simply pasting the word document into the fckeditor yields this output:
fckeditorDemoPastedData.jpg

It's unclear what this will look like in the browser.

I know this is what it looks like in my browser:
Sample_agenda_PastIntoBody02.jpg

somebodysysop’s picture

Status: Active » Fixed
StatusFileSize
new46.99 KB

@Jorrit and AlexisWilke: Thank you two so much! You were absolutely right! It was the filters. But, the offending filter was the "HTML Corrector" in Input Format settings.
Input Format Filters

I unchecked this filter, and the problem went away.

Again, thanks to all.

richardtmorgan’s picture

FCKEditor's PasteWord default behaviour produces <div>s instead of <p>s for each paragraph you paste in from Word. You can read about it at -
http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/C...

As you see from the documentation, you just need to add this line to your fckeditor.config.js file (anywhere in that file):

FCKConfig.CleanWordKeepsStructure = true ;

This fixes the issue - paragraphs stay as paragraphs. Why the default behaviour is to have this set to false, I have no idea...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.