Topic: CKEditor & cutenews paste from Word

Hi

It seems like being able to paste from MS Word into the CKeditor would help users of CuteNews. Has anyone any advice on this option.

Thanks

Geoff

Re: CKEditor & cutenews paste from Word

Hi

It seems like being able to paste from MS Word into the CKeditor would help users of CuteNews. Has anyone any advice on this option.

Thanks

Geoff


You want only copy the text from Word?

Ckeditor
Click on the 'source' button and copy the text inside but you lost all the text stylings.

Re: CKEditor & cutenews paste from Word

You want only copy the text from Word?

Ckeditor
Click on the 'source' button and copy the text inside but you lost all the text stylings.

Hi Perry

I think you have misunderstood me. I want to copy only the text (including tables) from a Word document. I am finding that Copy and Paste into CKEditor creates a lot of new lines.
And the table grid lines are missing.

Geoff

Re: CKEditor & cutenews paste from Word

Hi Perry

I think you have misunderstood me. I want to copy only the text (including tables) from a Word document. I am finding that Copy and Paste into CKEditor creates a lot of new lines.
And the table grid lines are missing.

Geoff


Perhaps the Ckeditor Plugin is helpful: http://ckeditor.com/addon/pastefromword

5 (edited by 2015-03-14 17:19:54)

Re: CKEditor & cutenews paste from Word

Perhaps the Ckeditor Plugin is helpful: http://ckeditor.com/addon/pastefromword

Thanks Perry

There is already a solution at least for getting rid of the new lines that are created. Unfortunately, I am having trouble with getting it work. See new line post

I am aware of the plugin but I want to get familiar with the new version of Cutenews before I look at plugins.

I have found that under System Configurations there is a tab for CKeditor. The possible settings can be reviewed here CKeditor 3.x/Developers

I have added the additional option to the CKeditor: PasteFromWord  but it doesn't make any difference to what would have been achieved by using Control +V. I think that the addon must be installed all the button does is provide the option to use the features available in the addon.

I'll try the plugin/addon referred to by Perry after I have completed my current website.

Re: CKEditor & cutenews paste from Word

Thanks Perry

There is already a solution at least for getting rid of the new lines that are created. Unfortunately, I am having trouble with getting it work. See new line post

I am aware of the plugin but I want to get familiar with the new version of Cutenews before I look at plugins.

I have found that under System Configurations there is a tab for CKeditor. The possible settings can be reviewed here CKeditor 3.x/Developers

I have added the additional option to the CKeditor: PasteFromWord  but it doesn't make any difference to what would have been achieved by using Control +V. I think that the addon must be installed all the button does is provide the option to use the features available in the addon.

I'll try the plugin/addon referred to by Perry after I have completed my current website.

I have the plugin installed now and CKEDitor is still adding blank lines. Perhaps there are some settings that need to be added to the plugin.

7 (edited by 2015-04-14 11:29:22)

Re: CKEditor & cutenews paste from Word

I have the plugin installed now and CKEDitor is still adding blank lines. Perhaps there are some settings that need to be added to the plugin.

There is an issue with CKeditor and it has been discussed over the last three years. CKeditor adds

<p> </p>

to copied and pasted text from Microsft Word and other word processors. Mention has been made on Stack Exchange, Drupal and Wordpress. Albertski has published a plugin. Code below:

/**
 * @file
 * Written by Albert Jankowski - https://www.drupal.org/user/1327432
 */

(function() {
  /**
   * Check for a paste event and replace <p> </p> with blank
   */
  CKEDITOR.on('instanceReady', function(e) {
    e.editor.on('paste', function(ev) {
      // Replaces <p> </p> with ''
      ev.data.dataValue = ev.data.dataValue.replace(/ /g,'');
      // Replaces <p>
</p> with ''
       ev.data.dataValue = ev.data.dataValue.replace(/<p>
<\/p>/g,'');
    }, null, null, 9);
  });

  CKEDITOR.plugins.add('ckeditor_paragraph_paste_fix', {
  });
})();

I don't know how to add this plugin to CKeditor perhaps someone who knows how to can post instructions. Please note that even though the code is placed within code tags the non breaking space character might be missing in both code blocks above.  The Google search details are "CKeditor Paragraph Paste Fix".

PLEASE NOTE: THAT THE &NBSP; CHARACTER MIGHT BE MISSING IN THE CODE BLOCKS ABOVE. I AM USING FIREFOX AND A "BR" INSTEAD OF THE NON-BREAKING CHARACTER IS ADDED TO THE CODE BUT IS NOT SHOWN IN THE COMMENT!  The string that is added to posts is <p> </p> The CutePHP forum software should not alter code that is pasted into code tags but that is happening to my post.

Update and rechecking the code which I pasted. what the plugin does is find and replace any instances of : <p> </p> with ' '  (two apostrophes). Also, it finds and replaces <p>br</p> with two apostrophes.