Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Separate Paste Handler #11539
This PR separates paste handling from raw handling in general. I opted of a separate function instead of an extra argument because raw handling is significantly less complex and doesn't need as many arguments to works with. Raw handling aims to convert HTML without comment delimiters to blocks, trying to retain as much content as possible.
Needs an integration test.
How has this been tested?
Convert HTML/Classic block to blocks with e.g. a span with attributes in a paragraph.
Types of changes
referenced this pull request
Nov 6, 2018
@iseulde I tried testing with
Can you update your testing instructions to include more detail about how to reproduce the behavior of the change? Thanks
I'm not totally convinced that paste and raw are fundamentally separate things, vs. the former applying a more strict set of filters in the general operation of raw transformation. It makes me wonder if
filters should be handled as an argument of the HTML -> blocks transform function. Then again, this still means we'd have to either decide between exposing filters on the public interface, or otherwise provide just as we have done here with an abstracted form ("paste", "raw"). Maybe then this consideration just becomes a future refactoring detail.
Overall, I think this is a positive change
If this is the wrong place to post this I apologize. I've been posting to the #6012 string and I'm not sure whether to comment here or there.
Testing what happens now with the Gutenberg plugin:
If I copy the marked-up content in 'edit in html', make a new block, switch to 'edit in html' in the new block, paste my marked-up content, and update, the markup is preserved.
If I copy the marked-up content in 'edit visually', make a new block, switch to 'edit in html' in the new block, paste my copied (marked-up) content, and update, the markup is stripped.
So there's some kind of existing copy/paste functionality which doesn't strip the markup.
This pull request doesn't, no. There's an ongoing conversation in #11440 on to what degree Gutenberg will support those behaviors. If you'd like, please do weigh in on #11440 with more details of your use-case, the markup you'd like to preserve, etc. Thanks :)