Opened 10 years ago

Closed 8 years ago

Last modified 3 years ago

#1537 closed Bug (fixed)

Forced <p> on paste

Reported by: MiksIr Owned by: martinkou
Priority: Normal Milestone: FCKeditor 2.6.5
Component: Plugin : Paste from Word Version: FCKeditor 2.6.4
Keywords: Confirmed Review+ Cc:


When paste paragraph from Word (I am not check other sources) the empty paragraph (<p>&nbsp;</p>) is forced.
This is nodes of FCKeditor before insert (empty document):

<body spellcheck="false">
    <br type="_moz"/>

and this is after paste:

<body spellcheck="false">
  <p class="MsoNormal" _moz_dirty="">
    <span lang="EN-US" style="">
      It’s a test

Sure, use "Word paste" make the same result.

Attachments (2)

1537.patch (775 bytes) - added by alfonsoml 8 years ago.
Patch for IE
1537_2.patch (1.6 KB) - added by martinkou 8 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 follow-up: Changed 9 years ago by w.olchawa

  • Keywords Pending WorksForMe added


Could you please provide more information about the steps that should be taken to reproduce this bug?

I was trying to reproduce the problem using FF2 and everything seems to work fine.

My results:


<br />
<br />
<br type="_moz" />


<br />
<p class="MsoNormal"><span lang="EN-US" style="color: rgb(255, 153, 0);">This is a sample test from MS Word<o:p></o:p></span></p>
<br />
<br type="_moz" />

Maybe you are referring to the problem that a <p> tag is inserted on paste even though your configuration is set to FCKConfig.EnterMode = 'br'; . Please let us know if it is the problem that you are coping with.


comment:2 in reply to: ↑ 1 Changed 9 years ago by Gudea

Replying to w.olchawa:

Maybe you are referring to the problem that a <p> tag is inserted on paste even though your configuration is set to FCKConfig.EnterMode = 'br'; . Please let us know if it is the problem that you are coping with.


I do have that problem! When pasting under certain circumstances the content becomes wrapped with a <p> tag. Its hard to remove that tag but manually through source HTML (what I don't want to leave to the user) I still don't know those circumstances. Sometimes that happens, and others doesn't. I only know that when a <p> tag appears at content's boundaries, it gets too difficult to remove. I found only an unanswered question about that at the forum. Some solution? Thanks

comment:3 Changed 9 years ago by drsskelkar

Persistent problem noticed even in IE7, Firefox and Safari, and other browsers that extra unwanted <p> get inserted around editor text when you switch back and forth between source view and WYSIWYG mode. This problem is reflected in various forms in all the bugs reported in this forum around <p> tag related issues.

comment:4 Changed 9 years ago by fredck

  • Keywords Pending removed

comment:5 Changed 8 years ago by Adam.Cap

I've found that forced paragraph on paste is caused by FCK function InsertHtml. When you create some headings like:


and then you paste from word the empty paragraph between is created (If not, switch the source button and back).

In _source/internals/fck_ie.js is:

// Using the following trick, any comment in the beginning of the HTML will
// be preserved.

html = '<span id="__fakeFCKRemove__" style="display:none;">fakeFCKRemove</span>' + html;
// Remove the fake node

When i comment this lines no empty paragraph was created. So, this workaround will probably also disable including HTML comments inside?? But i hope that it will be helpful for someone.

comment:6 Changed 8 years ago by alfonsoml

  • Keywords Confirmed Review? added; WorksForMe removed
  • Owner set to alfonsoml
  • Status changed from new to assigned
  • Version changed from SVN (FCKeditor) to FCKeditor 2.6.4

The reproduction steps are:

  1. Modify the InsertHTML function in sample08, so it inserts this:
    oEditor.InsertHtml( '<h2>Test</h2><p>- This is some <a href="/Test1.html">sample<\/a> HTML -</p>' ) ;
  2. Now put the cursor at the beggining of the text and press the insert Html button.
  3. Looking then at the source will reveal in IE that a <p> is present before the inserted contents. In Firefox the new content is inside the existing <p> (wrongly nested)

The patch just fixes the IE issue based on the comment by Adam.Cap, but it doesn't do anything for other browsers or other situations.

Changed 8 years ago by alfonsoml

Patch for IE

comment:7 Changed 8 years ago by alfonsoml

  • Milestone set to FCKeditor 2.6.5

Setting milestone to move it away from the top in the pending review list. Even if the patch is checked in, the ticket can't be closed.

comment:8 Changed 8 years ago by martinkou

  • Keywords Review- added; Review? removed
  • Owner changed from alfonsoml to martinkou
  • Status changed from assigned to new

There's a more serious problem here - when the test message is pasted via the Paste From Word dialog inside a paragraph, the paragraph is not split. This is causing the empty paragraph to appear in Firefox.

We can only fix these for the Paste from Word dialog, though. If you paste via Ctrl-V, the paste logic is handled by the browser and it's not our fault that it breaks.

Changed 8 years ago by martinkou

comment:9 Changed 8 years ago by martinkou

  • Keywords Review? added; Review- removed

Added a fix to the same problem in Firefox.

comment:10 Changed 8 years ago by alfonsoml

  • Keywords Review+ added; Review? removed

I think that the only real issue in this bug is just what the patch is addressing, other comments are "noise" coming from the default <p> that it's added to any content, not related to the pasting or insertHtml operations.

comment:11 Changed 8 years ago by martinkou

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with [3888].

Click here for more info about our SVN system.

comment:12 Changed 3 years ago by fredck

  • Component changed from General to Plugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy