[wp-trac] [WordPress Trac] #41962: Editor: Keep text selection between Visual and Text modes
WordPress Trac
noreply at wordpress.org
Sat Sep 23 21:20:40 UTC 2017
#41962: Editor: Keep text selection between Visual and Text modes
-------------------------+-----------------------------
Reporter: biskobe | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: trunk
Severity: normal | Keywords:
Focuses: javascript |
-------------------------+-----------------------------
== Summary ==
This proposal aims to improve the Editor experience by keeping the text
selection when switching between Visual and Text modes.
== A GIF is worth a thousand words ==
''(to be added after submitting the ticket)''
== What is this? ==
The editor has no functionality to save the selection in one mode and
transfer it to the other. This patch adds a basic functionality that does
that.
What is currently supported:
* Cursor position is preserved
* Selection range is preserved
* Clicking inside an HTML tag in Text mode selects the whole tag. This
prevents breaking of the element when switching to Visual mode
* Selecting an object (e.g. Image) in Visual mode should select the whole
HTML tag in Text mode.
* The view is automatically scrolled to the selected position when
switching between modes. This makes it easier to find where the current
selection is, without having to manually scroll to find it.
* Support for some shortcodes, i.e. `[caption]`
== To test ==
1. Apply patch
2. Open the editor
3. Add content, click around, select things
4. Switch between modes
5. Try adding embeds
6. Try adding shortcodes
Look for JS errors in the console, weird behavior, etc.
== Feedback ==
Please, add any feedback as a comment here or as a comment on the
development PR, linked below.
== Current status ==
The patch is still in development, as it requires some code polishing.
Current development is happening on GitHub, under this PR:
https://github.com/bisko/wordpress-develop/pull/1
Once I finish up polishing, I will add the patch as an attachment here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41962>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list