#39337 closed defect (bug) (fixed)
TinyMCE: when a wpview is the last element, insert an empty paragraph (caret placeholder) under it
Reported by: | azaozz | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.8 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | TinyMCE | Keywords: | has-patch |
Focuses: | Cc: |
Description
This will make the user experience a bit better: the users will be able to continue typing right away.
It will also fix the problem with "half-selected" wpviews after initializing the editor. Moving the caret to the placeholder also moves the focus off the first element when it is a non-editable wpview.
Attachments (4)
Change History (12)
#2
@
8 years ago
...better to keep "native" behaviour and place the caret after the block, where the user can press enter to create a new paragraph.
Agreed. In 39337.2.patch: select the wpview node after inserting it, then collapse the selection. This places the caret after the wpview node. It also fixes the "half-selected" bug when the node is first in the body.
#3
@
8 years ago
In 39337.3.patch: Pass the editor event to wp.mce.views.setMarkers()
for context, then use it to move the cursor after the newly inserted wpview node, or to deselect the wpview on initial loading.
#5
@
8 years ago
I'll give the patch a try. My initial thought was to add this to the wpview plugin.
#6
@
8 years ago
Yeah, would have been better if it was in the plugin, but not possible. It needs to run when we replace the markers, the plugin is not used then. This may be possible when we have UI for entering these "blocks". Then we would know that something is a block as soon as it is entered, may even not need the "markers" any more.
Was also thinking wpview would need some refactoring, and we should move the TinyMCE parts to the plugin. Looking at things like setMarkers()
, getMarkers()
, replaceMarkers()
, setContent()
, etc. Can export them in editor.wp
or add custom events where it makes sense.
#7
@
8 years ago
39337.4.patch works properly here and makes it exactly as before.
It doesn't fix the "wpview node partially selected after page load when it is first in the body". This seems identical to #37753 and very similar to #38849. Lets track that in #37753.
What about blocks that are inserted after init? Maybe we should just create a paragraph whenever the area after the block is clicked? In my opinion it's still better to keep "native" behaviour and place the caret after the block, where the user can press enter to create a new paragraph. I see that this currently doesn't happen. This was the behaviour before we switched to the mce implementation.