Bug 186224 - Copying from inline flex behaves like block level elements.
Summary: Copying from inline flex behaves like block level elements.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 11
Hardware: Mac macOS 10.13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-01 21:41 PDT by Samuel Williams
Modified: 2019-04-11 21:24 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Williams 2018-06-01 21:41:55 PDT
When copying the text from

```
<div style="display: inline-flex; white-space: pre">
  <span>This </span>
  <span>is </span>
  <span>flex </span>
</div>
```

The data that would be pasted would contain multiple lines:

```
This 
is 
flex 
```

And yet that is not similar to how it is presented in the browser:

```
This is flex
```
Comment 1 Radar WebKit Bug Importer 2018-06-03 14:42:43 PDT
<rdar://problem/40758006>
Comment 2 Samuel Williams 2018-06-03 20:44:29 PDT
I would like to add, this isn't just specific to inline-flex. It's possible that other flex box layouts do strange things when copying/pasting to plain text. Basically, copying/pasting from flex boxes generates unexpected output.
Comment 3 Ryosuke Niwa 2018-06-04 10:08:55 PDT
We don't have any code to handle flex box for copy & paste so anything is possible. We probably need to do some work to support both flex box & grid layouts in our copy & paste logic somehow.
Comment 4 Samuel Williams 2018-06-05 22:24:53 PDT
I did work around the issue by using an `oncopy` event handler:

https://github.com/ioquatix/jquery-syntax/blob/3cf6353facbc807c94b53cdf48c372547b7ac089/source/jquery.syntax.core.js#L45-L66
Comment 5 Samuel Williams 2019-04-07 05:46:31 PDT
I am just reporting that this is still an issue. You can see a live example here:

https://www.codeotaku.com/journal/2018-06/improving-ruby-fibers/index

Try copying only the code, it will invoke the copy handler which copies it as plain text.

If you try to copy it including some of the preceding paragraph, it won't invoke the copy handler. If you paste the result into, say, TextEdit, you will get odd output.
Comment 6 Ryosuke Niwa 2019-04-11 21:24:35 PDT
Yes, this is an issue. We need to handle flexbox in our copy & paste code. We don't currently have the support for it.