-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Post title: handle paste as blocks #21758
Conversation
Size Change: +242 B (0%) Total Size: 842 kB
ℹ️ View Unchanged
|
onInsertBlockAfter( content ); | ||
} | ||
} | ||
} |
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.
Do you think there's logic to be shared between this and the other place we're using it today (RichText?)?
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.
I think as soon as we turn the title into a block a few things would have to be consolidated.
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.
Right, there is logic that can be shared, but we should instead aim to turn the post title into a block, which means the logic will automatically be shared through either RichText or PlainText v2.
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.
Let's merge this and iterate. I was looking at e2e tests quick, but we need to emulate all clipboard behaviour on textarea and I didn't get it to work immediately. |
Thanks @ellatrix ! Love these small quality-of-life improvements :) |
Description
This PR handles pasting in the post title (post editor) a bit better. Before everything would be pasted inline as the title, now we parse the pasted content as blocks and paste the block after the title. If the first block is a heading or a paragraph AND the title is empty, the content of this first block will be used for the title. I've left out more complex splitting, for example when there would be already text in the title and the selection is in the middle. Ideally we should be using RichText or PlainText version 2 for the post title, which has built in splitting and paste handling, but in order to use this, the post title should be a real block... which I think we plan to do at some point? I recall having run into problems with the post title block a few times now because it's not a real block, especially with writing flow. Cc @youknowriad @mtias.
To do: maybe add some e2e tests.
How has this been tested?
Paste a few blocks of text from a page into the post title. Also try to paste a small string of text, try with title already filled in etc.
Screenshots
Types of changes
Enhancement
Checklist: