[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:43:37 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 azaozz):

 Couple more ideas:

 1. 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.

 2. 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. For images, shortcodes, and other embeddable "blocks"
 we can collapse to before the beginning, even insert an empty paragraph in
 MCE then remove it after switching to Text. That way all previews and
 "dynamic blocks" will work properly no matter where they come from.

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


More information about the wp-trac mailing list