Bug 186224
| Summary: | Copying from inline flex behaves like block level elements. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Samuel Williams <samuel> |
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | megan_gardner, rniwa, samuel, webkit-bug-importer, wenson_hsieh |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 11 | ||
| Hardware: | Mac | ||
| OS: | macOS 10.13 | ||
Samuel Williams
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
```
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/40758006>
Samuel Williams
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.
Ryosuke Niwa
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.
Samuel Williams
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
Samuel Williams
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.
Ryosuke Niwa
Yes, this is an issue. We need to handle flexbox in our copy & paste code. We don't currently have the support for it.