Opened 8 years ago

Closed 5 years ago

#7796 closed Bug (fixed)

Paste as Plain Text Behavior - FF vs. IE

Reported by: Lynne Kues Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: IBM Discussion Cc: satya_minnekanti@…

Description

Run attached example. Copy "Sans" from first line. Paste as plain text at end of second line. On IE, the copied font is maintained. On FF, the text is pasted with default font.

Is this a browser difference?

Attachments (1)

paste-ticket.html (891 bytes) - added by Lynne Kues 8 years ago.

Download all attachments as: .zip

Change History (14)

Changed 8 years ago by Lynne Kues

Attachment: paste-ticket.html added

comment:1 Changed 8 years ago by Lynne Kues

Keywords: IBM added

comment:2 Changed 8 years ago by Jakub Ś

Status: newconfirmed
Version: 3.4.23.0

In IE, Chrome and Safari font is always pasted with formatting of last letter (string concatenation) or last word (space between). I have never managed to paste "Sans" word as plain text.

In Opera and FF (3.6 & 4) it depends.
FF - If you manage to place the cursor behind "Georgia" so that it doesn't catch formatting of last letter/word, text will be pasted without formatting. If cursor catches formatting text will be formatted.

To clean the formatting in FF: copy the “Sans” word, place the cursor behind “Georgia” and press space, place the cursor somewhere in the word “default” and then place it behind word “Georgia ” (notice space). The same effect can be achieved without making space behind word “Georgia” but not on regular basis.

Opera - I did not get any regular test cases. It was pretty random.

There is definitely browser incompatibility but I'm actually not sure myself whether the font should be pasted as continuation of last word/letter or as the name implies - plain text.

Anyone care for a comment?

comment:3 Changed 8 years ago by typeof

There was also some discussion on this topic here: http://cksource.com/forums/viewtopic.php?f=11&t=15555 (especially starting from the second post).

comment:4 Changed 8 years ago by Frederico Caldeira Knabben

Keywords: Discussion added

"Paste as Plain Text" means that no formatting will be taken in consideration from the source data, having just text coming from it.

Pasting is contextual. It means that it will fit the styles of the context it is being pasted on. If we "reset" the styles, we'll be changing the format for that specific context.

Keep in mind that HTML content is contextual, by design. If you take text produced with the editor and inject it into a <b> tag in a front-end static page, the entire contents will be bold.

Now, back to the difference... some browsers, especially Firefox, make it easy to move in and out element boundaries, while others, especially IE, doesn't provide this feature at all.

In Firefox, there are two options when you move the mouse to the boundaries of an element:

  • If you were inside the element, you'll remain inside of it. (like <b>text^</b>)
  • If you were outside the element, you'll remain outside of it. (like <b>text</b>^)

This makes the difference, when we talk about context on pasting. It'll definitely depend on were the cursor js effectively placed.

In the advanced user point of view, I see this much like a nice feature, than a bug, because you can precisely decide what you want. But I understand that some users may be confused.

There is little we can do here, considering that this is a browser behavior. We could add hacks, to "fix" the caret position. But the question is... is it worth?

comment:5 Changed 8 years ago by typeof

@fredck I think that this might be more general problem. It's not only inserting plain text on node boundaries but also inserting html in the middle of a node.

E.g. in FF type something in bold, place the caret in the middle of it and try to paste some text (let it be "foo") using:

  • paste - foo is not bold
  • paste as plain text - foo is bold

In the IE foo is bold in both cases.

I think we should clearly state what are the expected results of the pasting operations :)

comment:6 Changed 8 years ago by Frederico Caldeira Knabben

@typeof, yes, you're right. That's a known case (I'm sure there is already ya ticket for it). This is in fact a default browser behavior, not controlled by us.

In any case, this has nothing to do with the current ticket (strictly speaking). This one is focused on understanding the contextual aspect of Paste as Plain text.

comment:7 Changed 8 years ago by typeof

Well, actually I'm trying to provide a solution to the insertHtml problem and there is a similar contextual aspect there.

If you type in the editor

"hello| world" (| being the caret)

and now you want to insert " big" - should it be bold or not?

That's why I am asking for general rules here :)

E.g. "Always use context of the preceding character" or "Use context according to the previous caret position" or maybe even make it configurable for the user (writer)?

comment:8 Changed 8 years ago by Frederico Caldeira Knabben

On pasting, the contextual results must reflect what the user sees at the toolbar. This means that, if the bold button is active, the pasted text will be bold.

The problem here is not the rule *during pasting* (insertHtml), but instead the rules regarding caret positioning *before pasting*, while the user moves through the document. This reflects the behavior that I've described earlier for Firefox.

The ideal solution here would be porting the Firefox behavior to all browsers. This would involve a lot of hacks though, which we're not willing to deal with right now.

comment:10 Changed 8 years ago by Jakub Ś

After discussion with @wwalc we decided to create an "extension issue" to this ticket. it was reported here #8195.

comment:11 Changed 8 years ago by Satya Minnekanti

Cc: satya_minnekanti@… added

comment:12 Changed 8 years ago by Garry Yao

I can confirm it's working well in v4 paste.

comment:13 Changed 7 years ago by Jakub Ś

Replying to @fredck

On pasting, the contextual results must reflect what the user sees at the toolbar. This >means that, if the bold button is active, the pasted text will be bold.

I have reported this issue for IE8 and IE9 in #8416

comment:14 Changed 5 years ago by Piotrek Koszuliński

Resolution: fixed
Status: confirmedclosed

We fixed this in CKEditor 4.0.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy