-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Default Editable enter behavior to newline #374
Comments
It seems like this change would be good to try out sooner rather than later. |
What needs to happen here? All blocks add BR on enter, P on double? |
I'm wondering if the current behavior is sufficient for what we want. It doesn't default to newlines, but at least handles the multiple consecutive paragraphs as a block split intent. |
@mtias @jasmussen Do you agree with this? Does anything need to change? |
It seems like the two approaches we're looking at:
I think the current behavior works well, and is a nice callback to the current wp-admin. I'm okay with making a decision that we keep this. However the arguments in favor of option 2 are strong, in my book. It's the standard behavior for most other text editors. It fixes the mystery meat that is inherent in having to create single linebreaks using shift enter. And it allows mobile users to create single linebreaks without entering HTML mode. Option 2 also feels like a big change, which is why it'd be good to do it soon. To help us make a decision (and I'd like @mtias thoughts too), how much work would it be to switch to option 2? It sounds like a lot, which would make me lean towards option 1. |
The behavior hinges on TinyMCE's |
I wast wondering if we could otherwise have the inline config for all blocks and the text block be one paragraph. Then break on multiple line breaks. |
I think that option (2) here should be a separate block type, and the default text block should keep the current behavior of "enter = new paragraph". |
We recommend using paragraphs as the default since paragraph has semantic meaning and this is the default line break behavior of common word processors like Word, LibreOffice, Google docs etc except that the paragraph margin is 0 in some of them. Also knowing that you have a fixed format of producing paragraphs means that you can know what to do when converting say a list to paragraphs if you have some form of mixed style with br:s and paragraphs you can't reverse that process since that information has been lost. Having some mixed mode would become very complex fast since there is no strict rules sometimes it would do one thing sometimes it would do something else and the end user wouldn't be able to tell when since they can't even see the br:s. However there are situations where we need to produce BR elements by default in tinymce even if the forced_root_block is set to 'p', that is inside elements that can't semantically have a paragraph. Could be things like nested spans as the editable host etc. |
I think we addressed all this in the form of a prop now. Some editables like text and heading can split on double enter, others like captions will never split. See also #1078. Feel free to reopen or create a new ticket if there are remaining concerns. |
This is related to how we want to handle block splitting, e.g. pressing enter in the middle of a paragraph. But more specifically to changes introduced in #347, nothing occurs when pressing enter in a text block. We could consider defaulting this to a newline via TinyMCE settings.
https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block
We should also consider how this impacts inline editables (quote citation, image caption). We can control this via
Editable
prop if need be.The text was updated successfully, but these errors were encountered: