-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paste: detect single line and treat as inline text #10614
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. :)
|
||
// If we're allowed to return inline content and there is only one block | ||
// and the original plain text content does not have any line breaks, then | ||
// treat it as inline paste. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a good set of conditions to have in general, even regardless of the very specific issue this is targeting. I'm racking my brains for any unintended consequences this may have.
expect( console ).toHaveLogged(); | ||
} ); | ||
|
||
it( 'should parse Markdown with HTML', () => { | ||
const filtered = rawHandler( { | ||
HTML: '', | ||
plainText: '# Some <em>heading</em>', | ||
plainText: '# Some <em>heading</em>\n\nA paragraph.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this test changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this specific test tests Markdown parsing, which together with this PR would only result into a heading if there's multiple lines paste.
This is a great small change, thanks. |
Please add the ability (sometime down the road...:) to select between bullets and other kinds of icons. For instance numbers, stars etc. Thanks. |
Description
Fixes #6555.
If the pasted content results in one block, and the plain text version has no line breaks, then paste as inline text if
mode
is set toAUTO
.This PR is block agnostic compared to #5354, because it checks the original plain text.
How has this been tested?
See #6555 and #5354.
Screenshots
Types of changes
Checklist: