1

I am making a web-based chat program. When users select from the chat log, and copy to clipboard, I would like to control the format of the text better. For example here is what the chat log looks like:

enter image description here

When the user selects this and copies to clipboard, here's what they get:

Alice Springs 12:45 PM
Hi this is some text, what's up?
Boo Radley 12:47 PM
Whoa, didn't see ya there... not much.

This is actually not that bad, but as the application gets more complex this will get more and more obfuscated. I would like to be able to control this better, and copy something more friendly for text-based chat log:

[12:45] <Alice Springs> Hi this is some text, what's up?
[12:47] <Boo Radley> Whoa, didn't see ya there... not much.

Here is the markup for a single message:

<div class="chatLogMessageEntry">
    <div class="avatar"></div>
    <div>
        <div class="senderName">Boo Radley</div>
        <div class="timestamp">12:47 PM</div>
        <div class="confirmation"></div>
        <div class="message">Whoa, didn't see ya there... not much.</div>
    </div>
</div>

Is this possible? How is this accomplished?

tenfour
  • 36,141
  • 15
  • 83
  • 142

0 Answers0