Opened 16 years ago

Closed 15 years ago

Last modified 10 years ago

#1537 closed Bug (fixed)

Forced <p> on paste

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

Description

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">
  <p>
    <br type="_moz"/>
  </p>
</body>

and this is after paste:

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

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

Attachments (2)

1537.patch (775 bytes) - added by Alfonso Martínez de Lizarrondo 15 years ago.
Patch for IE
1537_2.patch (1.6 KB) - added by Martin Kou 15 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 16 years ago by Wojciech Olchawa

Keywords: Pending WorksForMe added

Hi!

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:

BEFORE PASTING FROM WORD:

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

AFTER PASTING FROM WORD:

<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.

Thanks

comment:2 in reply to:  1 Changed 16 years ago by Leo

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.

Thanks

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 16 years ago by Dr. Sharad Kelkar

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 16 years ago by Frederico Caldeira Knabben

Keywords: Pending removed

comment:5 Changed 15 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:

<h2>blabla</h2>

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
FCK.EditorDocument.getElementById('__fakeFCKRemove__').removeNode(true);

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 15 years ago by Alfonso Martínez de Lizarrondo

Keywords: Confirmed Review? added; WorksForMe removed
Owner: set to Alfonso Martínez de Lizarrondo
Status: newassigned
Version: SVN (FCKeditor)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 15 years ago by Alfonso Martínez de Lizarrondo

Attachment: 1537.patch added

Patch for IE

comment:7 Changed 15 years ago by Alfonso Martínez de Lizarrondo

Milestone: 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 15 years ago by Martin Kou

Keywords: Review- added; Review? removed
Owner: changed from Alfonso Martínez de Lizarrondo to Martin Kou
Status: assignednew

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 15 years ago by Martin Kou

Attachment: 1537_2.patch added

comment:9 Changed 15 years ago by Martin Kou

Keywords: Review? added; Review- removed

Added a fix to the same problem in Firefox.

comment:10 Changed 15 years ago by Alfonso Martínez de Lizarrondo

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 15 years ago by Martin Kou

Resolution: fixed
Status: newclosed

Fixed with [3888].

Click here for more info about our SVN system.

comment:12 Changed 10 years ago by Frederico Caldeira Knabben

Component: GeneralPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy