Closed Bug 169586 Opened 22 years ago Closed 22 years ago

Plain text is always pasted in default font not the one in context.

Categories

(Core :: DOM: Editor, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ssaux, Assigned: mozeditor)

Details

(Whiteboard: fixinhand; need r=,sr=)

Attachments

(1 file)

If you copy some plain text somewhere and then click in the middle of an editing
session that has rich text formating, you would expect the plain text to inherit
the formating of the context.

To reproduce in the NS7 composer: 

1.  Type in any sentence.  
2.  Explicitly make it Courier and green using the Format > Font > Courier and 
Format > Text Color menu options.
3.  Paste plain text in the middle.  
4.  The pasted text is black and in some other font (your default body font, I 
assume.)

Reference: blackflag 609921
--> jfrancis@netscape.com
Assignee: kin → jfrancis
How does the user know it's plaint text?  Most of the time, you don't know.  And
if we adopt an "inheritance" policy for plaintext and retain the wysiwyg poilicy
for html, users will be confused when plaintext inherets but "plain looking"
html text doesn't.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
verified.
Status: RESOLVED → VERIFIED
We need to reopen this (I can't do it, but SSaux should be able to.)

Basically, this is still an issue for the embeddor, and the behavior that they
expect is actually what other applications seem to implement.  The best way to
describe the proposed solution is "the richest content available in the
clipboard should be the one used"

I ran this test between Notepad and MS Word:
   1. Open Word, type some test sentence.  Make it bold.
   2. Open Notepad, type some test text.  Copy it on the clipboard.
   3. Go back to Word, put the insertion caret in the middle of the test bold
sentence.  Paste the text from Notepad right there, in the middle.

As expected by the embeddor, the text that gets pasted into Word inherits the
text style of the current area (bold, in this case.)

If you copy/paste from elsewhere in Word, since the clipboard now contains a
richer format (formatted by Word), pasting into the middle of our test sentence
does not inherit the bold style, but imposes its own.
reopening.
Status: VERIFIED → REOPENED
Resolution: WONTFIX → ---
ok, as long as we are making the distinction based on data flavor, this is 
doable.  How the user is expected to know what data flavor they have is beyond 
me, though, so I expect many will get confused.  

But as long as I don't have to read their minds I can make it work like you want.  
:-)
Status: REOPENED → ASSIGNED
Target Milestone: --- → M1
inherit inline styles when pasting plaintext into html
Whiteboard: fixinhand; need r=,sr=
Comment on attachment 101905 [details] [diff] [review]
patch to nsHTMLDataTransfer.cpp

sr=kin@netscape.com
Attachment #101905 - Flags: superreview+
Comment on attachment 101905 [details] [diff] [review]
patch to nsHTMLDataTransfer.cpp

r=brade
Attachment #101905 - Flags: review+
fix landed on trunk
Status: ASSIGNED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → FIXED
Woah, please please please read bug 64647 *completely* before implementing this
"fix"!

Particularly the statement in comment #4 ("the richest content available in the
clipboard should be the one used") is simply *wrong*.

Particularly relevant are bug 64647 comment #26 and bug 64647 comment 28.
http://bugzilla.mozilla.org/show_bug.cgi?id=64647#c26

The correct way to fix this bug would be to always paste using the *source*
formatting (and not the target formatting) - unless the user selected "Paste
without Formatting" (see bug 64647).

Therefore please REOPEN this bug.
Peter, I don't know what you are talkig about (and I have read the bug you refer 
to, which is different from this bug).  The original bug here (see top testcase) 
is fixed.  Why would it be reopened?
JF: OK, I can see why in this *particular* case (paste plaintext into formatted
html text), why this bug makes sense. Sorry for panicking).

This seems to contradict the third line of the following table (taken from bug
64647 comment 26):

HTML Mail Compose Window (e.g., for e-mail):
-------------------------------------------
SOURCE     TARGET     PASTE RESULT
----------------------------------
plaintext  plaintext  plaintext
HTML       plaintext  HTML (same as source)
plaintext  HTML       plaintext (fixed width?)  <-- this one may be wrong!?
HTML       HTML       HTML (format of source)

How to proceed from here?
Peter, there has not been any buy-in on the third line of the table.  Instead
the requests I have gotten so far have indicated that plaintext should paste
into html  as if the user simply typed it in.  So it should inherit any existing
styles.

So for now I would say that the table is wrong, not the fix.
Once "Paste without Formatting" (bug 64647) is available, wouldn't it make more
sense to use the table's rule for logical consistency? 

That way, users could simply *always* select "Paste without Formatting" if they
want the target's formatting, and regular "Paste" if they want the source's
formatting.
The most important thing is for regular paste to do what most folks want.  What
it is that they want is open for debate, but for now I've been told to make it
work the way it does now.
Sorry, but I disagree. The most important thing is for people to be able to do
what they want easily *and* for Mozilla to behave in a *consistent* way.

Also, if you were told to do something *before* the facts from comment 11 and
comment 13 were known by those who are telling you to do this, then I hope you
*inform them* of these new facts, so they have a chance to recognize their
potential error.

My suggestion for this bug is WONTFIX.
"Consistency" and "Format" are in the eye of the beholder.  

Format: I might very well think that plaintext source doesn't even *have* a
source format.  Plaintext can come from a lot of places, including other
programs where who knows how it was displayed (fixed width or not? black on
white or white on black?).  Thus when you paste it you should get the target
format because that's all there is.  Anything else is making stuff up.  

Consistency: Why would plaintext paste any differrently than the text would be
typed?  It's text entry either way, so why should they end up looking different?

The solutions you propose do not have as strong a claim on the grail of
consistency as you might think.  That's why so many folks have different ideas
about what should happen.
I still disagree. A reguar Paste of plaintext into an HTML window should show
the pasted text *as if* the user had selected formatted html text and selected:
Format > Remove all text styles.

The rule of thumb should be: Regular paste uses the formatting of the *source*.

The plaintext source is "unformatted" (has "no" formatting - as you stated), and
the regular paste should maintain the source formatting. Therefore the pasted
text should have the formatting of the source - which is *no* formatting, which
is the same as: Format > Remove all text styles.

OTOH, The rule of thumb for "Paste without Formatting" should be: use the
formatting of the target.

In this case the pasted plaintext text would look just like the text at the
insertion point (e.g., green, italics, large).

I almost *exclusively* use "Paste without Formatting" because it almost always
what makes sense. I use regular paste only if i am *referring* to another
document and want to show it as-is.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: