I'm using Wysiwyg 6.x-1.1 with TinyMCE 3.2.3 and I can't get the "Paste from Word" button to work. It seems it does a normal paste without cleanup. For example, the following code has been copied from an Openoffice document and stayed that way:

<!--
		@page { margin: 2cm }
		P { margin-bottom: 0.21cm }
		A:link { so-language: zxx }
-->
<p style="margin-bottom: 0cm;"><a href="foo">bar</a></p>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Closed (won't fix)

Please make sure that this issue does not exist in TinyMCE's official demo first. If it does not, feel free to re-open this issue.

tenek’s picture

Try selecting a custom set of buttons and plugins for the profile you are using (see http://drupal.org/node/474588).

yan’s picture

Ok, my bad. I just tried with the official demo and it's the same behaviour. It's just a little strange because I thought it worked in the past.

TamboWeb’s picture

Version: 6.x-1.x-dev » 6.x-2.0
Status: Closed (won't fix) » Active

Issue: Paste From Word feature not working

When clicking the paste from word button (icon), the pop up window does not show the active cursor to allow pasting into the text area. Using drupal 6 + wysiwyg-6.x-2.0 + tinymce_3_2_4_1

Test:

1.- Configured wysiwyg-6.x-2.0 + tinymce_3_2_4_1, paste from word did not work.
2.- Tested the moxiecode demo site and it also had the same issue.

Here is the catch:
3.- Configured the tinymce-6.x-1.1-dev + tinymce_3_2_4_1, and "Paste From Word" did work correctly!

I have noticed that the module installation specifies different file structures. I am not sure if this has anything to do with the issue, or if it a matter of tinymce-6.x-1.1-dev vs. wysiwyg-6.x-2.0

Hope this bit of information helps resolve this issue.

Sandro.

TwoD’s picture

I'm not seeing a missing cursor or caret issue in the official demo or when using Wysiwyg. Do you have a screenshot?

In which browser(s) does this happen?
Does it also happen when using the Garland theme?

TamboWeb’s picture

Hi TwoD

I am testing with Firefox 2 and also with IE7 on an XP machine running as a localhost.

Drupal version is 6.15, It is a clean install and I am just enabling some modules to test their functionality.

The default theme is Garland.

Attached are the screen shots you requested:
editmode.jpg is tinyMCE in node edit mode with just a few buttons enabled.
afterIconClick.jpg shows the paste from word pop up in FF2.
ie7afterIconClick.jpg shows the paste fromword pop up in IE7
FolderStructure.jpg shows the file structure of the modules and library files.

Do I have the library folder in the right location? I assume it is right since I was able to enable tinyMCE.
I will run a test with FF 3 both on the demo site as well as my localhost and will let you know what I find.

Sandro.

TwoD’s picture

Status: Active » Closed (won't fix)

The folder structure looks right, as long as all files are in there too. You're right in that you'd not be able to activate TinyMCE if the 'main' JavaScript file was in the wrong location, and you'd probably see JavaScript errors if other critical files were misplaced.

I did some reading and this is a known bug in FF 1.something through to at least 3.0. It seems this can also happen in IE in various circumstances (related to only the window managers knowing the z-position of widgets). The last such bug in IE I found was for divs with contentEditable enabled and they said it was probably fixed in IE8 Beta 2, so I'm thinking there are many like that left in IE7.
Other modules with heavy style overrides can sometimes trigger this effect: #109286: missing cursor in input fields, the fixes are workarounds for browser bugs tho.

Wysiwyg module only takes care of telling TinyMCE to load the plugin, it doesn't style it in any way.
Doesn't typing/pasting in the "Paste from Word" dialog work even tho the caret is not visible?

Btw, this issue is originally about the "Paste from Word" dialog not cleaning up pastes from OpenOffice [Writer], which it isn't designed for, and it's not something we can do anything about. We most likely can't do anything about the missing caret either, that would most likely require us to modify TinyMCE's code.

FF bugtracker about missing caret: https://bugzilla.mozilla.org/show_bug.cgi?id=167801 see comment 81 and 83 for the fixed for FF 3 comments.

TamboWeb’s picture

Hi TwoD,

I did some additional testing over the weekend. My testing involved pasting formated text from MS Word documents. You were absolutely right about getting different resuls depending on the browser, drupal module (tinymce vs. wysiwyg), and version of moxicode TinyMCE.

I have tested TinyMCE 3.1.0 and TinyMCE 3.2.4

In some cases, The paste from word works and in others don't. I guess the best solution for my application is to use Paste Text when importing content from MS word documents to get as clean HTML code as I can get.

I was just trying to find a consitent crossbrowser solution for the various content contributors for the site I am currently developing.

Thank you again for having taken the time to take a look at this. At this point Paste Text will do just fine.

Sandro

andyhu’s picture

Version: 7.x-2.x-dev » 6.x-2.0

Apologize for my poor english.

After spending couple of hours I think I have found something.

The paste plugin TinyMCE provided has an option paste_retain_style_properties, it's default to "none". That means all styles (color, background color etc.) in word doc will be removed after pasting. In this case it doesn't make sense since it's more or less the same as paste as text.

Can we make this setting to "all" by default or provide an option for users to choose to make it work? I have tested that by doing this and it works quite well

Thanks,
Andy

andyhu’s picture

Version: 6.x-2.0 » 7.x-2.x-dev
Status: Closed (won't fix) » Active
TwoD’s picture

Status: Active » Closed (won't fix)

@andyhu, Retaining all style properties might be too permissive for many users/admins who just want to keep the basic things from MS Word, such as headers, paragraphs, lists, tables etc. This way users will re-apply just the inline styles that are needed instead of bringing in all kinds of subtle overrides.

You can however override this, and many other things, for your site by implementing hook_wysiwyg_editor_settings_alter() like this:

function MYMODULE_wysiwyg_editor_settings_alter(&$settings, $context) {
 if ($context['profile']->editor == 'tinymce') {
   $settings['paste_retain_style_properties'] = 'all';
 }
}

Sadly, there's currently no way to specify function references for callbacks since those aren't supported by the JSON format, but I hope to find workarounds for that. This hook has some documentation in wysiwyg.api.php.