[wp-trac] [WordPress Trac] #42059: Editor: preview for embedding from URL breaks on switching Text to Visual when selected

WordPress Trac noreply at wordpress.org
Mon Oct 2 08:53:25 UTC 2017


#42059: Editor: preview for embedding from URL breaks on switching Text to Visual
when selected
--------------------------+-----------------------
 Reporter:  azaozz        |       Owner:  biskobe
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.9
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------

Comment (by biskobe):

 > Instead of using span(s) for the selection marker, perhaps better to use
 a zero-width element like <wbr data-wp-selection="start|end" />. These
 will be quite easier to remove from HTML strings. We can also style them
 in CSS, no need for inline styles.

 Great suggestion. Going to implement that, together with the other issues
 you mentioned in the ticket.

 > Keeping selected text is ok, but not essential imho. It's rare to switch
 editors while something is selected. The important part is to keep the
 position of the caret and to scroll to it after switching. If there is a
 selection, consider collapsing it to the beginning and using only one
 <wbr> for a marker.

 I kind of disagree with that. It's not common, because we're used to not
 having the selection transferred between the Editor modes. Keeping the
 whole selection creates a better experience as the user can see what they
 have selected when going to the other mode.
 Collapsing the selection to either end will only give us the cursor, which
 is hard to find in either mode. Imagine having a full screen of text and
 you have to find a tiny cursor that blinks somewhere in it.

 > That way all previews and "dynamic blocks" will work properly no matter
 where they come from.

 So far the only exception I could see to the general Dynamic Blocks / Live
 Preview is the URL embed issue you mentioned in the ticket, as it's not a
 defined shortcode with a Live Preview functionality. Do you see any
 possibility of having dynamic blocks that do not follow the general rule
 for Live Preview? If there is such case, it would be awesome to see it and
 test with it, since even having a single marker can break them if it's not
 positioned properly.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42059#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list